1

I used mapproj package to convert set of lat/long into map projection (in this example lagrange). Next I used it to define several other points on the space. I now want to convert those new points back into lat/long, but mapproj does not offer such function, nor did I found it elsewhere.

cord<-data.frame(x, y)

lagrange<-mapproject(cord$x, cord$y, projection="lagrange")
#Some  
#clustering
#here

#Here are cluster centers, but in the form of lagrange projection. I want a lat/long cord of them
cluster.centers

How to do it in R?

Dan
  • 9,391
  • 5
  • 41
  • 73
Paweł W.
  • 11
  • 1

1 Answers1

2

I read the package documentation and I don't believe that the author intended his set of projections to be used beyond plotting.

The 'standard' way to work with geospatial data in R is through the set of sp objects. The way to transform sp objects is through spTransform. Both the objects and methods can be found in the sp package. There should be a number of tutorials available, admitedly this can be a steep learning curve if you are not familiar with GIS and R.

An example of converting 'long lat' data to other projections is detailed in this post:

Error when re-projecting spatial points using spTransform in rgdal R

Community
  • 1
  • 1
Jonathan Lisic
  • 1,710
  • 1
  • 13
  • 21