Skip to content
Back to formatted view

Raw Message

Message-ID: <4EB539C1.8010807@univ-fcomte.fr>
Date: 2011-11-05T13:27:29Z
From: Patrick Giraudoux
Subject: How to write a shapefile with projection

> Hi,
>
> Sorry i have put such a detailed question to the list about writing a shapefile with projection. I realized that if i use writeOGR from rgdal and not the other write shapefile functions i can get a shapefile with projection recognized by ArcGIS. The command is (in case anybody wonders):
>
> ?writeOGR(crest.sp, "I:\\LA_levee\\Shape", "llev_crest_pts6", driver = "ESRI Shapefile")
>
> where crest.sp is a spatial point data frame with projection.
>
> Thanks,
>
> Monica

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