Google Maps API marker image not visible on mobile device when below 55px

2,324 views
Skip to first unread message

Paul Hayes

unread,
May 10, 2011, 11:08:28 AM5/10/11
to google-map...@googlegroups.com

Hi,

I am developing a website for a mobile device and using google maps with a simple marker being displayed, now the marker works fine on the desktops and on an android phone, but on a nokia N97 and N8, the marker is only rendered when the pizel size is below 55px.

the code snippet below shows how i am adding the marker.
 
    var map = new google.maps.Map(document.getElementById("VehicleMap"), myOptions);

        var currentMarker = new google.maps.Marker({
            position: myLatlng,
            title: '@Model.Status',
            icon: image
        });
        currentMarker.setMap(map);
        map.setCenter(myLatlng);

does anybody know why the image size effects it being displayed?

Paul

Thoern

unread,
May 11, 2011, 2:09:36 AM5/11/11
to Google Maps JavaScript API v3
Hi you could test storing at a local server
currentMarker.setIcon("images/MyImage.png");
currentMarker.setMap(map);

it might be some browser specific issue.
There are an online picture resizer that works great if u google on
it, I used it to get iphone webb app picture to 57x57px

Krasimir Krastev

unread,
Jan 16, 2012, 11:31:48 AM1/16/12
to google-map...@googlegroups.com
Hello, I have the same problem now... Did you resolve it? Could you share your experience. Thanks.

Enoch Lau (Google Employee)

unread,
Jan 16, 2012, 5:12:49 PM1/16/12
to google-map...@googlegroups.com

Beatriz Gonzalez

unread,
Jan 17, 2012, 7:50:34 AM1/17/12
to google-map...@googlegroups.com
Hi,

did you try using sprites? 

map.options.markerOptions.image.bmw.normal = new google.maps.MarkerImage(
 '/common/img/app/metropolis/mobile/dn-sprites.png', 
  new google.maps.Size(18,30),
  null,
  null,
  new google.maps.Point(0,0)
);

* for nokia/symbian the 2 "null, null," are important * (if you don't have them it won't show the images)

with  "new google.maps.Point(0,0) " you can say the position of you icon in the image (mine is at the top left corner: 0,0).

my marker-symbol is 33x51px and i have no problem. Then i have there (in the same sprite) also the cluster-symbols which are up to 176x181px and work just as good. They all work allright in Symbian & BlackBerry. (of course also in Android, iPhone & iPad)

I have symbian issues when clicking to show the infowindow. Jquery solves some of them, but i'm still working on it. 

I hope it helps

Beatriz Gonzalez

unread,
Jan 19, 2012, 6:10:54 AM1/19/12
to google-map...@googlegroups.com
For position 0,0 the previous Code works just fine, but  for the background position from Sprite to work, has to be in this order:

map.options.markerOptions.image.bmw.normal = new google.maps.MarkerImage(
 '/img/mobile/sprite.png', 
  new google.maps.Size(18,30),
new google.maps.Point(30,0), null, null );

 where "new google.maps.Point(x_pos,y_pos)"


Reply all
Reply to author
Forward
0 new messages