Manually Adjusting Geocoder Results by Dragging the Pin to New Locations

15 views
Skip to first unread message

Dr. Ezra Boyd

unread,
Jun 20, 2017, 7:26:49 PM6/20/17
to Google Maps JavaScript API v3


We are working on a geocoder module using Google Maps JS API. We have a webform where the user enters their address with a map element next to it. When the user submits their info, a pin for the geocoded location shows up on the map. For the cases where the results are incorrect, is it possible to set it up so that the user can interactively drag the pin to the correct location?

Thanks,
Ezra

Barry Hunter

unread,
Jun 20, 2017, 7:35:54 PM6/20/17
to google-maps-js-api-v3
Sure, why not?

There must be code that when it receives the geocoder response, it adds a marker to the map. Just make sure it sets 'draggable:true' on the options for the marker.

You must also store the location in the form (in hidden fields?) so can submit. Just have a dragend event on the marker, update the same details as the geocoder reply does. 

 



--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-maps-js-api-v3+unsub...@googlegroups.com.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
Visit this group at https://groups.google.com/group/google-maps-js-api-v3.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages