# Get and unzip the data # (inspired from https://github.com/mapbox/natural-earth-tm2/blob/master/util/setup_db.sh) wget -q -N http://naciscdn.org/naturalearth/packages/natural_earth_vector.sqlite.zip unzip -o -d natural_earth_vector natural_earth_vector.sqlite.zip # Then, insert data into PG using ogr2ogr: ogr2ogr \ -progress \ -f Postgresql \ -s_srs EPSG:4326 \ -t_srs EPSG:3857 \ -clipsrc -180 -85.05 180.1 85.05 \ PG:"host=localhost port=5432 dbname=mydb user=postgres password=****" \ -lco GEOMETRY_NAME=geometry \ -lco OVERWRITE=YES \ -lco DIM=2 \ -nlt GEOMETRY \ -overwrite \ "natural_earth_vector/packages/natural_earth_vector.sqlite"
The PostgreSQL/PostGIS database I'm trying to inject this data into is based on
postgis/postgis:11-3.1 docker image.
This is the error I have:
0ERROR 1: TopologyException: Input geom 0 is invalid: Ring Self-intersection at or near point 30.796820538582722 61.704133379158407 at 30.796820538582722 61.704133379158407
This seems to be the culprit watershed in that particular case.
But this error actually appears more than 1'000 thousands times on other geometries .
I'm not sure where to search for a fix. Any ideas?
If this helps, here is the GDAL version number from inside the container:
# ogr2ogr --version GDAL 3.2.1, released 2020/12/29
This thread sounds related but it's from R: Getting TopologyException: Input geom 1 is invalid which is due to self-intersection in R? and I don't know, if it's the same error, how could I transpose the solution here.