3

I've been digging around today in Google Maps and Leaflet API's to find if there is an easy way to get these boundaries instead of needing our users to manually outline these things (like drawing polygons on the map)?

0

4 Answers 4

1

You can export data for several boundaries from the main OSM database. Administrative boundaries are complete in OSM for admin_level=2 that are for whole countries, and they are very up-to-date.

The deper you go in admin_level there are countries that have 100% coverage for each place region, other countries still have some gaps. When using data from OSM, pay attention to ist free licence ODbL.

Howto do that, search for "[openstreetmap] export boundaries" on this site, or search for "export boundaries" on http://help.osm.org

There you will find services how to get boundaries in different file formats. and you can display them via any framework like leafletjs, openlayers or any other.

1

Baed on the Openstreetmap database, there is a service https://osm.wno-edv-service.de/boundaries/ which lets you select and download boundary data in various formats. Just expand the nodes on the left panel of the countries you want.

If this is too slow for you, take the data from http://www.gadm.org/country or http://www.naturalearthdata.com/downloads/.

1
0

Yes, OSM provides boundaries if you pass the parameter polygon_geojson = 1, I use MapQuest webservice which is a mirror of OSM:

var mapquest_search = 'http://open.mapquestapi.com/nominatim/v1/search.php';
var params_mapquest_search = {
    params : {
        polygon_geojson : 1,
        'accept-language' : 'pt-BR',
        addressdetails : 0,
        format : 'json'
    }
};

Another option is to use MapIt webservice. Here's a fiddle - http://jsfiddle.net/jonataswalker/zqfk9t2x/. Click on map to get state boundaries.

I'm using Openlayers but can be easily port to other library.

0

Mapzen provides boundary data for all admin levels extracted from OpenStreetMap data as GeoJSON, divided by country as part of their Borders project. The data is available for download at https://mapzen.com/data/borders/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.