[Dev] QuadTree usage

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Dev] QuadTree usage

peathal
Hi,

how can I use the quadtree - now in lucene spatial?

I can query it:

SpatialContext ctx = new SimpleSpatialContext(DistanceUnits.KILOMETERS);
QuadPrefixTree lucene = new QuadPrefixTree(ctx);
double radiusInKm = 10;
List<Node> res = lucene.getNodes(new CircleImpl(new PointImpl(1, 2),
radiusInKm, ctx), 0, false);

But how can I fill it with points?

Regards,
Peter.
_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com
Reply | Threaded
Open this post in threaded view
|

Re: [Dev] QuadTree usage

dsmiley
Peter,
  You're supposed to use the "SpatialStrategy" subclasses which act as a facade to the rest of the API.  They make it simple.  In particular, use RecusrivePrefixTreeStrategy.

  As an aside, when I'm trying to figure out an API, I often find the tests help show how to use it.

~ David

On Thu, Apr 19, 2012 at 4:36 AM, Peter K <[hidden email]> wrote:
Hi,

how can I use the quadtree - now in lucene spatial?

I can query it:

SpatialContext ctx = new SimpleSpatialContext(DistanceUnits.KILOMETERS);
QuadPrefixTree lucene = new QuadPrefixTree(ctx);
double radiusInKm = 10;
List<Node> res = lucene.getNodes(new CircleImpl(new PointImpl(1, 2),
radiusInKm, ctx), 0, false);

But how can I fill it with points?

Regards,
Peter.
_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com


_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com
Reply | Threaded
Open this post in threaded view
|

Re: [Dev] QuadTree usage

peathal
Hi David,

> Peter,
>   You're supposed to use the "SpatialStrategy" subclasses which act as
> a facade to the rest of the API.  They make it simple.  In particular,
> use RecusrivePrefixTreeStrategy.

thanks, so it will only work via lucene or could it be used as a
separate structure?

>   As an aside, when I'm trying to figure out an API, I often find the
> tests help show how to use it.

yes, me too. but I couldn't find a test :)

Regards,
Peter.
_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com
Reply | Threaded
Open this post in threaded view
|

Re: [Dev] QuadTree usage

ryan
Hi Peter

On Thu, Apr 19, 2012 at 11:13 AM, Peter K <[hidden email]> wrote:

> Hi David,
>
>> Peter,
>>   You're supposed to use the "SpatialStrategy" subclasses which act as
>> a facade to the rest of the API.  They make it simple.  In particular,
>> use RecusrivePrefixTreeStrategy.
>
> thanks, so it will only work via lucene or could it be used as a
> separate structure?
>

in spatial4j, it really just makes tokens that represent a quadtree
(or geohash tree).  The search part will be platform dependent.  Right
now the only implementation is via lucene


>>   As an aside, when I'm trying to figure out an API, I often find the
>> tests help show how to use it.
>
> yes, me too. but I couldn't find a test :)
>

The tests to index with with these libraries are here:
http://svn.apache.org/repos/asf/lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/

thanks
ryan
_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com