Re: [R-sig-Geo] jitter within polygon

2017-01-27 Thread Paul Lantos
Thanks, will take a look! Paul From: obrlsoi...@gmail.com [mailto:obrlsoi...@gmail.com] Sent: Saturday, January 28, 2017 1:03 AM To: Paul Lantos ; r-sig-geo@r-project.org; obrl_soil Subject: RE: [R-sig-Geo] jitter within polygon Maybe try this

Re: [R-sig-Geo] jitter within polygon

2017-01-27 Thread Paul Lantos
Ok, thanks. It's for about 100,000 points within thousands of polygons, and they need to 1) remain within a polygon and 2) retain original attribute data. Could be a challenging workflow... Paul -Original Message- From: Baldwin, Jim -FS [mailto:jbald...@fs.fed.us] Sent: Saturday,

Re: [R-sig-Geo] jitter within polygon

2017-01-27 Thread Baldwin, Jim -FS
Point-in-polygon routines are pretty fast and straightforward to use. If it's about reducing computing time, then maybe for "irregular" polygons it would be easier to stratify the points into two groups: those points whose jittering would not go outside the polygon and those that might and

Re: [R-sig-Geo] jitter within polygon

2017-01-27 Thread obrlsoilau
Maybe try this sampler - https://gist.github.com/obrl-soil/839b192da46978351733483421db22f8 You’d want to run it multiple times and cycle through the outputs, if I’m interpreting your request correctly. Cheers @obrl_soil From: Paul Lantos Sent: Saturday, 28 January 2017 3:30 PM To:

Re: [R-sig-Geo] jitter within polygon

2017-01-27 Thread Baldwin, Jim -FS
Sounds like you need a "point-in-polygon" routine to determine if the jittered point is still within the polygon. R has several such routines. Here are two: pnt.in.poly in the SDMTools package point.in.polygon in the sp package Mathematica has several options, too. Jim -Original

[R-sig-Geo] jitter within polygon

2017-01-27 Thread Paul Lantos
I am trying to figure out how to randomly jitter points within an overlying polygon structure. I can easily jitter the points themselves, but I would like this to be constrained by the boundaries of polygons containing the points. This isn't for visualization - I can do that easily enough in

Re: [R-sig-Geo] R function checking/transforming CRS layer R function

2017-01-27 Thread Hodgess, Erin
Hi again! Give this bad boy a shot: CRSfunction<-function(couche) { prj_couche<-couche@proj4string prj_couche_c <- couche@proj4string@projargs prj<-CRS("+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 x_0=70 +y_0=660 +ellps=GRS80 +units=m +no_defs") prj_c <-

Re: [R-sig-Geo] R function checking/transforming CRS layer R function

2017-01-27 Thread Tristan Bourgeois
Hi Erin ! Yes, I tried to apply my function to "UH" which is a shapefile. 2017-01-27 11:28 GMT+01:00 Hodgess, Erin : > Hi Tristan! > > I'm looking at your code right now. What is your input, please; the UH? > > Thanks, > Erin > > > Erin M. Hodgess > Associate Professor

Re: [R-sig-Geo] R function checking/transforming CRS layer R function

2017-01-27 Thread Hodgess, Erin
Hi Tristan! I'm looking at your code right now. What is your input, please; the UH? Thanks, Erin Erin M. Hodgess Associate Professor Department of Mathematics and Statistics University of Houston - Downtown mailto: hodge...@uhd.edu From: R-sig-Geo

[R-sig-Geo] R function checking/transforming CRS layer R function

2017-01-27 Thread Tristan Bourgeois
Dear all, I'm trying to build up an r function able to check if the projection system of a layer is in Lambert93 (WSG code : 2154) . If the condition is false I want to transform the CRS into Lambert 93. This is what I wrote : > CRSfunction<-function(couche) + { + prj_couche<-CRS(couche) +