For one of my projects, I was looking for a simple way to implement Google Maps with jQuery.
I was lucky to find a really nice plugin goMap.
It does a lot of things, which might be useful in Google maps API v3 implementation. Here you can see the examples with descriptions.
In my work, I have a functionality, which allows to drag-n-drop icon to new location and save this point in DB. For that purposes, I need to get latitude and longitude of new point.
I haven’t found any solution with standard functions. For the purpose, I added new function to jquery.gomap-1.2.2.js file:
getBound: function(marker) { return $(this.mapId).data(marker).position; },
marker in this case – marker’s id.
The code for implementation looks as following:
$.goMap.createListener({type:'marker', marker:'admin_marker'}, 'dragend', function() { $.goMap.setInfo('admin_marker', 'Latitude,Longitude:
'+$.goMap.getBound('admin_marker').toString()); });
Here is a working prototype.