Drag and Drop Markers in Google Maps using JavaScript
文章推薦指數: 80 %
The Google Maps is populated using an array consisting of some locations. In order to make the markers draggable, you will need to set the draggable property to ...
Home
Categories
Questions
InterviewQuestions
Contact
Search
Search
Home
Categories
Questions
InterviewQuestions
Contact
Search
18Aug2014
MudassarKhan
2
Comments
39278 Views
Google
HereMudassarAhmedKhanhasexplainedhowtomakethemarkersDraggableinGoogleMapsV3withexamplei.e.howtodraganddropmarkersinGoogleMapsusingJavaScript.Inadditionaltothedragdropfunctionality,hehasalsoexplainedhowtogetthelocationdetailsi.e.Latitude,LongitudeandAddresswhenthemarkerisdroppedusingthemarkerdragendevent.
Download
ViewDemo
DownloadFreeWord/PDF/ExcelAPI
DownloadFreeWord/PDF/ExcelAPI
InthisarticleIwillexplainhowtomakethemarkersDraggableinGoogleMapsV3withexamplei.e.howtodraganddropmarkersinGoogleMapsusingJavaScript.
Inadditionaltothedragdropfunctionality,Iwillalsoexplainhowtogetthelocationdetailsi.e.Latitude,LongitudeandAddresswhenthemarkerisdroppedusingthemarkerdragendevent.
DragandDropMarkersinGoogleMapsusingJavaScript
TheGoogleMapsispopulatedusinganarrayconsistingofsomelocations.Inordertomakethemarkersdraggable,youwillneedtosetthedraggablepropertytotruewheninitializingtheGoogleMapmarkerobject.
Nowifyouneedtocapturethegeographicaldetailsofthelocationwherethemarkerisdropped,youneedtoimplementdragendeventhandlerofthemarkerwhichisinvokedoncethemarkerisdroppedatsomeplaceonthemap.
Insidethedragendeventhandler,youcaneasilygettheLatitudeandLongitudeofthelocationandifyouwishtoextendfurther,youcanmakeuseoftheGoogleMapsGeoLocationAPIandusingtheLatitudeandLongitudeofthelocationyoucaneasilyfinditsAddress.
Note:FormoredetailsontheGoogleMapsGeoLocationAPI,pleaserefermyarticleGoogleMapsGeoLocationAPIExample.
延伸文章資訊
- 1Drag and Drop to Sort Locations and Render Routes - Medium
Google Maps Platform, especially the places library and the directions service. Drag and Drop Ele...
- 2Google Maps › Draggable Marker - DummyPoint
Draggable Marker. Dashboard. Google Maps. Draggable Marker. Draggable Marker. Here is a simple ex...
- 3Google Map With Draggable Marker Example
Today we will learn google map with draggable marker example. Here, we will see how to add google...
- 4Drag and Drop Markers in Google Maps using JavaScript
The Google Maps is populated using an array consisting of some locations. In order to make the ma...
- 5Draggable Directions | Maps JavaScript API
Google Maps Platform · Maps Platform ... This example demonstrates the use of the DirectionsServi...