我能检查一下中国或者没有给他的GPS数据吗?
如果用户留在中国,那么
STEP1。检查脱机功能中的lat/lon
如果是真的
为中国请求googleGeocoding API
像这样..。
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;}
是对的吗?
发布于 2016-06-07 00:02:49
通常一个国家的区域可以由类似于GeoJson的东西来定义。
一旦您有了要处理的定义区域,您就可以计算您收到的坐标是否在中国定义的区域内。
https://stackoverflow.com/questions/37668552
复制相似问题