I've got the coastline of Canada from OSM. For my work I only need the main landmass without any islands. Despite I was able to manually delete all the islands in JOSM / QGIS I need an automatic solution.
How to remove all polygons except the main one from a GeoJSON (or Shapefile) in commandline?
Even this simply doesn't work
ogr2ogr -f GeoJSON -dialect SQLITE -sql "SELECT * FROM Canada_1428125_AL2 order by ST_AREA(geometry) desc limit 1" out.geojson Canada_1428125_AL2.shp
because the multipolygon contains all islands. Is there any splitter function?