1
votes

I'm trying to find a way to center and zoom to a country using Mapbox. I am able to get a country its coordinates using the geocoder, however, the zoom levels differ per country. (E.g. the zoom level for Spain is not the same level for the U.S.A.)


function showMap(err, data) {

        console.log(data);
        console.log(err);

        if (err == true) {
            console.log("Couldn't find this place!");
        } else {
            map.fitBounds(data.lbounds);        
        }   

}   


var geocoder = L.mapbox.geocoder('x',map);

geocoder.query("Spain", showMap);

Would I need an additional layer with fusion tables to achieve this?

Thanks for any help!

1
How did you solve it?mik

1 Answers

0
votes

Can you be much more specific with this question, and provide an example, preferably something you can link to, with full code?

I am able to get a country its coordinates using the geocoder, however, the zoom levels differ per country.

The usage of 'however' is confusing: large countries will have different zoom levels than small. Is this what you see happening? Or not? Is this something you desire, or not?