nils
nils

Reputation: 27214

Find Street Address in Mapbox

I'm trying to resolve street addresses to geographic coordinates using the geocoder. That seems to work fine for places around the world, but not so much for street addresses. The following example only goes to the place (Bern) but doesn't seem to resolve the exact address (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/)

Am I missing something? Or am I using the wrong api?

Upvotes: 0

Views: 1441

Answers (1)

iH8
iH8

Reputation: 28678

If one googles mapbox geocoding, this is the first hit which clearly states under the 'coverage' header that Switzerland has no coverage.

Upvotes: 1

Related Questions