我正在尝试使用 Biostall 的 Google Maps v3 API 来绘制一系列地址,但是当我尝试输入地址时,生成的 Lon Lat 每次都是 0、0。仅当我专门输入每个地址的经度和纬度时,它才有效。甚至 Biostall 在他的示例视频和文档中使用的条目也不起作用。我也在尝试使用 geocodeCaching 功能,请帮忙。
$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']);
标记输出:
数组 ( [marker_0] => 数组 ( [latitude] => 37.429 [longitude] => -122.1519 ) [marker_1] => 数组 ( [latitude] => 0 [longitude] => 0 ) ) 1
这是制作的地图:
BISTALL 的建议输出如下: 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®ion=US