can check china or not given lat, lon gps data?
if user stay in china
step1. check lat/lon in offline func
if true
request googlegeocoding api china
like this..
var chinagooglegeocoding="http://maps.google.cn/maps/api/geocode/json?language=en&latlng=" + pos.coords.latitude + "," + pos.coords.longitude + "&key=" + google_api_key;
else
var googlegeocoding="https://maps.googleapis.com/maps/api/geocode/json?language=en&latlng=" + pos.coords.latitude + "," + pos.coords.longitude + "&key=" + google_api_key;
could advising me?
i check http://maps.google.cn working fine other country..but want use user stay in china.
i think china's lat start 37, end 47 , lon start 123, end 110
so...
if((pos.coords.latitude>=37 && pos.coords.latitude<=47)&& (pos.coords.latitude>=110 && pos.coords.latitude<=123)) {
//china var chinagooglegeocoding="http://maps.google.cn/maps/api/geocode/json?language=en&latlng=" + pos.coords.latitude + "," + pos.coords.longitude + "&key=" + google_api_key; }else { var googlegeocoding="https://maps.googleapis.com/maps/api/geocode/json?language=en&latlng=" + pos.coords.latitude + "," + pos.coords.longitude + "&key=" + google_api_key; }
is right?
usually country region can defined geojson
once have defined region work with, can compute if coordinate have received inside defined region china.