Ticket #24 (closed enhancement: wontfix)

Opened 5 years ago

Last modified 4 years ago

Enhancement: containsVertex function

Reported by: mtnclimb Owned by:
Priority: low Milestone: PostGIS 1.5.0
Component: postgis Version:
Keywords: Cc:

Description (last modified by robe) (diff)

A containsVertex function might be a useful addition.

int containsVertex(Geometry geom, double x, double y)

I geom contains a vertex with location (x,y), returns the index of that vertex. Otherwise returns -1. For geometrys which contain more than one coordinate sequence, the index is the cumulative index over all coordinate sequences.

This can be implemented as a fast linear scan of all vertices in the geometry.

Change History

Changed 5 years ago by kneufeld

Agreed, esp. if one is doing linear referencing or edit a single point in a geometry.

or int ST_ContainsPoint(Geometry geom, Geometry point) or int ST_ContainsCoordinate(Geometry geom, Geometry point)

Though I think the cumulative index part could get confusing. We could restrict the use to LineStrings? only.

Changed 5 years ago by pramsey

What about multi-line strings? Behavior?

Changed 5 years ago by mtnclimb

One idea is to use the cumulative index idea. So for a ML:

g = MULTILINESTRING((0 0, 1 1) (1 1, 2 2))

ST_ContainsPoint(g, pt(0,0)) = 0 ST_ContainsPoint(g, pt(1,1)) = 1 // 1st one found is returned ST_ContainsPoint(g, pt(2,2)) = 3 // 2nd linestring has indexes 2, 3

Another is to return a pair (lineIndex, ptIndex) - but this might make for more complicated code in the caller.

Changed 5 years ago by kneufeld

<i>(No comment was entered for this change.)</i>

Changed 4 years ago by robe

  • description modified (diff)
  • milestone set to 2.0

Changed 4 years ago by pramsey

  • status changed from new to closed
  • resolution set to wontfix

Two year old, no movement, retiring until someone decides to love this ticket.

Note: See TracTickets for help on using tickets.