javascript - How to retrieve latitude and logitude and show in map with marker notification -
i want show map based on state, city, area, latitude , longitude fetched database , shown in merker notification.
latitude " name="latitude"> longitude " name="longitude"> / cancel" ; ?>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var addssbygoogle='<?=$fetch['latitude']?>,<?=$fetch['longitude']?>'; var geocoder; var map; var infowindow = new google.maps.infowindow(); var marker; function initialize(address,xlocation,ylocation) { codelatlng(address,xlocation,ylocation) ; } function codelatlng(address,xlocation,ylocation) { var latlng = new google.maps.latlng(xlocation,ylocation); var myoptions = { center: latlng, maptypeid: 'roadmap' } geocoder = new google.maps.geocoder(); map = new google.maps.map(document.getelementbyid("map_canvas1"), myoptions); geocoder.geocode({'latlng': latlng}, function(results, status) { if (status == google.maps.geocoderstatus.ok) { if (results[0]) { if('1.366667'==xlocation && '103.8'==ylocation) { map.setzoom(9); } else { map.setzoom(12); } marker = new google.maps.marker({ position: latlng, map: map, title: address }); addssbygoogle = results[0].formatted_address; //infowindow.setcontent(results[0].formatted_address); infowindow.setcontent(address); infowindow.open(map, marker); } else { // alert("no results found"); } } else { // alert("geocoder failed due to: " + status); } }); } </script> <div id="map_canvas1" style="width:100%; height:300px;"></div> <script type="text/javascript"> initialize("latitude: <?=$fetch['latitude']?><br/> longitude: <?=$fetch['longitude']?>","<?=$fetch['latitude']?>","<?=$fetch['longitude']?>"); </script>
Comments
Post a Comment