View source: R/jitterSurveyPoints.R
| jitterSurveyPoints | R Documentation |
Following DHS guidelines, survey GPS locations need to be purposefully displaced (jittered) before disseminating in order to preserve annonymity. Each point is displaced based on its urban/rural definition. All points must stay within the administrative 2 boundaries in which they originate.
jitterSurveyPoints(inPts, inAdmin, urbanField = "Id", urbanDist = 2000, ruralDist = 5000, ruralDistFar = 10000)
inPts |
SpatialPointsDataFrame containing the points to be jittered. |
inAdmin |
SpatialPolygonsDataFrame containing administrative boundaries. Jittered points are not allowed to be moved outside their original administrative boundary. |
urbanField |
string indicating the column that contains a binary indicator that defines urban and rural points. 1 = Rural. |
urbanDist |
(optional) numeric distance (in metres) to jitter urban points. Default is 2000m. |
ruralDist |
(optional) numeric distance (in metres) to jitter rural points. Default is 5000m. |
ruralDistFar |
(optional) numeric distance (in metres) to jitter 1% of rural points. Default is 10000m. |
A spatial data frame with randomly jittered coordinates
# First load the input points. You can use the example data:
data("inPts")
# As you can see this is a shapefile with the following structure:
str(inPts)
# You will also need administrative boundaries
to ensure that the Jittered survey locations remain within administrative units.
data("inAdmin")
# Finally pass on the objects to the jitterSurveyPoints function.
newPts = jitterSurveyPoints(inPts, inAdmin)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.