【问题标题】:How to get the current country of the view area?如何获取视图区域的当前国家?
【发布时间】:2013-04-17 16:20:59
【问题描述】:

以下部分代码向我提供了我的标记(不可拖动)设置的国家...

for (var i = 0; i < results[0].address_components.length; i++) {
  if (results[0].address_components[i].types[0] == "country") {
     clientPositionMarkerCountry = results[0].address_components[i].long_name;
  }
}

当用户移动到另一个国家(例如,在这个国家或任何其他国家旁边)时,我想获取他所在的视图区域的当前国家(或者可能是当前国家)。

【问题讨论】:

  • 如果有人需要更多信息,请询问

标签: javascript jquery google-maps country


【解决方案1】:

你在寻找这样的东西吗:

http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmltest_linktoB.html?lat=43.797409&lng=27.904508&zoom=6&type=m&filename=http://www.geocodezip.com/geoxml3_test/world_countries_kml.xml

使用 geoxml3 呈现 KML 文件。检测视口中可见的国家多边形并将其显示在侧边栏中。

【讨论】:

  • 是的,这与我正在寻找的解决方案非常相似......谢谢;)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-15
  • 1970-01-01
  • 2013-10-19
  • 2020-04-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多