[geos-devel] Shortest Line Between Two Polygons

Curtis Jones curtis.jones at gmail.com
Thu Apr 19 17:27:29 EDT 2012


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



More information about the geos-devel mailing list