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:
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 allmighty
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 with
o5mfilter africa.o5m --keep="all boundary=administrative admin_level=2 =3 =4" >africa_boundaries.osm
Step 2: Conversion
.osm to geoJSON use one of the many converters at hand: