【问题标题】:Can I check if Google Maps embedded map (iframe) has a marker?我可以检查 Google Maps 嵌入式地图 (iframe) 是否有标记吗?
【发布时间】:2016-07-20 09:04:10
【问题描述】:

我一直在搜索这个主题,但我没有看到任何关于检查谷歌地图嵌入是否有标记的文章。我有来自数据库的数据,这些数据动态插入到嵌入地图的参数中。我问这个问题是因为嵌入地图中的一些数据只显示世界地图,而不是确切的位置,也没有标记。有什么方法可以检查它是否有标记?

【问题讨论】:

  • 我认为SO thread 可能会提供一些见解。

标签: google-maps ruby-on-rails-4


【解决方案1】:

您是否不需要使用 API 设置位置和标记并说例如数据小部件...

API 文档:google.Maps reference

我们有类似的东西;

// Map instance
state.map = new google.maps.Map(el, {
center: state.latLngObj,
zoom: state.zoom,
maxZoom: 18,
mapTypeControl: false,
panControl: false,
streetViewControl: false,
scrollwheel: !data.disableScroll,
draggable: mapDraggable,
zoomControl: true,
zoomControlOptions: {
  style: google.maps.ZoomControlStyle.SMALL
},
mapTypeId: state.style
});
state.marker.setMap(state.map);

【讨论】:

    猜你喜欢
    • 2010-11-13
    • 2011-08-31
    • 2011-09-07
    • 2020-02-21
    • 1970-01-01
    • 1970-01-01
    • 2017-10-10
    • 2011-08-17
    • 1970-01-01
    相关资源
    最近更新 更多