【问题标题】:Google Maps API - Get Results from ALL matching locationsGoogle Maps API - 从所有匹配的位置获取结果
【发布时间】:2013-12-30 04:20:22
【问题描述】:

目前,我们的系统从指定位置的某个区域带回列表。因此,如果我输入邮政编码,它将使用边界并带回本地列表。这很好用。

但是,如果我搜索“Newcastle”,它将默认为 Newcastle Tyneside 而不是 Lyme 下的 Newcastle。

有没有办法告诉地图 API 不使用它认为是“默认”的任何东西并从所有位置带回列表?

以下是我用来对地址进行地理编码的基本脚本:

var address = "<?php echo $_GET['place']." UK";?>";
///set map center position and place marker
geocoder.geocode( { 'address': address}, function(results, status) {
///set center position
map.setCenter(results[0].geometry.location);
circ = new google.maps.Circle();
circ.setCenter(results[0].geometry.location);
circ.setRadius(miles * 1609.0);
map.fitBounds(circ.getBounds());
circ.setMap(map);

// Set co-ordinates of address
var addresslong = results[0].geometry.location.lat();
var addresslat = results[0].geometry.location.lng();
var addresslatlng = new google.maps.LatLng(addresslong, addresslat);        
placeMarkers(addresslatlng);

任何帮助或建议将不胜感激。

【问题讨论】:

    标签: google-maps


    【解决方案1】:

    是的,结果对象带回了多个位置。遍历结果中的所有对象。

    【讨论】:

    • 我想我明白你的意思了——我去看看
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多