Opened 9 years ago

Closed 9 years ago

#859 closed enhancement (worksforme)

shp2pgsql new option to do something with bad geometries.

Reported by: jadams Owned by: pramsey
Priority: low Milestone: PostGIS 2.0.0
Component: loader/dumper Version: 1.5.X
Keywords: Cc:


Ticket 110 included a discussion of what to do with invalid geometries on load. I'm splitting that out into its own ticket, since it wasn't directly related to 110 (which was about transactions). Here are the most relavent excerpts:

by robe: "...also have the option to NULL the geometry. I think others have asked for the ability to NULL.

Its a reality we get bad data and the last set I had to deal with was intentionally bad. They had used the same malformed geometry to represent the absense of a geometry -- presumably to satisfy ESRI shapefile that requires a geometry for all records.

After trying to salvage these things -- closing them and so forth -- to my shock they were all the same malformed creatures."

by bobdebm: "I was just wondering if there could be an option in shp2pgsql that puts all of the 'not isvalid(the_geom)' geometries in a same named table with a '_err' suffix?"

by robe: "I like Bob's idea of throwing in an error table or giving the option to do so though as you said we can't do a true st_isvalid check.

I think the fact there is no GEOS binding is fine. The main issue to me is that these are just thrown out and are therefore hard to repair since its easier to repair things in the db - if we could even throw just the WKT in the table that would be better than nothing."

Change History (3)

comment:1 Changed 9 years ago by jadams

It would be helpful for testing if someone who has a shapefile with a geometry that fails could attach it to this ticket. Preferably a fairly small shapefile, that has at least a few good records as well as one or a few bad ones.

comment:2 Changed 9 years ago by strk

Component: postgisloader/dumper

comment:3 Changed 9 years ago by strk

Resolution: worksforme
Status: newclosed

I think what we should _do_ with bad geometries is: load them. As of PostGIS 2.0 the IsValid? function can deal with any kind of geometry, no matter how bad it is. This means you can implement your custom handling within the database.

For this reason, I'm closing this bug as "works for me". Feel free to reopen if you really think the loader should be doing more than "loading"...

Note: See TracTickets for help on using tickets.