Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#2120 closed defect (invalid)

shp2pgsql mishandles geometry column

Reported by: arencambre Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.2
Component: postgis Version: 2.0.x
Keywords: Cc: aren@…


Running shp2pgsql on the attached SHP produces the attached SQL file. The only switch I used was -s 3081.

The geometry column is mishandled for two reasons:

  • Type is varchar. Should be geometry.
  • Even if varchar was correct, it's making a varchar with length 255, which is far to small to contain some of the values for that column in the SQL INSERT commands.

This is happening with 2.0.1.

Attachments (2)

cities within Dallas (90.0 KB ) - added by arencambre 10 years ago.
cities.sql (244.1 KB ) - added by arencambre 10 years ago.

Download all attachments as: .zip

Change History (5)

by arencambre, 10 years ago

by arencambre, 10 years ago

Attachment: cities.sql added

comment:1 by arencambre, 10 years ago

Additionally, the AddGeometryColumn statement in the SQL says that the geometry column name is geom when in fact it is the_geom.

comment:2 by robe, 10 years ago

Resolution: invalid
Status: newclosed

There is nothing wrong here. The issue is with your data file.

If you look at the dbf file you've got, you'll see that it indeed does have a column called the_geom and it infact does have text that looks like the wkt output of a geometry.

The geometry data is always kept in the .shp file and never has a name. shp2pgsql when the -g is not spec ified defaults to calling it geom.

comment:3 by arencambre, 10 years ago

Sorry about that. You are correct.

Note: See TracTickets for help on using tickets.