[postgis-devel] Call for 1.4.2 and 1.5.1 (Handling of Invalid Geometries)
Mark Cave-Ayland
mark.cave-ayland at siriusit.co.uk
Tue Feb 23 04:46:12 PST 2010
Martin Davis wrote:
> Well, so it's still invalid. So what? Bottom line is that someone
> handed in garbage claiming it was a LinearRing. They can't complain
> about being told that no, it's actually garbage.
>
> The idea is to allow more cases to enter the database in a graceful way,
> without requiring a huge effort to check for bad structure throughout
> the codebase. There's no promise to perform magic. There will always
> be geometries which are so badly munged that they can't be made valid no
> matter what.
Exactly. As I see the issue, removing the validation checks means that
it becomes impossible to know what was a coding mistake, and what was
incorrect data.
If someone could write code that accidentally generates POLYGON(0 0)
rather than POINT(0 0) then we should catch this. I can also see a
potential problem with auto-closing rings; if a coder accidentally
introduced an off-by-one error reading an array of points then we would
be masquerading the fact from the coder that none of the polygons in the
database would be what was intended because they were being closed
incorrectly.
It seems that strk has done a good job with his geometry cleaning
function. I would like to move forward as was discussed at last year's
Code Sprint, i.e. move the majority of functionality into liblwgeom.
With this in place, we could then alter shp2pgsql to add an extra
--force parameter (or similar) that would invoke ST_MakeValid() for
invalid geometries it found on import. This would give us the best of
both worlds: we ensure that anything new going into the database is
valid, whilst also allowing tidy up on import of structurally invalid
data with associated warnings to the user.
ATB,
Mark.
--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063
Sirius Labs: http://www.siriusit.co.uk/labs
More information about the postgis-devel
mailing list