[OGRUG] What R packages/vocabulary do I need to search for Spatial Distance ranking?

Daniel Buijs dbuijs at gmail.com
Mon Oct 27 16:11:53 CET 2014


Hello,

I'm trying to do something that I'm pretty sure can be done in R and
probably has been done in R, but I'm having trouble finding the right
search vocabulary to find appropriate packages.

Briefly, I'm working with various spatial datasets available from
data.ottawa.ca. I can import them into R with the rgdal package and I've
gained some comfort with basic plotting and geometry operations with ggmap,
sp and rgeos packages. What I'm after is the following:

>From a set of Spatial features (including SpatialPoints, SpatialLines, and
SpatialPolygons), I would like to assign arbitrary weights to features
based on categorical variables in the data (i.e. 1 for schools, 2 for
parks, -1 for highways, etc.) and then estimate an intensity/density
surface at defined points (like road intersections). I think that this will
let me answer questions like "what are the top 10 intersections that are
closest to schools, parks (weight 2 because I care more about parks than
schools) and furthest form highways?"

I don't really care about the actual value, I'm just using it as a ranking
score.

I think some flavour of 2D kernel density estimation will do this. This
particular problem seems to differ from the more simple examples given in
the various package vignettes in the following ways:

To deal with roads in the form of SpatialLines, I either need to sample
them into points with a fixed absolute frequently that results in a
steady-state maximum equivalent to the maximum of a weight=1 point source,
or find a package that has some reasonable treatment of edge effects.

SpatialPolygons (i.e. large areas like parks) should have a uniform
weighting of 1 within the polygon and behave like a SpatialLine at the
edges. Weighted points within the polygon should combine constructively
with the base weight of the polygon. If I have to do this with sampling, as
with the SpatialLines, ok. Using the centroid is a temporary solution for
smallish areas, but for bigger or irregular shapes, would prefer to deal
with the SpatialPolygon as is and/or with somewhat automatic sampling to
points.

To estimate the intensity/density function at arbitrary points (i.e.
intersections), I probably need to estimate the whole surface function with
regular spacing and then interpolate from the estimated surface (somewhat
concerned about double-sampling error in this case). Would prefer an
algorithm that could calculate estimates directly from the points I care
about for ranking.

I haven't seen any packages yet that look like they would be comfortable
with negative weights (i.e. things I don't want to be close to).

I need to have some global control/parameter that allows me to adjust
either the bandwidth of the smoothing and/or the extinction coefficient of
the kernel function so I can empirically dictate and experiment with
distance effects (i.e. objects more than x km away shouldn't influence the
value function at my point of interest).

Any thoughts on recommended reading/R packages that either already provide
this functionality or could be extended to do this kind of thing?

Dan Buijs

	[[alternative HTML version deleted]]



More information about the R-UG-Ottawa mailing list