[R-sig-Geo] jitter within polygon

Paul Lantos paul.lantos at duke.edu
Sat Jan 28 07:24:46 CET 2017


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:jbaldwin at fs.fed.us] 
Sent: Saturday, January 28, 2017 1:22 AM
To: Paul Lantos <paul.lantos at duke.edu>; r-sig-geo at r-project.org
Subject: RE: jitter within polygon

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 only use point-in-polygon on the potentially outside points.  However, I'd try the point-in-polygon route first and see if it is fast enough first.


Jim


-----Original Message-----
From: Paul Lantos [mailto:paul.lantos at duke.edu] 
Sent: Friday, January 27, 2017 9:49 PM
To: Baldwin, Jim -FS <jbaldwin at fs.fed.us>; r-sig-geo at r-project.org
Subject: RE: jitter within polygon

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:jbaldwin at fs.fed.us] 
Sent: Saturday, January 28, 2017 12:47 AM
To: Paul Lantos <paul.lantos at duke.edu>; r-sig-geo at r-project.org
Subject: RE: jitter within polygon

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 Message-----
From: R-sig-Geo [mailto:r-sig-geo-bounces at r-project.org] On Behalf Of Paul Lantos
Sent: Friday, January 27, 2017 9:30 PM
To: r-sig-geo at r-project.org
Subject: [R-sig-Geo] jitter within polygon

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 GIS. I actually need to generate coordinates.

Thanks,
Paul

Paul M. Lantos, MD, MS GIS, FIDSA, FAAP, FACP                       Contact
Departments of Internal Medicine and Pediatrics                           919-684-6355 (Pediatric Infectious Diseases)
    Pediatric Infectious Diseases                                                                919-681-8263 (Hospital Medicine)
    General Internal Medicine                                                                    paul.lantos at duke.edu
Duke University School of Medicine                                                     @PaulLantos
Duke Global Health Institute


[[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Dgeo&d=CwIFAg&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=pCiIbVPBNWU0azo0D48ChUH_fawb-FalNVOf1sUn1r4&m=i4hWU9_Gy7AChLfLUddISsWbzbyNPkZ_ooonniSZoIY&s=ner0DbrTVNhQ2EgrDupUQkMsjZKVTOJHFF9CSyjUypU&e= 




This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.



More information about the R-sig-Geo mailing list