R converting latitude and longitude point and shapefiles for ppp objects -
i trying use ppp function spatial point data in r. understand 1 needs euclidean distances rather latitude , longitude. wondering how take point data , shapefile area , convert them useable ppp object.
so used code below point data , have looks might reasonable. unfamiliar crs projections , not sure correctly defined things. instance can define proj4string longlat or conversion wgs84.
latlong<-asa[,304:305] #not sure if doing think doing (converting lat/long format euclidean distance): id.spp <- spatialpointsdataframe(coords = latlong, proj4string = crs("+proj=longlat +ellps=wgs84 +datum=wgs84 +no_defs"), data = asa) #i tried using input lat long without second part. both give workable output, not sure if correct id.spp2 <- spatialpointsdataframe(coords = latlong, proj4string = crs("+proj=longlat "), data = asa) #i converted both versions using code below: ppp<-as(as(id.spp, "spatialpoints"), "ppp") plot(ppp) plot(studyarea_gcs, add=t) #appears reasonably surround points in anticipated way though did not type of conversion - in lat/long. #the lat/long points, appear in same place ppp points. points(latlong,pch=".")
thanks!
Comments
Post a Comment