繁体   English   中英

在Mapbox中查找街道地址

[英]Find Street Address in Mapbox

我正在尝试使用地址解析器将街道地址解析为地理坐标。 这似乎可以在世界各地使用,但对于街道地址则没有那么大的作用。 以下示例仅转到该地点( Bern ),但似乎无法解析确切的地址( Kramgasse 42 ):

var geocoder = L.mapbox.geocoder('mapbox.places'),
    map = L.mapbox.map('map', 'examples.map-h67hf2ic');

geocoder.query('Kramgasse 42, Bern, Switzerland', showMap);

function showMap(err, data) {
    // The geocoder can return an area, like a city, or a
    // point, like an address. Here we handle both cases,
    // by fitting the map bounds to an area or zooming to a point.
    if (data.lbounds) {
        map.fitBounds(data.lbounds);
    } else if (data.latlng) {
        map.setView([data.latlng[0], data.latlng[1]], 13);
    }
}

(API: https : //www.mapbox.com/developers/api/geocoding/

我想念什么吗? 还是我使用了错误的API?

如果是一个mapbox geocoding ,则是第一个mapbox geocoding ,它在“ coverage”标题下明确指出瑞士没有覆盖范围。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM