I just realized that you don't even have to alter STRtree to support a
custom filter function.  STRtree already provides a method which accepts a
custom ItemDistance function.  This could be given an implementation which
forces the distance of objects *not* in the current compass slice to be
Double.MAX_VALUE.


On Mon, Dec 2, 2013 at 5:25 PM, Martin Davis <[email protected]> wrote:

> A fascinating problem, Michael.
>
> How's this for a idea: use a direction-constrained nearest neighbour
> search. (Don't bother googling this - I just made it up!).  The STRtree in
> JTS provides a nearest-neighbour search made efficient by walking the
> R-tree node hierarchy.  It should be possible to add some further logic to
> the search algorithm to reject candidates which do not lie in the compass
> direction of interest.  (It seems like it will be straightforward to
> compute whether a candidate lies with the compass slice).
>
> You'll have to open up the STRtree nearest neighbour code and add
> provision for a custom filter to be run on each candidate as they are added
> to the current search list.  This should be built using a filter function
> interface, to make it reusable.
>
>
> On Mon, Dec 2, 2013 at 4:21 PM, Michael Bedward <[email protected]
> > wrote:
>
>> Hi Martin,
>>
>> The following is a general algorithm query rather than a specific JTS
>> question - hope that's ok.
>>
>> I have a set of polygons which represent urban areas within a
>> fire-prone landscape. There are about 5000 polygons varying widely in
>> area, spatial extent, number of vertices and boundary complexity.
>>
>> I have the task of creating a regular grid of sample points within the
>> surrounding landscape and, for each point, determining the distance to
>> the nearest polygon within each of eight compass segments (ie. N to
>> NE, NE to E...).  The results only need to be expressed as categorized
>> values based on a small number of distance cut-points.
>>
>> I've been trying to nut out something other than a brute force
>> approach to this without much success so far. One of the possibly less
>> brutish approaches I've thought of involves the following:
>>
>> 1. Split up the urban polygons by intersecting them with a regular
>> lattice, create PreparedGeometry objects for the resulting parts and
>> put them into an STRtree.
>>
>> 2. Construct a sampling template made up of polygons representing the
>> compass segments, each split according to the distance cut-points
>> (looking a bit like a dart board), possibly using a custom
>> CoordinateSequence to have vertex coordinates calculated on the fly
>> based on the centre coordinate.
>>
>> 3. For each sample point location:
>>      For each compass segment:
>>        For inner to outer segment part:
>>          Query the spatial index with the segment part envelope
>>          and, if any urban polygons are returned, test for
>>          intersection.
>>
>> I'm sure there must be a better way.  Any suggestions or comments will
>> be gratefully accepted.
>>
>> Michael
>>
>>
>> ------------------------------------------------------------------------------
>> Rapidly troubleshoot problems before they affect your business. Most IT
>> organizations don't have a clear picture of how application performance
>> affects their revenue. With AppDynamics, you get 100% visibility into your
>> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics
>> Pro!
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Jts-topo-suite-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user
>>
>
>
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Jts-topo-suite-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user

Reply via email to