[geos-devel] [GEOS] #609: GEOSPointOnSurface returns EMPTY for single-point linestring

Martin Davis mtnclimb at telus.net
Fri Jan 11 09:24:17 PST 2013


I would say that for a zero-length line both Centroid and InteriorPoint 
should return a point equal to the (unique) endpoint of the line.

For this case, both of these functions appear to be broken in both JTS 
(and GEOS too, apparently). I'll look into making a fix for this in JTS 
(shouldn't be hard, hopefully).

On 1/11/2013 6:01 AM, GEOS wrote:
> #609: GEOSPointOnSurface returns EMPTY for single-point linestring
> ------------------------+---------------------------------------------------
>   Reporter:  strk        |       Owner:  geos-devel@…
>       Type:  defect      |      Status:  new
>   Priority:  major       |   Milestone:  3.3.7
> Component:  Default     |     Version:  3.3.6
>   Severity:  Unassigned  |    Keywords:
> ------------------------+---------------------------------------------------
>
> Comment(by strk):
>
>   So for GEOSCentroid the answer is correct, in that by definition the
>   CentroidLine class computes the centroid of all segment's midpoint
>   weighted by segment length, so a zero-length segment is not considered.
>
>   Now, the algorithm of InteriorPointLine [1] is:
>
>      - Find an interior vertex which is closest to the centroid of the
>   linestring.
>      - If there is no interior vertex, find the endpoint which is closest to
>   the centroid.
>
>   [1]
>   http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/algorithm/InteriorPointLine.html
>
>   But if there's no interior vertex both endpoints are equidistant to the
>   centroid, aren't them ?
>   Martin: am I missing anything ?
>



More information about the geos-devel mailing list