[R-sig-Geo] create projection for a .asc file in Rstudio
Bede-Fazekas Ákos
b|@|ev||@t @end|ng |rom gm@||@com
Mon Dec 6 18:02:36 CET 2021
Dear Basile,
the PROJ4 string has a really strict specification. You cannot use
crs(rasterClimat)<-"proj=longlat +datum=WGS84 +no_defs
+ellps=WGS84+towgs84= 0,0,0"
but can use
crs(rasterClimat)<-"+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
+towgs84=0,0,0"
(see the differences in the plus sign and the spaces)
HTH,
Ákos Bede-Fazekas
Centre for Ecological Research, Hungary
2021.12.06. 17:53 keltezéssel, basile.lenormand via R-sig-Geo írta:
> Good evening every ones.
>
> I am trying to set a projection system for an ascii file in Rstudio.
>
> I reached to import the .asc on R and to plot it. Now I need to set a
> projection.
>
> In my matrix I have CRS : NA
>
> I tried two ways :
>
> *First way:*
>
> /crs(rasterClimat, asText=F)/
> /crs(rasterClimat)<- "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100
> +datum=WSG84"//
> /
> /crs(rasterClimat)//
> /
> /w<- wkt(rasterClimat)//
> /
> /w//
> /
> /cat(w, "\n")/
>
> (taken from here :https://rdrr.io/cran/raster/man/projection.html)
>
> *Second way:*
>
> /crs(rasterClimat)<-"proj=longlat +datum=WGS84 +no_defs
> +ellps=WGS84+towgs84= 0,0,0"/
>
> (taken from here : https://www.youtube.com/watch?v=iqbVyt8mjIk,
> tutorial that I followed)
>
> For the two methods, the error message is the same :
>
> /Error in sp::CRS(SRS_string = x) : NA/
>
> I followed the youtube tutorial, our two cases seem similar but she
> reached to project her map.
>
> May someone gives me some clues about what I do not understand in this
> process and where I have to look for and/or what can I do to fix it?
> I want to do it on R, I do not want to use a GISsoftware to set the
> coordinate system then import the file into R.
>
> I put in attachment the code I used if you want to have a close look,
> and the .asc files.
>
> Thank you very much for your time,
> best regards,
>
> Basile.
>
>
>
>
>
>
> Sent with ProtonMail <https://protonmail.com/> Secure Email.
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list