【问题标题】:How to mark location in Google MAP [closed]如何在 Google MAP 中标记位置 [关闭]
【发布时间】:2012-11-05 13:50:04
【问题描述】:

我有地理位置。我正在尝试将此位置标记到 Google 地图中。请建议我最好的方法。我有我想在谷歌地图中使用的数组中的所有位置

        Array
        (
            [0] => 51.508742, -0.134583
        )
        Array
        (
            [0] => 38.410558, 17.314453
        )

【问题讨论】:

  • 在“Google Maps API”上做一个谷歌。
  • 工作对我来说是完美的......请投票给我,这样我就会起来!

标签: php google-maps google-maps-api-3


【解决方案1】:

https://developers.google.com/maps/documentation/javascript/overlays#Markers

//var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var myLatLng = new google.maps.LatLng(yourArrayName[0][0], yourArrayName[0][1]);
var mapOptions = {
    zoom: 4,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);

var marker = new google.maps.Marker({
    position: myLatlng,
    map: map,
    title:"Hello World!"
});

将您的数组设置为包含一个在不同元素中包含纬度和经度的数组可能会更容易,而不是您可能拥有的一个字符串。

【讨论】:

  • 找到了!!很好!
猜你喜欢
  • 1970-01-01
  • 2014-03-25
  • 2020-10-07
  • 1970-01-01
  • 2021-08-13
  • 2012-07-05
  • 2018-10-13
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多