Commit ca1956c1 authored by peguerin's avatar peguerin
Browse files

function to transform coordinates

parent e0f32799
......@@ -120,6 +120,21 @@ coords_to_latband <- function(latcoord) {
return(bandcoord)
}
## convert coordinates into epsg:4326
convert_coordinates_into_epsg4326 <- function(dcW, dcW.1, gridW) {
gridW.1=gridW[which(gridW$IDcell %in% dcW.1$cell),]
dcW=dcW[which(dcW$cell %in% dcW.1$cell),]
centroW <- gCentroid(gridW.1,byid=TRUE)
spW=SpatialPoints(data.frame(as.numeric(centroW@coords[,1]),as.numeric(centroW@coords[,2])))
proj4string(spW)=proj4string(gridW)
spW.g=spTransform(spW, CRS("+init=epsg:4326"))
lat_W=matrix(spW.g@coords[,2])
return(lat_W)
}
###############################################################################
## sensitiviy analysis functions
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment