如何获取视图区域的当前国家/地区? [英] How to get the current country of the view area?

查看:119
本文介绍了如何获取视图区域的当前国家/地区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的部分代码为我提供了设置标记(不可拖动)的国家/地区…

Following part of code delivers me the country where my marker (not draggable) is set …

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;
  }
}

当用户移动到另一个国家(例如,邻近该国家或任何其他国家)时,我想获取他所在的视域的当前国家(或者可能的话,可能是当前国家).

When the user moves over an other country (e.g. next to this country or any other) I want to get the current country (or maybe if possible current countries) of the viewarea he is then.

推荐答案

您是否正在寻找类似的东西:

Are you looking for something like this:

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

Uses geoxml3 to render a KML file. Detects the country polygons that are visible in the viewport and displays them in the sidebar.

这篇关于如何获取视图区域的当前国家/地区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆