[gdal-dev] Ogr2ogr, PostGIS and numeric field overflow with a shapefile

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Fri May 19 08:15:02 PDT 2017


Hi,

See this gis.stackexchange question https://gis.stackexchange.com/questions/240900/shp2pgsql-segmentation-fault.

I have confirmed that Europe_coastline.shp from this zip https://www.eea.europa.eu/data-and-maps/data/eea-coastline-for-analysis-1/gis-data/europe-coastline-shapefile/at_download/file can't be saved into PostGIS with ogr2ogr.  The error message is exactly this

ERROR 1: COPY statement failed. ERROR:  numeric field overflow
DETAIL:  A field with precision 19, scale 11 must round to an absolute value less than 10^8.
CONTEXT:  COPY coastline, line 1, column shape_leng: "275736334.13200003000"

The error seems to happen in PostGIS which creates a field for "shape_leng" as NUMERIC(19,11) and then insertion of value 275736334.13200003000 fails. If GDAL user gets this kind of (invalid?) shapefile, what can they do? I had a try with -oo ADJUST_TYPE=YES but with no luck. Opening the shapefile and saving a copy with OpenJUMP indeed works because OpenJUMP is changing the field definition from Shape_Leng: Real (19.11) into Shape_Leng: Real (33.16).

-Jukka Rahkonen-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170519/3a32e95b/attachment.html>


More information about the gdal-dev mailing list