google.loader.ClientLocation返回empress字符串的地址项目 [英] google.loader.ClientLocation returning emply strings for adress items

查看:107
本文介绍了google.loader.ClientLocation返回empress字符串的地址项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么Google API加载程序客户端地址位置为多年的工作国家返回空字符串?
对象在这里,但地址项目是空的。



API键后。

  google.load(maps,'3',{other_params:'sensor = true'}); 
google.setOnLoadCallback(function()
{
if(google.loader.ClientLocation)
{
google.loader.ClientLocation.address.city is
google.loader.ClientLocation.address.region is
google.loader.ClientLocation.address.country_code is
google.loader.ClientLocation.latitude is OK
google。 loader.ClientLocation.longitude is OK


解决方案

Google.load.C​​lientLocation 不再受到google team dev的支持, load.C​​lientLocation 只会返回非常不准确的经纬度并且没有更多的地址项​​目。



这非常糟糕,因为现在如果用户不接受使用HTML5返回地理位置信息,则需要使用IP位置来搜索国家和城市。 / p>

我认为Google是一家很棒的公司非常自负,许多网站需要将内容标识为城市,国家,语言为最低限度和 ClientLocation 函数是一种更简单的方法。现在要做到这一点,您需要调用导航器询问用户,获取经纬度,并使用外部呼叫到另一个服务来查看简单的国家代码!这不是为了简化我的应用程序。国家或城市的位置不像100米的GPS位置这是许多开发者的基本功能。干杯。



请参阅:


Why Google API Loader Client adress location is returning an empty string for a working country for years?. The object is here but adresses items are empty.

After API key.

google.load("maps",'3',{other_params:'sensor=true'});  
google.setOnLoadCallback(function()
{
    if (google.loader.ClientLocation)  
    {  
google.loader.ClientLocation.address.city is ""  
google.loader.ClientLocation.address.region is ""  
google.loader.ClientLocation.address.country_code is ""  
google.loader.ClientLocation.latitude is OK  
google.loader.ClientLocation.longitude is OK  

解决方案

Google.load.ClientLocation is no more supported by google team dev. The load.ClientLocation is only returning a very bad accurate latitude and longitude and no more addresses items.

This is very bad because now if user not accepting to return geolocation using HTML5, you need to use IPlocation to search a country and city.

I think that is very egoist from a great company like Google, many websites need to serve contents identifiing cities, countries, languages as a minimal and ClientLocation function it was a easier way. Now to make this, you need to call navigators ask to users, get the lat,lon and get use an external call to another service to see a simple country code!. It's not to simplify my applications. Country or city locations in not like GPS position at 100 m It's a basic fonction of many developers an users. Cheers.

See:

这篇关于google.loader.ClientLocation返回empress字符串的地址项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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