Monday 22 July 2019

r - Alternatives of spTransform?


Let's say that we have a shapefile with a certain projection.


s<-readOGR(dsn=".",layer="Spain")

We also have the airports of Spain as points in another projection.


a<-readOGR(dsn=".",layer="airports")

If we aim to place the points onto the Spain's shapefile we have to arrange the coordinates so they are the same. Usually, it is done like this:


 a<-spTransform(a,CRS(proj4string(s))


But is it the same with that?


proj4string(a)<-proj4string(s)

If yes, then why isn't the standard way of doing it since it is simpler and have to resort to the spTransform?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...