[postgis-users] Lines inside Polys

Wood Brent pcreso at pcreso.com
Sun Apr 18 17:22:25 PDT 2004


--- David Mitchell <david.mitchell at telogis.com> wrote:
> Hi,
> 
> I have a whole bunch of lines and each line falls entirely within zero 
> or one of a pile of polygons. The line might touch another polygon (for 
> instance, if two polygons share an edge and the line goes right to the 
> edge of its parent polygon). None of the polygons overlap. What I want 
> to find out is which polygon each line falls within. Currently I am 
> doing this:

Um, without thinking too much about it, the following spring to mind:

iterate through each line with a "limit 1" might prove faster?

Select the midpoint of each line & do a point check instead, as this may be
faster?


I assume you have created a GIST index on both lines and polygons?

Brent Wood



More information about the postgis-users mailing list