在 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
,this 是第一个在 'coverage' header 下明确说明瑞士没有覆盖范围的搜索结果。
我正在尝试使用地理编码器将街道地址解析为地理坐标。这似乎适用于世界各地,但不适用于街道地址。下面的例子只去到地方(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
,this 是第一个在 'coverage' header 下明确说明瑞士没有覆盖范围的搜索结果。