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

2017-01-29 Thread Rolf Turner
On 28/01/17 18:29, Paul Lantos wrote: 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 visualiza

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 sampler - https://gist.github.com/obrl-soil

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

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 onl

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: r-sig-geo@

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

2017-01-27 Thread Paul Lantos
Thanks, Jim. There isn't a way to specify the polygons a priori in order to constrain the jittering? Paul -Original Message- From: Baldwin, Jim -FS [mailto:jbald...@fs.fed.us] Sent: Saturday, January 28, 2017 12:47 AM To: Paul Lantos ; r-sig-geo@r-project.org Subject: RE: jitter within

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 Me