Re: [R-sig-eco] How to calculate geographical coordinates of sampling points following (by bearing and distance) a georeferenced one?

2012-04-06 Thread Tammy Wilson
Trigonometry will work for projected coordinate systems like UTM:

Try this:
# number of points
n = 30

# reference location
ref.pt = cbind(1,2)

# generate some random directions
# This can be your list of your bearings converted to radians
dir - runif(n,0,2*pi )

# generate some random distances
# This can be your list of distances in map units (e.g. m)
dist - runif(n,0.5,10)

#empty matrix for coordinates
coords.mat = cbind(rep(0,n),rep(0,n))

#using trigonometry to calculate object location
for (i in 1:n){
  coords.mat[i,1] = ref.pt[1]+(sin(dir[i])*dist[i])
  coords.mat[i,2] = ref.pt[2]+(cos(dir[i])*dist[i])
}
plot (coords.mat)
points(ref.pt,col=2)

Best,
Tammy


On Wed, Apr 4, 2012 at 11:02 PM, Ivailo ubuntero.9...@gmail.com wrote:
 Der fellow R-users,

 I have several sampling sites and in each site the starting plot
 (i.e. the first one that have been sampled) is georeferenced with a
 GPS but the following ones are just described by their distance and
 bearing in relation to the previous one.

 Is there a quick way to calculate (by using some of the spatial
 R-packages) the geographic coordinates of the sapling plots at each
 location that have not been explicitly georeferenced?

 Cheers,
 Ivailo
 --
 UBUNTU: a person is a person through other persons.

 ___
 R-sig-ecology mailing list
 R-sig-ecology@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-ecology



-- 

Tammy L. Wilson
Ecologist
(\(\
(`.’)
(,,)(‘’)(‘’)

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] adehabitat - data projection

2010-01-29 Thread Tammy Wilson
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.k...@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@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...@aggiemail.usu.edu
435.797.3892

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] scatter plot of coordinates

2010-01-27 Thread Tammy Wilson
Hi Julia,

I have found that the easiest way to display geographic data in R is
to use a projected coordinate system (like Universal Transverse
Mercator). You can then use plot (x,y) to display a scatterplot of
your points.
The resulting map isn't pretty, but it lets you visualize the data.
The following packages have limited cartographic and map projection
capabilities: maps, mapproj, maptools

Also, the GIS program GRASS is free and quite functional.
http://grass.osgeo.org/

Tammy

On Wed, Jan 27, 2010 at 2:28 AM, Julia Tchernova tchern...@npolar.no wrote:
 Hello!
 I have a dataset with the date and positions -  Lat and Long columns
 How do I make a scatter  plot?
 Do I have to cbind the Lat and Long columns?
 Any suggestions will be much appreciated!
 Thank you
 Julia

        [[alternative HTML version deleted]]

 ___
 R-sig-ecology mailing list
 R-sig-ecology@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...@aggiemail.usu.edu
435.797.3892

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology