[R-sig-Geo] Conversion geographical coodinate in UTM

Gilles Benjamin Leduc gbl1 at hi.is
Tue Jul 1 12:18:54 CEST 2014


Dear R FAQ Team :p 

So I have been able to use the readOGR function, could anyone transfer to its maintainer a request to add writeOGR in the "see also" section of help?  
 
Anyway, after having done that for my shapefile, I tried to deal with the points I had to plot on, here is what I tried: 
> uniqueGPS(datgps)
       lat    lon
B-40 64.76 -21.59
D-01 66.01 -16.50
E-01 65.32 -14.36
G-04 64.43 -14.90
H-03 64.03 -16.98
M-02 66.10 -22.39
> SpatialPoints(uniqueGPS(datgps))
SpatialPoints:
       lat    lon
[1,] 64.76 -21.59
[2,] 66.01 -16.50
[3,] 65.32 -14.36
[4,] 64.43 -14.90
[5,] 64.03 -16.98
[6,] 66.10 -22.39
Coordinate Reference System (CRS) arguments: NA 
> SpatialPoints(uniqueGPS(datgps))->position
>  positionUTM <- spTransform(position, CRS("+proj=utm +zone=28 +north +datum=WGS84"))
Erreur dans spTransform(position, CRS("+proj=utm +zone=28 +north +datum=WGS84")) : 
  No transformation possible from NA reference system
> 

What have I missed? 

Benjamin 
 
Le Lundi 30 Juin 2014 16:19 GMT, Barry Rowlingson <b.rowlingson at lancaster.ac.uk> a écrit: 
 
> Not your fault that readShapeSpatial ignores the projection!
> 
> I think Roger recently spoke about fixing these things...
> 
> Barry
> 
> 
> 
> On Mon, Jun 30, 2014 at 4:33 PM, Gilles Benjamin Leduc <gbl1 at hi.is> wrote:
> > Thanks Barry,
> >
> > That's it… Sorry if my question was too simple… I'm not a geograph, I'm a molecular biologist… so I'm not used to these packages … I started from the simple script I had for normal maps… (and it is monday, brain isn't fully operational!)
> >
> > Benjamin
> >
> >
> >
> >
> > Le Lundi 30 Juin 2014 15:12 GMT, Barry Rowlingson <b.rowlingson at lancaster.ac.uk> a écrit:
> >
> >> On Mon, Jun 30, 2014 at 3:18 PM, Sarah Goslee <sarah.goslee at gmail.com> wrote:
> >> > Hi,
> >> >
> >> > At a guess, your Front dataset doesn't have a CRS set, so
> >>
> >> Probably because you've used readShapeSpatial which ignores projection
> >> info from shapefiles...
> >>
> >> >> Front<-readShapeSpatial("ISL_adm0.shp")
> >> >> class(Front)
> >> >> [1] "SpatialPolygonsDataFrame"
> >>
> >> Use rgdal:
> >>
> >> require(rgdal)
> >> Front = readOGR(".","ISL_adm0")
> >>
> >> then check Front has a proj4string. summary(Front) should mention it.
> >>
> >> This is getting to be the R-sig-geo equivalent of R FAQ 7.31..
> >>
> >> Barry
> >
> >
> >



More information about the R-sig-Geo mailing list