[R-sig-Geo] Shortest distance between points within a polygon

Roman Luštrik roman.lustrik at gmail.com
Mon Oct 13 13:12:59 CEST 2014


One way would be to calculate the distance and see if the line connecting
the dots intersects with the polygon edge. `rgeos` package would be the
tool of trade for this.

Cheers,
Roman

On Mon, Oct 13, 2014 at 12:54 PM, Ruari Rhodes <r.rhodes at pgr.reading.ac.uk>
wrote:

> Hi all,
>
> I need to find the distance between two spatial points which lie within
> a polygon, via the shortest path which lies entirely within the polygon.
> Can anyone suggest a method? I need to find something which requires
> minimal computing resources.
>
> I have some examples of the points and polygons here, both in lonlat
> format:
> http://www.met.reading.ac.uk/~jb013101/files/R/datasets/poly.RData
> ("poly", a SpatialPolygonsDataFrame)
> http://www.met.reading.ac.uk/~jb013101/files/R/datasets/pts.RData
> ("pts", a SpatialPoints object)
>
> Many thanks for your help.
>
> --
> *Ruari Rhodes*
> PhD Student
> /European precipitation accumulation extremes/
> Room 1U09 - Dept. of Meteorology
> University of Reading,
> Earley Gate, Reading, RG6 6BB
> r.rhodes at pgr.reading.ac.uk
> http://www.met.reading.ac.uk/~jb013101
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



-- 
In God we trust, all others bring data.

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list