bradcornford / Googlmapper

An easy way to integrate Google Maps with Laravel
MIT License
464 stars 142 forks source link

not able to get long, lat and address on Draggable Markers #256

Closed devParry closed 5 years ago

devParry commented 6 years ago

Hi,

I am new in laravel. I am using googlemapper i have successfully display map on my view page. now ihave to get long and lat and display into the text box. while user drag the marker on google map but i am not able to get it please help me to fix this. Please have a look on my code

Mapper::map(0, 0)->marker(53.381128999999990000, -1.470085000000040000, ['markers' => ['symbol' => 'circle', 'scale' => 1000, 'animation' => 'DROP'] , 'draggable' => true, 'eventDrag' => 'getMapData(maps)' ]);

and my callback function is :

`function getMapData(mapsData){ console.log(mapsData);

}`

Please have a look on my console screen-short : console2

farhanamandaa commented 6 years ago

Try to use 'eventDragEnd' instead of 'eventDrag'. Reference : #97

bradcornford commented 6 years ago

Hi there,

You nearly have it right, your just not accessing the markers object of the map:

Try the following:


console.log(mapsData[0].markers);

}```
Mohsing511 commented 5 years ago

Helper for Google map lat long use in marker[Here] 'eventDragEnd' =>"(document.getElementById('lat').value=(event.latLng.lat())); (document.getElementById('long').value=(event.latLng.lng()))"