On 12 August 2010 18:51, Andrea Peri <[email protected]> wrote: > Hi, > > I needed to test a shapefile to find eventually wrong geometries. > > My first idea was to use postgis to do a > select *from table_from_shapefile where ST_IsValid(geom)=false; > > So I load the shapefile with shp2pgsql in postgis (1.5.1) > and do this query. > The results was 1 only geometry wrong. > > After some days I repeat the same test with Grass. > > Grass with my big surprise report me more geometry wrong. > Infact in the shapefile was detected many geometries with wrong orientation. > > Now my question is why this was not detected from postgis ? > I don't know why, > but my idea is that perhaps shp2pgsql, when find a geometry wrong oriented > correct it automatically . > > Is this correct ? > > Thx, >
Hi, Polygon orientation is not important with respect to OGC specifications and does not define an invalid polygon. That's why st_isvalid() returns true in Postgis. You can, however, force polygon orientation using the st_forceRHR() function (http://postgis.refractions.net/docs/ST_ForceRHR.html). Nicolas PS. the Jump software (http://www.vividsolutions.com/jump/) has a nice validation tool in which you can enable this constraint when validating a layer. With the postgis plugin, you can perform this validation directly on a postgis table. It graphically spots invalid geometries and also generate a new layer, with attributes telling the reason of invalidity. _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
