[postgis-users] Spaces in numeric fields output by shp2pgsql

Brian Panulla bpanulla at gmail.com
Sun Feb 19 13:51:57 PST 2023


I'm trying to load some shapefiles to a PostgreSQL 12/PostGIS 3.1
database server. The shapefiles in question have a point geometry
field as well as the latitude and longitude as numeric values in the
metadata. When I try to pipe the output of shp2pgsql to psql I get
invalid input errors relating to the longitude and latitude metadata
fields:

16651: ERROR:  invalid input syntax for type numeric: "-117.830583 00000000"
CONTEXT:  COPY _41001_point_temp, line 1, column longitude:
"-117.830583 00000000"

Capturing the output from shp2pgsql, it seems that the longitude and
latitude values have a space in the middle:

 -117.830583 00000000

But shp2pgsql seems to see the field as a type FTDouble:

Field longitude is an FTDouble with width 31 and precision 15
Field latitude is an FTDouble with width 31 and precision 15

When I view the shapefile metadata in QGis it doesn't have a space,
but it does have an extra digit!

-117.830583000000004

I've tried both shp2pgsql 3.0 and 3.2 just to make sure it wasn't a
bug in 3.0, but the output is the same.

Any idea what I'm looking at here?

-B


More information about the postgis-users mailing list