I am currently using Google API to point the position on Google map.
this is google-maps-utility-library-v3
with the link
http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference.html
I wrote this code
<script type="text/javascript">
function initialize() {
var secheltLoc = new google.maps.LatLng(49.47216, -123.76307);
var myMapOptions = {
zoom: 15
,center: secheltLoc
,mapTypeId: google.maps.MapTypeId.ROADMAP
};
var theMap = new google.maps.Map(document.getElementById("map_canvas"), myMapOptions);
var marker = new google.maps.Marker({
map: theMap,
draggable: true,
position: new google.maps.LatLng(49.47216, -123.76307),
visible: true
});
}
function getLatLong(){
var secheltLoc = new google.maps.LatLng(49.47216, -123.76307);
var myMapOptions = {
zoom: 15
,center: secheltLoc
,mapTypeId: google.maps.MapTypeId.ROADMAP
};
var theMap = new google.maps.Map(document.getElementById("map_canvas"), myMapOptions);
var marker = new google.maps.Marker({
map: theMap,
draggable: true,
position: new google.maps.LatLng(49.47216, -123.76307),
visible: true
});
infoBox = new InfoBox({latlng: marker.getPosition()});
<!-- var getLat = new InfoBox(); -->
alert(InfoBox.prototype.getPosition);
}
</script>
<body onload="initialize()">
<div id="map_canvas" style="width:100%; height:50%"></div>
<input type="button" onclick="getLatLong();" />
<div id="letLong"></div>
What I want is when I click this getLatLong() function I must get currently positioned markers latitude longitude.
Please Help,
Thanks
Try this code:
I hope this help you.