Remove outlying territories/islands from Europe map

I'd bring it into QGIS and use Vector > Geometry > Multipart to Singlepart.

In Natural Earth, France is a multipolygon so it is one feature with lots of individual polygons (France, French Guiana, Reunion etc).

Doing this breaks each of these polygons into its own feature - so your shapefile jumps in size from ~250 (roughly one feature per 'country') to several thousand features.

Then select the ones you want with the select tool, dragging your selection over the region of Europe you want, and save as a new shapefile (making sure you check "save selected features only")

You should now be able to plug in the new shapefile into your first line of code and it should work.


If you want to keep it all command line, you could use ogr2ogr's clipsrc option to clip your shapefile to a bounding box before sending it through the d3-geo tools.

I ran:

ogr2ogr -f "ESRI Shapefile" -clipsrc -25 34 35 73 europe-clipped.shp ne_50m_admin_0_countries.shp

The values for -clipsrc were sussed out using projectionwizard.org. Then used your commands to get: Europe clipped

europe-clipped.svg as a gist.

Tags:

D3