[R-sig-Geo] zerodist() fails with Projected Data
Jesse Berman
berman.jesse at gmail.com
Sun Jul 21 20:29:25 CEST 2013
Hi All,
I have run across an error where 'zerodist()' fails to identify duplicate
points if data is projected under a geographic coordinate system (e.g. WGS84
or NAD83). However, it works correctly if data has no set projection or is
projected under a local or continental system (e.g. Albers Equal Area or
Lambert Conformal Conic). Any thoughts as to why this occurs (see example
below)?
Jesse
/# GCS Projection, where zerodist() fails to identify duplicates. WGS84 also
fails to work
require(sp)
longitude<-c(-75.518056, -76.952778, -77.032500, -75.558056, -75.558056)
latitude<-c(39.155000, 38.897222, 38.880833, 39.739444, 39.739444)
z<-c(12, 14, 15, 13, 19)
data<-as.data.frame(cbind(longitude, latitude, z))
coordinates(data)=~longitude+latitude
proj4string(data)=CRS("+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs
+towgs84=0,0,0 +units=m") # NAD83 Geographic Coordinate System
zerodist(data)/
/# Continental Projection on same dataset, where zerodist() identifies
duplicates
require(sp)
longitude<-c(-75.518056, -76.952778, -77.032500, -75.558056, -75.558056)
latitude<-c(39.155000, 38.897222, 38.880833, 39.739444, 39.739444)
z<-c(12, 14, 15, 13, 19)
data<-as.data.frame(cbind(longitude, latitude, z))
coordinates(data)=~longitude+latitude
proj4string(data)=CRS("+proj=aea +lat_1=20 +lat_2=60 +lat_0=40 +lon_0=-96
+x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs") #Continental
projection system for Albers Equal Area
zerodist(data)
/
-----
--------------------------------------------------------
Jesse D Berman, PhD
Johns Hopkins Bloomberg School of Public Health
Department of Environmental Health Sciences
Post-Doc
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/zerodist-fails-with-Projected-Data-tp7584211.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list