Reprojection doubt
It probably doesn't matter at all. Your data is longitude,latitude on datum WGS84? Those strings are equivalent (some softwares will flip the order of lon,lat as that's what the standard dictates but easy to spot that usually). raster::projection(), raster::crs(), sp::proj4string() all are fairly equivalent functions, they just get the projection metadata - they are just overlapping and inconsistent because of historical vagarie, they differ in ideological stance and how much checking and churn they do to the metadata and in efforts to interpret your intentions. But on the face of it I don't think you need to worry about your code here. Just keep an eye on whether your data looks right, before and after reprojection. It takes care, but the details are yours alone for checking unless you can pin down a reproducible example that raises questions. Good luck. fwiw you seem to not be doing anything with ncdf4 (or ncdf4::nc_open) here. the raster package *uses* ncdf4 on your behalf via raster()/stack()/brick() functions. Cheers, Mike. On Fri, Nov 6, 2020 at 12:11 PM Pietro Andre Telatin Paschoalino <
Pietro_telato at hotmail.com> wrote:
Dear,
I have a question that is possibly extremely easy for you.
I'm extracting data from layers of grid to a shape file.
To do this, first, I know that I need to reproject the coordinates
reference system of my shape to the same CRS as my grid. The code for this
is:
library(ncdf4)
fn<-file.path(path of my data)
ncfile <- nc_open(fn)
rasbrick <- stack(fn)
rasbrick <- brick[[70:81]] (the layers that I want)
shape2<- spTransform(shape, crs(rasbrick)) in lowercase, right? It is my
first question.
The rest of the extraction code works without any problems. If I open this
file in qgis the CRS is:
OGC:CRS84 - WGS 84 (CRS84) - Geographic
The problem is that if I write a raster of a layer using:
rasbrick <- brick[[70]]
writeRaster(rasbrick, "test.tif", format="GTiff")
and open the raster in qgis the CRS is:
EPSG:4326 - WGS 84 - Geographic
So, my second question is why on the raster it looks like EPSG and on the
shape it looks like OGC? And could this cause any problems in extracting
data from layers for the shape? If yes, what I need to change to reproject
the shape for the correct CRS?
Thanks.
Pietro Andre Telatin Paschoalino
Doutorando em Ci?ncias Econ?micas da Universidade Estadual de Maring? -
PCE.
[[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Michael Sumner Software and Database Engineer Australian Antarctic Division Hobart, Australia e-mail: mdsumner at gmail.com [[alternative HTML version deleted]]