I followed Mike Bostock's 'Let's Make a Map' tutorial to make a GeoJSON map of the EU starting from a 1:10M cultural admin0 shapefile from Natural Earth. The problem that I'm facing if that some of the countries are split into multiple features, i.e.:

{ "type": "Feature", "properties": { "SOVEREIGNT": "Italy", "ADMIN": "Italy", "ADM0_A3": "ITA", "SUBUNIT": "Sardinia" }, { "type": "Feature", "properties": { "SOVEREIGNT": "Italy", "ADMIN": "Italy", "ADM0_A3": "ITA", "SUBUNIT": "Isole Pelagie" }, { "type": "Feature", "properties": { "SOVEREIGNT": "Italy", "ADMIN": "Italy", "ADM0_A3": "ITA", "SUBUNIT": "Pantelleria" }, { "type": "Feature", "properties": { "SOVEREIGNT": "Italy", "ADMIN": "Italy", "ADM0_A3": "ITA", "SUBUNIT": "Italy" }, { "type": "Feature", "properties": { "SOVEREIGNT": "Italy", "ADMIN": "Italy", "ADM0_A3": "ITA", "SUBUNIT": "Sicily" }

N.B. I stripped most properties from the above the example.

The command I used to generate the GeoJSON looked something like:

ogr2ogr -f GeoJSON -where "ADM0_A3 IN ('PRT', 'ESP', 'ITA', ...)" myMap.json ne_10m_admin_0_map_subunits.shp

My question is:

Is there a way that I can have all the feature geometries that have a common ADMIN/SOVEREIGNT merged so that the GeoJSON output will only contain a single entry per country?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.