Codeigniter Google Maps API V3地理编码无法正常运作 [英] Codeigniter Google Maps API V3 Geocoding not working

查看:179
本文介绍了Codeigniter Google Maps API V3地理编码无法正常运作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Biostall的Google Maps v3 API来绘制一系列地址,但是当我尝试输入地址时,Lon Lat每次都会产生0,0。它只有工作,如果我具体放在每个地址的经度和纬度。即使Biostall在他的示例视频和文档上使用的条目也不起作用。我也想使用geocodeCaching功能,请帮忙。

  $ this-> load-> library谷歌地图'); 

$ config = array();
$ config ['zoom'] ='auto';
$ config ['geocodeCaching'] = TRUE;
$ config ['region'] ='US';
$ config ['sensor'] = FALSE;
$ this-> googlemaps-> initialize($ config);

$ marker = array();
$ marker ['position'] = '37 .429,-122.1519';
$ marker ['animation'] ='DROP';
$ this-> googlemaps-> add_marker($ marker);

$ marker = array();
$ marker ['position'] ='1600 Amphitheatre Parkway在Mountain View,圣克拉拉县,加利福尼亚州美国';
$ marker ['animation'] ='DROP';
$ this-> googlemaps-> add_marker($ marker);

$ data ['map'] = $ this-> googlemaps-> create_map();

echo print_r($ data ['map'] ['markers']);

标记输出:


阵列([marker_0] => Array([latitude] => 37.429 [longitude] => -122.1519)[marker_1] => Array [[latitude] => 0 [ ] => 0))1



=https://i.stack.imgur.com/Y8RcB.pngalt =地图制作>



BIOSTALL的建议输出:
Lat :0
Lng:0
错误:OVER_QUERY_LIMIT
data_location: http://maps.google.com/ maps / api / geocode / json?address = 1600 + Amphitheatre + Parkway + in + Mountain + View%2C + Santa + Clara + County%2C + California + United + States& sensor = false& region = US / p>

解决方案

感谢您使用我的图书馆。我有几个建议:



1)尝试将,美国添加到标记位置的末尾。



2)我相信有一个'region'参数可以在地图上设置。尝试将其设置为US。



3)如果仍然无法工作,请尝试进入库并找到get_lat_lon_from_address()函数,然后输出网址请求。



我希望有所帮助。我将看看添加一个调试模式很快,应该有助于这样的问题。如果有任何其他问题,请告诉我们:)



Steve


I'm trying to use Biostall's Google Maps v3 API to map out a series of addresses, but when I try to type in an address, the Lon Lat produced is 0, 0 every time. It only works if I specifically put in the longitude and latitude of each address. Even the entries which Biostall used on his example video and documentation don't work. I'm trying to also use the geocodeCaching feature, please help.

$this->load->library('googlemaps');

$config = array();
$config['zoom'] = 'auto';
$config['geocodeCaching'] = TRUE;
$config['region'] = 'US';
$config['sensor'] = FALSE;
$this->googlemaps->initialize($config);

$marker = array();
$marker['position'] = '37.429, -122.1519';
$marker['animation'] = 'DROP';
$this->googlemaps->add_marker($marker);

$marker = array();
$marker['position'] = '1600 Amphitheatre Parkway in Mountain View, Santa Clara County, California United States';
$marker['animation'] = 'DROP';
$this->googlemaps->add_marker($marker);

$data['map'] = $this->googlemaps->create_map();

echo print_r($data['map']['markers']);

The marker output:

Array ( [marker_0] => Array ( [latitude] => 37.429 [longitude] => -122.1519 ) [marker_1] => Array ( [latitude] => 0 [longitude] => 0 ) ) 1

This is the map produced:

BIOSTALL's suggestion outputted this: Lat: 0 Lng: 0 Err: OVER_QUERY_LIMIT data_location: http://maps.google.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway+in+Mountain+View%2C+Santa+Clara+County%2C+California+United+States&sensor=false&region=US

解决方案

Thanks for using my library. I have a couple of suggestions:

1) try adding ', United States' to the end of the marker position.

2) I believe there is a 'region' parameter you can set on the map. Try setting this to 'US'.

3) if it's still not working, try going into the library and find the get_lat_lon_from_address() function, then output the result of the URL request.

I hope that helps. I'm going to look at adding a debug mode soon which should help with issues like this. Let me know if any other questions though :)

Steve

这篇关于Codeigniter Google Maps API V3地理编码无法正常运作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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