I ran the following against all 4 of my GeoJSON files:
SELECT ST_IsSimple(ST_GeomFromGeoJSON('@poly'))SELECT 
ST_IsValid(ST_GeomFromGeoJSON('@poly'))SELECT 
ST_IsValidDetail(ST_GeomFromGeoJSON('@poly'))SELECT 
ST_IsValidReason(ST_GeomFromGeoJSON('@poly'))
where @poly contained each one of the following:
http://microflush.org/stuff/json/MN.jsonhttp://microflush.org/stuff/json/mnz091.json
http://microflush.org/stuff/json/CA.jsonhttp://microflush.org/stuff/json/nwsZone.json

The select returned no error.  I tried to vary the input slightly to make sure 
I was using the proper syntax, and was able to get errors-- such as:
DBD::Pg::st execute failed: ERROR:  geometry contains non-closed rings

So, it would seem my geoms are ok.
I've not yet tried the "ST_MakeValid".   But wouldn't the above indicate 
they're already valid?
Thanks!





      From: Joseph Spenner <[email protected]>
 To: PostGIS Users Discussion <[email protected]> 
 Sent: Thursday, February 26, 2015 8:05 AM
 Subject: Re: [postgis-users] TopologyException: geom is invalid
   
Hello, and thanks for the replies!I'll try those suggestions.
Just curiuos though-- which geometry seems to be invalid?  Is it the state 
poly, or the smaller county/zone poly?  If there was an invalid geometry, 
wouldn't it always show up for that state or county?  Here's what I observed 
for the CA issue:
1) I had 3 smaller county poly/geometries in CA.  When performing my query, 
instead of returning the 3 polys, I received the error which I posted in my 
original thread.  I identified it was 1 of those 3.  I deleted that 1 offending 
geometry from my table.  After doing so, my query against CA turned up the 
remaining 2, with no errors.  So, that leads me to believe CA is ok.  Or is 
this not a valid assumption?   Perhaps the location where that offending 
intersection would have occurred in the CA poly has an issue, and it doesn't 
get tickled unless the smaller county zone intersects it?
2) I was able to plot the offending county described above in the GeoJSONLint 
validation page:   http://geojsonlint.com/  There didn't appear to be any 
issues.
Thanks!
Regards,Joseph Spenner



  


 

     From: Rémi Cura <[email protected]>
 To: PostGIS Users Discussion <[email protected]> 
Cc: Joseph Spenner <[email protected]> 
 Sent: Thursday, February 26, 2015 1:28 AM
 Subject: Re: [postgis-users] TopologyException: geom is invalid
   
And also ST_IsSimple (that precisely check for self intersection).
Cheers,
Rémi-C

2015-02-26 8:32 GMT+01:00 BladeOfLight16 <[email protected]>:



On Wed, Feb 25, 2015 at 12:14 PM, Joseph Spenner <[email protected]> wrote:

DBD::Pg::st execute failed: ERROR:  Error performing intersection: 
TopologyException: Input geom 1 is invalid: Self-intersection at or near point 
-381688.06935935974 -1206669.4272876547 at -381688.06935935974 
-1206669.4272876547 at ./test.pl line 151.


Did you try ST_IsValid to verify the geometry is valid according to the OGC 
standard? (See 
http://postgis.net/docs/using_postgis_dbmanagement.html#OGC_Validity. 
ST_IsValidDetail and ST_IsValidReason are also helpful in this regard.) What 
happens if you run it through ST_MakeValid? Be aware that ST_MakeValid can 
sometimes result in GeometryCollections if the input shape is malformed 
(usually "rings" without enough points are that have different start and end 
points).

_______________________________________________
postgis-users mailing list
[email protected]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users




   

  
_______________________________________________
postgis-users mailing list
[email protected]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

Reply via email to