[R-sig-Geo] (no subject)

Roger Bivand Roger.Bivand at nhh.no
Fri Dec 1 19:51:14 CET 2006


On Fri, 1 Dec 2006 harrykim at stat.Berkeley.EDU wrote:

> Hello R-sig-geo list,
> 
>    I've been trying to figure this out by myself but i am getting kind of
> lost so i was hoping if you could point me to the right direction.
>    I have a shape file for map of berkeley--the one in
> california--formatted in long/lat coordinates. I also have set of
> locations in long/lat coordinates which i wish to plot over the map of
> berkeley.
>    So far i have
> 
> library("maptools")
> plot(readShapePoly("V1 Land.shp"))
> points(tmp$long,tmp$lat)
> 
> which does the job. But I want to convert the shapefile and the locations
> into UTM coordinates and ultimately convert them into meters (or
> kilometers); I want to work with the coordinates in meters.
>    I have been using readShapePoly() in maptools package to read in the
> shapefile which returns spatial polygons data frame. I've read that the
> spatial polygons data frame can be converted into UTM using
> sptransform() in Rgdal package but i am not so sure what i need to
> exactly. I tried to read up on using CRS class (a class used by proj4)
> but i was getting lost in the documentation.

You are almost there. If we assume that your shapefile is in geographical 
coordinates and in the WGS84 datum (the model of where you are vertically 
on a 3D globe), then you can set that when you read it:

berk_ll <- readShapePoly("V1 Land.shp",
 proj4string=CRS("+proj=longlat +datum=WGS84"))
berk_utm <- spTransform(berk_ll, CRS("+proj=utm +zone=10"))

and equivalently for the points, the coordinates will be in meters.

> 
> Thank you very much
> Harry
> p.s:The UTM zone for berkeley is 10S

Not sure about 10S, you can get +south if you want, but I thought Berkeley 
was still North of the Equator?

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

-- 
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




More information about the R-sig-Geo mailing list