[postgis-devel] Issue 51 in postgis: Enhancement to ST_Summary to include info about invalid geometries

codesite-noreply at google.com codesite-noreply at google.com
Thu Dec 4 12:28:14 PST 2008


Comment #8 on issue 51 by ke... at refractions.net: Enhancement to ST_Summary  
to include info about invalid geometries
http://code.google.com/p/postgis/issues/detail?id=51

I'm just getting around to testing this.  Good work Paul.  It does seem  
like a good
start in a collection of geometry cleanup functions.

For my use cases, however, it would need to be a set returning function  
that returns
all the locations where a geometry falls down ... as geometries.

ie.
select st_isvalidreason(
   'POLYGON (( 0 0, 0 4, 4 4, 4 0, 0 0 ),
             ( 3 5, 2 5, 2 6, 3 6, 3 5 ),
             ( 2 2, 2 3, 3 3, 5 2, 2 2 ))'::geometry);
      st_isvalidreason
---------------------------
  Self-intersection [4 2.5]
(1 row)

should also report a 'Hole lies outside shell [3 5]' ... but this is  
expected since
this function is not a set returning function.

We already have ST_Dump, ST_DumpRings, (and ST_DumpPoints on the  
wishlist).  It would
be really nice to add ST_DumpInValidReason that returns a 'setof  
geometry_dump'.  IE.
return all the self-intersection points/lines, all holes that are outside,  
etc.

-- Queries like this would then be possible.
SELECT feat_id, (ST_DumpInValidReason(the_geom)).geom
FROM myfeatures
WHERE NOT ST_IsValid(the_geom);

Martin says that this information is available in JTS, just not exposed  
yet, so it
would be some work to get it into PostGIS.  But, does this sound like a  
do-able thing
to add to the wishlist?  I know I've definitely needed something like this  
in the
past.  Is this overloading the is_valid concept too much?  I'm just  
thinking that
having an exhaustive set of cleaning functions would be a very useful thing  
to add to
PostGIS.

In the mean time, is it possible the prototype of this function change to  
something
that returns a geometry instead of a textual description?  Perhaps both ..  
a single
instance of
CREATE TYPE invalid_reason AS
    (description text,
     geom geometry);

-- Kevin

-- 
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings



More information about the postgis-devel mailing list