I'm trying to create a map with the world continents (with a few modifications). As a source I use a sqlite file from Natural Earth. I already introduced my modification in the definition of the continents and now I would like to merge the countries of the same continent using the table "ne_110m_admin_0_countries" into a single shape and export the result to GeoJSON format.
I use the following command:
ogr2ogr -f GeoJSON -dialect sqlite -sql "select continent, st_union(geometry) as geom from ne_110m_admin_0_countries group by continent" continent.json natural_earch_vector.sqlite
I get no errors, but the result is a GeoJSON file containing:
{ "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {"continent": "Africa", "geom": null}, "geometry": null }, { "type": "Feature", "properties": {"continent": "Antarctica", "geom": null}, "geometry": null }, { "type": "Feature", "properties": {"continent": "Asia", "geom": null}, "geometry": null }, { "type": "Feature", "properties": {"continent": "Europe", "geom": null}, "geometry": null }, { "type": "Feature", "properties": {"continent": "North America", "geom": null}, "geometry": null }, { "type": "Feature", "properties": {"continent": "Oceania", "geom": null}, "geometry": null }, { "type": "Feature", "properties": {"continent": "Seven seas", "geom": null}, "geometry": null }, { "type": "Feature", "properties": {"continent": "South America", "geom": null}, "geometry": null }, ] }
Am I missing something? what is wrong in my command? Why I get the geom column inside the properties and I have an additional geometry feature?
It doesn't seem to work also if I use another output format instead of GeoJSON.