[R-sig-Geo] UTM to longlat

Jim Burke j.burke at earthlink.net
Fri May 8 00:25:29 CEST 2009


Its all quite simple I think (i.e. "hope"). Have
you used spTransform(rdgal)?

## here I have a file from a local group delivered
## in UTM format that I transformed OK to long-lat.

library(rgdal) # for map projection support; automatically loads sp
## transform internal measurements from UTM to long lat format
longlat_sp <- spTransform(UTM_format_sp, CRS("+init=epsg:4326"))
sapply(slot(longlat_sp, "polygons"), function(x) slot(x, "ID"))


 > showMethods("spTransform")
Function: spTransform (package rgdal)
x="SpatialGridDataFrame", CRSobj="CRS"
x="SpatialLines", CRSobj="CRS"
x="SpatialLinesDataFrame", CRSobj="CRS"
x="SpatialPixelsDataFrame", CRSobj="CRS"
x="SpatialPoints", CRSobj="CRS"
x="SpatialPointsDataFrame", CRSobj="CRS"
x="SpatialPolygons", CRSobj="CRS"
x="SpatialPolygonsDataFrame", CRSobj="CRS"

Hope this helps,
Jim Burke



Renaud Lancelot wrote:
> Thank you Edzer. I was hoping there was a simpler solution, but it's still
> fairly simple.
>
> Renaud
>
> 2009/5/7 Edzer Pebesma <edzer.pebesma at uni-muenster.de>
>
>   
>> Yes, but you will not like that call.
>>
>> In R (package sp), each spatial data set can only have one single
>> projection. I'd suggest, in pseudo-code
>>
>> - import the data into a data.frame
>> - for each UTM zone do:
>>   select the locations
>>   set their CRS
>>   reproject to long/lat
>> - cbind the locations to a single data structure
>> - convert back to data.frame if needed.
>> --
>> Edzer Pebesma
>> Institute for Geoinformatics (ifgi), University of Münster
>> Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
>> 8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/
>> http://www.springer.com/978-0-387-78170-9 e.pebesma at wwu.de
>>
>> Renaud Lancelot wrote:
>>     
>>> Dear all,
>>>
>>> I have a big dataset (> 200,000 lines) of georeferenced locations
>>> where the coordinates are given in UTM, spanning over several zones.
>>> Is is possible to convert all the UTM coordinates into longlat WGS84
>>> with a single call ?
>>>
>>> Renaud
>>>       
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>     
>
>
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list