Need help adding a "add marker" button inside of the map.

1,549 views
Skip to first unread message

whereschp

unread,
Jun 22, 2010, 5:36:27 PM6/22/10
to Google Maps JavaScript API v3
Can anyone point me in the direction of how to add a button which when
clicked will change the cursor to and add marker function.

I would like it to look something like this http://whereschp.com/img/test.jpg
It will primarily be used for mobile devices.

pete

unread,
Jun 22, 2010, 6:53:44 PM6/22/10
to Google Maps JavaScript API v3
What you are looking for is a custom control
See this link for documentation and a couple of working examples:
http://code.google.com/apis/maps/documentation/javascript/controls.html#CustomControls

Extending the example in the link above, you can add a marker
"onclick" of the control

google.maps.event.addDomListener(controlUI, 'click', function() {
var marker = new google.maps.Marker({
position: map.getCenter(),
map: map
});
});

Hope this leads you in the right direction

Pete

On Jun 23, 7:36 am, whereschp <wheres...@gmail.com> wrote:
> Can anyone point me in the direction of how to add a button which when
> clicked will change the cursor to and add marker function.
>
> I would like it to look something like thishttp://whereschp.com/img/test.jpg

whereschp

unread,
Jun 22, 2010, 8:08:43 PM6/22/10
to Google Maps JavaScript API v3
thanks

whereschp

unread,
Jun 22, 2010, 10:39:58 PM6/22/10
to Google Maps JavaScript API v3
I also have a problem with my div table.
Why in V3 does this not work for me?
<div id="map" align="middle" style="width: 100%; height: 100%"></div>

The V3 map works with this one.
<div id="map" align="middle" style="width: 716px; height: 605px"></
div>

In V2 the 100% works fine on the same map.

Ralph Ames

unread,
Jun 22, 2010, 11:18:09 PM6/22/10
to google-map...@googlegroups.com
In V2 the 100% works fine on the same map.

http://econym.org.uk/gmap/basic19.htm


Ralph
-
www.easypagez.com/maps/map_index.html
www.easypagez.com/maps/v3_basicmap.html


--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to
google-maps-js-a...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

whereschp

unread,
Jun 22, 2010, 11:27:04 PM6/22/10
to Google Maps JavaScript API v3
Thanks again works great.
Reply all
Reply to author
Forward
0 new messages