[postgis-users] Shapefile toolkit

Stephen Woodbridge woodbri at swoodbridge.com
Sat Jun 9 13:25:02 PDT 2007


Dave Potts wrote:
> Is anybody aware of any tools to creat or manipulate shape files?
> 
> I have a shape file and I want to add some projection data to it

PostGIS is a good tool for this. Or if you are C language compatible you 
can get shapelib and write trivial tools for manipulating them. I do 
this all the time.

Question: what do you mean by: "add some projection data to it"?

Shapefiles per say do not have projection information. ESRI Arc* tools, 
the newer ones anyway, create file.prj file but shapefiles themselves 
have no projection definition.

If on the other hand you have data that is in a different project and 
you would like to merge is with data from a different projection, then 
why not load it into postgis and multiple tables using shp2pgsql where 
each table has the appropriate srid set. Then do something like:

insert into tablea (select col1, col2, transform(the_geom, srid_from 
tablea) from tableb);

This will transform the data from tableb srid to tablea srid and insert 
it into tablea

then you can use pgsql2shp to dump the data back out to a shapefile.

-Steve



More information about the postgis-users mailing list