Thank you, here is the full process trying to follow Edzer's suggestion:

library(RODBC)
library(rgdal)
channel <- odbcConnectAccess("farms.mdb")
sigal <- sqlQuery(channel, "select * from T_SIGAL")
Liste <- by(sigal,
            list(zone = sigal$zone),
            function(x){
                strg <- paste("+proj=utm +ellps=intl +zone=",
unique(x$zone), sep = "")
                SP <- SpatialPoints(cbind(x$UTM_X, x$UTM_Y),
proj4string=CRS(strg))
                as.data.frame(spTransform(SP, CRS("+proj=longlat
+datum=WGS84")))
                })
sigal2 <- do.call("rbind", Liste)
dimnames(sigal2) <- list(seq(nrow(sigal2)), c("x", "y"))

Plotting the result looks fine but I need to check further.

BTW, is it possible to stack directly the SpatialPoints objects?

Thank you for your help!

Renaud

2009/5/8 Jim Burke <j.bu...@earthlink.net>

> 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.pebe...@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.pebe...@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@stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>>
>>>
>>
>>
>>
>>  ------------------------------------------------------------------------
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo@stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>
>
>


-- 
Renaud Lancelot
EDEN Project, coordinator
http://www.eden-fp6project.net/

UMR CIRAD-INRA "Contrôle des maladies animales exotiques et émergentes"
Joint research unit "Control of emerging and exotic animal diseases"

CIRAD
Campus International de Baillarguet TA A-DIR / B
F34398 Montpellier
http://www.cirad.fr  http://bluetongue.cirad.fr/

Tel.  +33 4 67 59 37 17  -  Fax  +33 4 67 59 37 95
Secr. +33 4 67 59 37 37  - Cell. +33 6 77 52 08 69

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to