[R-sig-Geo] Spatial clustering of points within a given line

Adrian.Baddeley at csiro.au Adrian.Baddeley at csiro.au
Mon Sep 14 09:14:38 CEST 2009


Julius Tesoro <jutesoro at yahoo.com> writes:

> I have a dilemma, Considering I have a number of points and a line (shapefile). How do > I compute for the shortest distance between a line and a point? 

In package 'spatstat' you would use 
           nncross(X,Y)
or 
           project2segment(X, Y) 
where X is a point pattern (class "ppp") and Y is a line segment pattern (class "psp"). This computes the shortest distance from each point to the nearest line segment, identifies which line segment is closest to each point, and projects each point in X to a point on the nearest line segment. To convert your shapefile data to spatstat data, see the vignette supplied with the spatstat package.

> Also how do you identify which points aggregate near the line 
> like in spatial clustering?

I'm not sure exactly what you want to do. You could simply select all points whose distance to the nearest line segment is smaller than a certain threshold. 

regards
Adrian Baddeley



More information about the R-sig-Geo mailing list