Dear all: I have a shapefile in UTM coordinate system and I would like to transform it to Lat/Log coordinates (WSG84). The package PBSmapping contains function convUL to transform between the two coordinate systems when data is in the form of a data frame with attributes specifying the coordinate system. However, when shapefiles are imported using function read.shape (package maptools), a list instead of a data frame is generated. I could extract all the polygons in the list and transform them, individually, but I hope there is an easier way of doing that. Besides, the shapefile i'm trying to convert has two different UTM zones (is from Guatemala, and it covers zones 15 and 16). Any sugestions would be greatly appreciated. Thanks, Fredy [[alternative HTML version deleted]]
On Tue, 21 Mar 2006, Fredy O. Mejia wrote:> Dear all: > > I have a shapefile in UTM coordinate system and I would like to transform it > to Lat/Log coordinates (WSG84). The package PBSmapping contains function > convUL to transform between the two coordinate systems when data is in the > form of a data frame with attributes specifying the coordinate system. > However, when shapefiles are imported using function read.shape (package > maptools), a list instead of a data frame is generated. I could extract all > the polygons in the list and transform them, individually, but I hope there > is an easier way of doing that. Besides, the shapefile i'm trying to > convert has two different UTM zones (is from Guatemala, and it covers zones > 15 and 16). Any sugestions would be greatly appreciated.My suggestion would be to read the shapefiles using the readOGR() function in the rgdal package, and then use the transform() method in that package to change from the appropriate UTM to geographical coordinates. Because I think your question involves more than that (I don't understand how a single shapefile can use two UTM zones), I suggest moving this thread to the R-sig-geo mailing list, and have cc-ed this reply there. Please also say which platform and version of R you are using.> > Thanks, > > Fredy >-- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no
On Tuesday 21 March 2006 08:13 am, Fredy O. Mejia wrote:> Dear all: > > I have a shapefile in UTM coordinate system and I would like to transform > it to Lat/Log coordinates (WSG84). The package PBSmapping contains > function convUL to transform between the two coordinate systems when data > is in the form of a data frame with attributes specifying the coordinate > system. However, when shapefiles are imported using function read.shape > (package maptools), a list instead of a data frame is generated. I could > extract all the polygons in the list and transform them, individually, but > I hope there is an easier way of doing that. Besides, the shapefile i'm > trying to convert has two different UTM zones (is from Guatemala, and it > covers zones 15 and 16). Any sugestions would be greatly appreciated. > > Thanks, > > Fredy > > [[alternative HTML version deleted]] >Fredy, I would recommend performing the inverse projection with the GDAL/OGR library first. -- Dylan Beaudette Soils and Biogeochemistry Graduate Group University of California at Davis 530.754.7341
Hi R users: When I use this commands: ------------------------------------------------------------- testData<-read.table("testData.dat",header=T) model1J<-glm(MCHNV~offset(Offset1),data=testData,family="poisson") step(model1J,direction="forward", scope=(list(upper=~IA+IM+altura+Region+Region:IA+Region:IM+Region:altura+offset(Offset1)))) ------------------------------------------------------------- (the "testData" (testData.dat) is attached to the e-mail to reproduce the problem): I got this error: ------------------------------------------------------------- . . . MCHNV ~ Region + IA + altura + offset(Offset1) Df Deviance AIC + IA:Region 8 540.24 1377.73 + IM 1 586.84 1410.32 + altura:Region 8 574.21 1411.70 <none> 600.74 1422.23 Step: AIC= 1377.73 MCHNV ~ Region + IA + altura + Region:IA + offset(Offset1) Error in factor.scope(ffac, list(add = fadd, drop = fdrop)) : upper scope does not include model ------------------------------------------------------------- What am I doing wrong? I try also with: step(model1J,direction="forward", scope=(list(upper=~IA+IM+altura+Region+IA:Region+Region:IM+Region:altura+offset(Offset1)))) and with step(model1J,direction="forward", scope=(list(upper=~IA+IM+altura+Region+IA:Region+Region:IA+Region:IM+Region:altura+offset(Offset1)))) I got the same message Thank you for your help. Kenneth