【问题标题】:How do I add a specific adress to be displayed on my map, using the google API?如何使用 google API 添加要在我的地图上显示的特定地址?
【发布时间】:2017-03-10 18:56:49
【问题描述】:

如何使用来自 google 的 API 添加要在地图上显示的地址。 是否使用嵌入选项?

 <script>
      function myMap(){

        var mapCanvas = document.getElementById("map");
        var mapOptions = {
          center: new google.maps.LatLng(51.5, -0.2), zoom:15
        };
        var map = new google.maps.Map(mapCanvas, mapOptions);
      }
 </script>

 <script src="https://maps.googleapis.com/maps/api/js?key=my_key">
 </script>

【问题讨论】:

标签: javascript html google-maps dictionary google-api


【解决方案1】:

这是你想要的吗?

 <script>   
function initialize() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 12,
center: { lat: yourLAT, lng: yourLNG }
});
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initialize"async defer></script>                                                                                   

     <body> 
     <div id="map"></div>
     </body>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-30
    • 1970-01-01
    • 1970-01-01
    • 2023-03-29
    • 1970-01-01
    相关资源
    最近更新 更多