Snažím sa znečistiť ruky v aplikácii API služby Google Maps v3, ale teraz som sa zotrvávala v zisťovaní, ako získať súradnice určitej značky?
<script>
var homeLatlng = new google.maps.LatLng(16.61096000671, 120.31346130371);
var homeMarker = new google.maps.Marker({
position: homeLatlng,
map: map
});
var myOptions = {
center: new google.maps.LatLng(16.61096000671, 120.31346130371),
zoom: 10,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map =
new google.maps.Map(document.getElementById("map_canvas"), myOptions);
//I know that I"m the one who set the coordinates for this,
// but how do I fetch it back?
$("#plot").click(function(){
homeMarker.setMap(map);
});
</script>
odpovede:
4 pre odpoveď č. 1homeMarker.getPosition(); //returns a google.maps.LatLng object