Skip to content
Prev 1052 / 7420 Next

adehabitat - data projection

Hi Danielle,

I just got the following instructions and code from a local R expert.
I haven't tested it, but I think you can just switch the
"+proj=lonlat" and "+proj=utm +zone=XX +north" to go from longlat to
UTM. One note, though. I'm not sure how spTransform from the rgdal
package handles the datum. Shifting from WGS84 (I'm assuming these are
GPS longlats) to NAD83 (which all of your other GIS data are likely
projected as) is not straightforward. Knowing the datum is important
if you are to do any overlay analysis or raster extraction with your
data. Dispite the recent display functionality of GIS software, the
extract tools only reliably work on data of the same projection.

****
1. look up the utm "zone" of the locations of interest.  I do this by
first finding an approximate long/lat for my study area, then using
that online to find the utm zone (e.g.,
http://www.apsalin.com/utm-zone-finder.aspx)

2. load the rgdal library (which loads the sp library)

library(rgdal)

3. create a Spatial Points data object (1st argument is the x-y
locations, 2nd argument specifies utms and the zone)

locs <- cbind(x,y)
locs.sp <- SpatialPoints(locs,CRS("+proj=utm +zone=<your zone> +north"))

4. transform to longlat

trans <- spTransform(locs.sp,CRS("+proj=longlat"))


5. now we can plot with maps

 library(maps)
plot(trans,pch=1)
map("county",add=T)

Tammy
On Thu, Jan 28, 2010 at 4:12 PM, danik <danielle.knip at jcu.edu.au> wrote: