[R-sig-Geo] Using CRS() method on SpatialPointDataFrame to project coordinates

Rich Shepard r@hep@rd @ending from @ppl-eco@y@@com
Thu Sep 20 17:31:21 CEST 2018


On Thu, 20 Sep 2018, MacQueen, Don wrote:

> First, it looks like prcp_sites_ll does not have CRS information, because
> @projargs is NA.

Don,

   I used coordinates(prcp_sites_ll) <- c('easting','northing') to transform
the original dataframe to a SpatialPointsDataFrame and thought that because lat-lon
was not projected the @projards=NA was expected. Now I have learned that ...

> You'll need something like
>  proj4string(prcp_sites_ll) <- CRS('+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0')
or
>   CRS('+init=epsg:4326')

   I missed this step in my readings.

> Otherwise, your spTransform() command looks ok to me.

   Good to know.

> (have you come across spatialreference.org? I find it useful. Example
>   http://spatialreference.org/ref/epsg/wgs-84/)

   Yes. I frequently use that when working in GRASS since multiple agency
sources use different, and frequently undocumented, projectons on their
shapefiles.

Many thanks,

Rich



More information about the R-sig-Geo mailing list