Administrative level GeoJSON Polygons for African Countries

Administrative level GeoJSON Polygons for African Countries

I'm very new to GIS and I have spent the last few days trying to find some kind of database with the aforementioned polygons with no luck. The purpose is simply to label a location at district level given its longitude and latitude. I tried reverse geocoding but very quickly exceeded my rate-limit because of the size of the data. I've also tried GADM but the data is not labeled and there seemed to be more polygons than districts. MongoDB works nicely with GeoJSON hence my preference for data in this format. What options do I have?

A really nice source for admin boundaries all over the world, at different scales with very nice cartographic quality, is found at Natural Earth.

If you are downloading shapefiles, there are several options for converting from a shapefile:

1), to which you upload your shapefile and save as geoJson 2) This converter, same idea without the map to check your data.

You can extract the administrative boundaries from the OSM data. There are multiple ways to do this (source).

Step 1: Extraction

Option 1: Use the allmightyosmosis:

osmosis --read-pbf source.osm.pbf --tf accept-relations boundary=administrative --used-way --used-node --wx relation-boundaries.osm

Option 2: Use osmfilter:

osmconvert source.osm.pbf --out-o5m >africa.o5m o5mfilter africa.o5m --keep="boundary=administrative" >africa_boundaries.osm

To keep specific administrative levels only specify withadmin_level=:

o5mfilter africa.o5m --keep="all boundary=administrative admin_level=2 =3 =4" >africa_boundaries.osm

Step 2: Conversion

To convert.osmto geoJSON use one of the many converters at hand:

Check this site - (there are available import to geojson) or this -