maps v3 marker icon won't display

127 views
Skip to first unread message

davis

unread,
Apr 7, 2010, 9:31:08 PM4/7/10
to jQTouch
Hi, I hit this issue that has already been filed:
http://code.google.com/p/jqtouch/issues/detail?id=213&q=marker%20icon

The recommended solution to change body > * to body .page is no good
for me. Makes the whole app behave very poorly on map pan/zoom.

I've been debugging this with Safari and Firebug, and I'm inspecting
the css properties for the div that contains the marker when I toggle
between body > * (where the icon won't show up) and body .page (where
the icon does show up)

body > *

height: 0px;
left: 334px;
top: 210px;
width: 0px;

body .page

height: 37px;
left: 318px;
top: 173px;
width: 32px;

Obviously if height and width are zero, the icon won't show, so I
wrote a quick/dirty jquery to fix this.

function fixCarIcon() {
$("div[style*='car.png']").css('width', '32px').css('height',
'37px');
}

This is very specific to my code, but you get the idea. The height
and width of the png are static, so I know I can always set them.

I call this after I add a marker to the map, and it works, kind of.
The problem is that the left and top values are still off. The lat/
lng position of the icon is set the same...like so:

function addCurrentLocation(latlng) {
marker = new google.maps.Marker( {
position : latlng,
map : map
});
}

I know the height and width are always the same, but the top/left are
going to be dependent on the lat/lng, so I'm not sure why these values
are calculated differently.

I know the Map object has a function to get the x/y coordinates from a
lat/lng, so I guess I'll try that next...perhaps I can use that to set
the top/left, but honestly, this whole thing is one giant hack, and I
wish there was a better way.

Any ideas?

Regards,
Davis

Dave Olsen

unread,
Apr 7, 2010, 9:47:19 PM4/7/10
to jqt...@googlegroups.com
I'm not sure how much help this will be... I had to get Google Maps
with custom markers working for our campus mobile site. I never got
far enough with v3 to implement the markers but maybe this information
on what changes I had to make with code examples might still prove
useful. I've ended up sticking with v2 for now.

http://mobiweb.pbworks.com/Google-Maps-and-jQTouch

I realized after I wrote that that I didn't take into account rotation
of the device. I've fixed that locally but never updated those
directions. If you need that code too let me know. Not sure how much
has changed honestly.

> --
> To unsubscribe, reply using "remove me" as the subject.
>

--

Proud supporter of DC United

Davis Ford

unread,
Apr 7, 2010, 10:13:02 PM4/7/10
to jqt...@googlegroups.com
Thanks Dave,

I'm giving up on the combo of maps v3 + jqtouch, and going back to maps v2.

Implementing the switch back now...hopefully it fixes many of the
issues I've had with trying to get these two to play together nicely.

Your examples are helpful.

Best regards,
Davis

--
Zeno Consulting, Inc.
home: http://www.zenoconsulting.biz
blog: http://zenoconsulting.wikidot.com
p: 248.894.4922
f: 313.884.2977

Reply all
Reply to author
Forward
0 new messages