[R-sig-Geo] How to write R dataframe to shapefile
dan.putler at sauder.ubc.ca
Sun Dec 20 19:30:25 CET 2009
The easy way is a two step process, using the sp and rgdal packages.
Create a SpatialPointsDataFrame using the SpatialPointsDataFrame
function in sp, and then write it out using the writeOGR function in
rgdal. You can get things correct coordinate system by using
CRS("+init=epsg:4979") for the proj4string argument to
SpatialPointsDataFrame, although there are a number of other EPSG codes
that corresponds to WGS84 geographic coordinates.
On Sun, 2009-12-20 at 11:21 -0600, Mark Na wrote:
> I have an R dataframe with four columns (lat, long, date and time); these
> data were imported from a .gpx and then manipulated. Now, I'd like to write
> these data to a shapefile, using lat and long to specify the spatial
> coordinates and specifying WGS 84 for the geographic coordinate system.
> I'd appreciate any pointers, thank you.
> Mark Na
> [[alternative HTML version deleted]]
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
Sauder School of Business
University of British Columbia
More information about the R-sig-Geo