[postgis-users] shp2pgsql and clockwise vertices?

Jeff Lounsbury jeffloun at refractions.net
Fri Aug 29 10:07:30 PDT 2003


Soory, pgsql2shp and shp2pgsql should be reversed in my first paragraph there...
Going into the DB - shp2pgsql - checks clockwiseness
Dumping to Shapefile - pgsql2shp - doesn't
-Jeff

Jeff Lounsbury wrote:

> This is what happens, pgsq2shp verifying clockwiseness and reverses it if it is
> incorrect(correct being, ring-clockwise, hole-counter)
> shp2pgsql does not reverse vertice order, it assumes it should be correct in the
> database.
> It is possible however that the shapelib library used in shp2pgsql to generate the
> shapefile does not guarantee the clockwise/counter-clockwiseness of the rings?
> see http://mapserver.gis.umn.edu/data2/wilma/mapserver-users/0111/msg00079.html
> (it's a little old, but seems to say that shapelib doesn't care about
> clockwiseness)
>
> So if all you have is single polygons(rings) in clockwise order, they shouldn't be
> touched on the way into the database since they are all correct. (is everything
> correct in the DB?)
> Then on the way out, possibily shapelib reverses some of them, and I can't really
> force it not to if that is the case...
> -Jeff
>
> Hubert Fröhlich wrote:
>
> > Hi list,
> >
> > I use PostGIS 0.7.5 and PostgreSQL 7.3.4.
> >
> > I produced a PostGIS table with MULTIPOLYGONS (150 rows) and wanted to
> > export them to shape with pgsql2shp .
> >
> > When filling the PostGIS table I t took care about:
> > - filling only with multipolygons containing 1 polygon with vertices in
> > clockwise order.
> >
> > However, when I produced the shapes and examined the data, I realized
> > that  in some (few) shapes the orientation changed to counterclockwise.
> >
> > Then I tested the same with a modified PostGIS table by deleting some 30
> > rows. Result: again some shapes with changed orientation, but not the
> > same shapes as in the first test with the 150 shapes.
> >
> > What is the reason for this mixing up the shape orientation?
> >
> > Any hints will be appreciated.
> > Thanks.
> >
> > Hubert
> >
> > --
> > -------------------------------------------------------------------------------
> > Dr.-Ing. Hubert Fröhlich
> > Bezirksfinanzdirektion München
> > Alexandrastr. 3, D-80538 München, GERMANY
> > Tel. :+49 (0)89 / 2190 - 2980
> > Fax  :+49 (0)89 / 2190 - 2459
> > hubert.froehlich at bvv.bayern.de
> >
> > _______________________________________________
> > 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




More information about the postgis-users mailing list