[R-sig-eco] adehabitat - data projection

Tammy Wilson t.w at aggiemail.usu.edu
Sat Jan 30 00:49:31 CET 2010


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:
>
> I'm just starting to use adehabitat to do home range calculations, and I'm
> wondering if there is a simple way to convert my xy coordinates (which are
> in decimal degrees) to UTMs or kilometers. The demo(homerange) already has
> their coordinates listed in kilometers, so I'm not quite sure how to get to
> that step.
>
> Another option would be to project my data. There is a package called
> mapproj, but I also am not sure how that works. I usually work with GIS so R
> is new to me. Any help is appreciated. Thank you.
> --
> View this message in context: http://n2.nabble.com/adehabitat-data-projection-tp4476854p4476854.html
> Sent from the r-sig-ecology mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



-- 
Tammy L. Wilson
Doctoral Candidate
Department of Wildland Resources
Utah State University
5230 Old Main Hill
Logan, UT 84322-5230
t.w at aggiemail.usu.edu
435.797.3892



More information about the R-sig-ecology mailing list