[postgis-users] IsSimple doesn't work correctly?

Paul Ramsey pramsey at refractions.net
Mon Apr 5 09:30:29 PDT 2004


And, for point #2, the handy isValid(geometry) function is what you need.

SELECT id FROM test WHERE NOT isValid(poly);

Martin Davis wrote:

> Two points:
> 
> 1) The definition of "simple" used by JTS, GEOS and PostGIS is taken
> from the OGC Simple Features for SQL specification.  It states that
> Polygons are always simple geometries (sec. 2.1.10).
> 
> 2) In any case, at least two (#10 & 12) of your geometries are not
> valid polygons (#10 self-intersects, and #12 contains a hole which
> self-intersects).  JTS/GEOS functions are not guaranteed to return
> correct results for invalid geometries.  You should ensure all your
> geometries are valid before using analytic functions.
> 
> Martin Davis, Senior Technical Architect Vivid Solutions Inc. Suite
> #1A-2328 Government Street Victoria, B.C. V8T 5G5 Phone: (250) 385
> 6040 - Local 308 Fax: (250) 385 6046
> 
> 
> 
>> -----Original Message----- From: Michael Schiller
>> [mailto:MichaelAntonSchiller at gmx.de] Sent: April 5, 2004 3:41 AM 
>> To: postgis user list Subject: [postgis-users] IsSimple doesn't
>> work correctly?
>> 
>> 
>> Hello,
>> 
>> I am using Postgis 0.8.1 with PostgreSQL 7.4.1 and GEOS 1.0.0
>> 
>> I  tried the method IsSimple  and I think that it doesn't work
>> correctly.
>> 
>> select id, issimple(poly), poly from test; id | issimple |
>> 
>> 
>> 
>> 
>> poly
>> 
>> ----+----------+---------------------------------------------- 
>> ---------- 
>> ----+----------+---------------------------------------------- 
>> -------------------------------------------------------------- 
>> -------------------------------------------------------------- 
>> ----------------------------------------------------- 1 | t
>> | SRID=-1;MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0))) 2 | t        |
>> SRID=-1;MULTIPOLYGON(((0 5,0 10,5 10,5 5,0 5))) 3 | t        |
>> SRID=-1;MULTIPOLYGON(((5 0,5 5,10 5,10 0,5 0))) 4 | t        |
>> SRID=-1;MULTIPOLYGON(((5 5,5 10,10 10,10 5,5 5))) 5 | t        |
>> SRID=-1;MULTIPOLYGON(((0 10,0 15,5 15,5 10,0 10))) 6 | t        |
>> SRID=-1;MULTIPOLYGON(((10 0,10 5,15 5,15 0,10 0))) 10 | t        |
>> SRID=-1;MULTIPOLYGON(((50 50,50 55,56 55,56 50,53 50,55 52,53 54,51
>> 52,53 50,50 50))) 11 | t        | SRID=-1;MULTIPOLYGON(((60 60,60
>> 65,66 65,66 60,60 60),(63 60,61 62,63 64,65 62,63 60))) 12 | t
>> | SRID=-1;MULTIPOLYGON(((70 70,70 76,74 76,74 70,70 70),(72 71,72
>> 75,73 75,71 73,73 71,72 71))) 13 | t        |
>> SRID=-1;MULTIPOLYGON(((80 80,80 86,84 86,84 80,80 80),(82 81,82
>> 82,83 81,82 81),(82 82,81 83,82 84,82 82),(82 84,82 85,83 85,82
>> 84))) 14 | t        | SRID=-1;MULTIPOLYGON(((90 90,90 96,94 96,94 
>> 90,90 90),(92 92,91 93,92 94,92 92))) 15 | t        |
>> SRID=-1;MULTIPOLYGON(((100 100,100 105,105 105,105 100,100 
>> 100),(101 101,101 102,102 102,102 101,101 101),(103 103,103 104,104
>> 104,104 103,103 103)),((110 110,110 115,115 115,115 110,110
>> 110),(111 111,111 112,112 112,112 111,111 111),(113 113,113 114,114
>> 114,114 113,113 113))) 16 | t        | SRID=-1;MULTIPOLYGON(((121
>> 120,121 124,123 124,120 122,123 120,121 120))) 17 | t        |
>> SRID=-1;MULTIPOLYGON(((130 130,132 132,130 132,132 130,130 130))) 
>> 18 | t        | SRID=-1;MULTIPOLYGON(((140 141,140 144,143 144,143
>> 141,140 141),(142 140,141 142,142 143,142 140))) 19 | t        |
>> SRID=-1;MULTIPOLYGON(((150 150,150 154,156 154,156 150,150 
>> 150),(153 150,151 152,153 154,155 152,153 150))) 20 | t        |
>> SRID=-1;MULTIPOLYGON(((160 160,160 164,163 164,161 162,163 160,160
>> 160)),((163 160,165 162,163 164,166 164,166 160,163 160))) (17
>> rows)
>> 
>> There are some Polygons in this Example that are not simple (id =
>> 10, id = 12, id = 16, id = 17, id = 18, id = 19). The Method
>> IsSimple answers only with true.
>> 
>> Where is the error?
>> 
>> thanks, Mich
>> 
>> -- +++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter 
>> Virenschutz +++ +++ 100% Virenerkennung nach Wildlist. Infos: 
>> http://www.gmx.net/virenschutz
>> 
>> 
>> _______________________________________________ postgis-users
>> mailing list postgis-users at postgis.refractions.net 
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>> 
> 
> _______________________________________________ postgis-users mailing
> list postgis-users at postgis.refractions.net 
> http://postgis.refractions.net/mailman/listinfo/postgis-users


-- 
       __
      /
      | Paul Ramsey
      | Refractions Research
      | Email: pramsey at refractions.net
      | Phone: (250) 885-0632
      \_




More information about the postgis-users mailing list