|
Geometry : |
Subject: Re: [geometry] rtree nearest polygon to a point
From: Andrew Hundt (athundt_at_[hidden])
Date: 2014-12-01 22:56:40
On Mon, Dec 1, 2014 at 9:01 PM, Adam Wulkiewicz <adam.wulkiewicz_at_[hidden]>
wrote:
> Hi Andrew,
>
> Andrew Hundt wrote:
>
>> I'm considering using rtree to store a set of triangles (I will use
>> polygons), and query for the closet triangle to a point. Are there any
>> examples I could use to help with setting up the appropriate objects and
>> types?
>>
>
> You could store pairs of triangle bounding box and index and then iterate
> over the nearest boxes using iterative nearest query and check distance to
> corresponding triangles. If the distance to the next box was greater than
> to the nearest triangle or the distance to the triangle was equal to 0 you
> could break the loop.
Hmm, I'm implementing iterative closest point for sensor data registration.
Most of the time the distance won't be 0, but typically the next box will
be greater. There would be some strange corner cases however if I only
search for a few results and keep increasing the size... Maybe the current
rtree implementation isn't the right tool for this since I can't directly
check for the closest polygon?
Cheers!
Andrew Hundt
Geometry list run by mateusz at loskot.net