Skip to content

How to write a shapefile with projection

2 messages · Patrick Giraudoux, Monica Pisica

#
Indeed.

writePointsShape() does not write the projection file, but  using the 
function showWKT from rgdal, you can also create one like that:

writePointsShape(crest.sp,"crest")
cat(showWKT(proj4string(crest.sp)),file="crest.prj")

Patrick
2 days later
#
Hi Patrick,

Thanks for letting me know. I mostly use rgdal to read and write rasters so until now i kind of ignore other functionality. Unfortunately i supposed that a package dedicated to shapefiles would be the answer and had the functionality i needed. But rgdal does a nice job in saving my files as i need. It is good to know how to add the projection file to the shapefiles for the future, if it is not generated from the onset.

Thanks again,

Monica

----------------------------------------