Converting Polygon Shapefile

Matthew Perry perrygeo at GMAIL.COM
Tue Mar 28 12:19:23 EST 2006


PostGIS would be a fairly easy way to go. Probably just two steps:

$ shp2pgsql states.shp states | psql -d gisdata
$ pgsql2shp -f state_centroids.shp -h localhost gisdata "SELECT
centroid(the_geom) AS the_geom, <other columns> FROM states"

- matt

On 3/28/06, Bart van den Eijnden (OSGIS) <bartvde at xs4all.nl> wrote:
> You could load it into PostGIS, let PostGIS calculate the centroid and
> export it again to shape using e.g. ogr2ogr.
>
> You probably could also write an OGR Python script doing this.
>
> Best regards,
> Bart
>
> Chip Taylor wrote:
>
> >Is there an open source utility that will convert a polygon shapefile to a
> >point shapefile, using the centroid of the polygon as the xy for the point?
> >
> >Chip Taylor
> >Prepared Response, Inc
> >
> >
> >
> >
>
>
> --
> Bart van den Eijnden
> OSGIS, Open Source GIS
> http://www.osgis.nl
>


--
Matt Perry
perrygeo at gmail.com
http://www.perrygeo.net



More information about the mapserver-users mailing list