GPS 座標轉 google map

<!DOCTYPE html>
<html>
<head>
<metaname="viewport"content="initial-scale=1.0, user-scalable=no"/>
<style type="text/css">
  html { height: 100% }
  body { height: 100%; margin: 0px; padding: 0px }
  #map_canvas { height: 100% }
</style>
<scripttype="text/javascript"
    src="https://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
  function initialize() {
    // N25 04.1472 E121 36.7195
    var latlng = new google.maps.LatLng(25+(4.1472/60), 121+(36.7195/60));
    var myOptions = {
      zoom: 16,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP,
    };
  var map = new google.maps.Map(document.getElementById("map_canvas"),
        myOptions);
    var marker = new google.maps.Marker({
      position: latlng, 
      map: map, 
      title:"Hello World!"
  });   
  }

</script>
</head>
<bodyonload="initialize()">
  <divid="map_canvas"style="width:100%;height:100%"></div>
</body>
</html>
文章標籤
全站熱搜
創作者介紹
創作者 Person 的頭像
Person

Person

Person 發表在 痞客邦 留言(0) 人氣(22)