[geos-devel] Shortest Line Between Two Polygons
Chris Hodgson
chodgson at refractions.net
Thu Apr 19 17:33:40 EDT 2012
Alternatively you could look at the distance function in GEOS or Postgis
- it's probably a similarly large amount of code - but it must find the
closest points on the two inputs in order to calculate the distance, all
you need to do is grab those points and put them together as a line.
Chris
On 12-04-19 02:27 PM, Curtis Jones wrote:
> I just started using GEOS (C API) yesterday, so I'm probably missing the obvious answer. Given two polygons, I'd like to get a line that connects the two closest points of those polygons; or, more specifically, the point on polygon 2 that is closest to polygon 1.
>
> While trying to find the best way to do this I found that PostGIS has an ST_ShortestLine(<geom1>,<geom2>) function, so I dug into its implementation. It's not a trivial amount of code.
>
> Is there a GEOS-provided method of accomplishing this?
>
> Any help would be appreciated. Thanks.
>
> --
> Curtis Jones
> curtis.jones at gmail.com
>
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
More information about the geos-devel
mailing list