首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我如何离线检查中国或没有给拉特,隆的数据。

我如何离线检查中国或没有给拉特,隆的数据。
EN

Stack Overflow用户
提问于 2016-06-06 23:59:04
回答 1查看 106关注 0票数 0

我能检查一下中国或者没有给他的GPS数据吗?

如果用户留在中国,那么

STEP1。检查脱机功能中的lat/lon

如果是真的

为中国请求googleGeocoding API

像这样..。

代码语言:javascript
复制
var chinaGoogleGeocoding="http://maps.google.cn/maps/api/geocode/json?language=en&latlng=" + pos.coords.latitude + "," + pos.coords.longitude + "&key=" + Google_API_Key;

否则

变量googleGeocoding=“https://maps.googleapis.com/maps/api/geocode/json?language=en&latlng=”+ pos.coords.latitude +,“+ pos.coords.longitude +”&key=+ Google_API_Key;

你能给我个建议吗?

我检查http://maps.google.cn运行良好,其他的country..but,我只想使用它,用户停留在中国。

http://www.latlong.net

我认为中国的首发是37场,47场和123场,110场。

所以..。

if(pos.coords.latitude>=37 && pos.coords.latitude<=47)& (pos.coords.latitude>=110 && pos.coords.latitude<=123){

//中国var chinaGoogleGeocoding=“http://maps.google.cn/maps/api/geocode/json?language=en&latlng=”+ pos.coords.latitude +,“+ pos.coords.longitude +”&key=+ Google_API_Key;}{ var googleGeocoding="https://maps.googleapis.com/maps/api/geocode/json?language=en&latlng=“+ pos.coords.latitude +,”+ pos.coords.longitude +“&key=+ Google_API_Key;}

是对的吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-06-07 00:02:49

通常一个国家的区域可以由类似于GeoJson的东西来定义。

一旦您有了要处理的定义区域,您就可以计算您收到的坐标是否在中国定义的区域内。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37668552

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档