lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Helleringer, Nicolas" <nicolas.hellerin...@novacodex.net>
Subject Re: [SPATIAL] CartesianPolyFilterBuilder ?
Date Thu, 01 Apr 2010 13:09:47 GMT
2010/4/1 Grant Ingersoll <gsingers@apache.org>

>
> On Apr 1, 2010, at 8:22 AM, Helleringer, Nicolas wrote:
>
> I did put a comment on the jira issue pointing to the code I wrote inside
> Chris Male perspective.
> He answered on the JIRA topic as well.
>
>
> Yep, saw that.  If you wish for that code to be in Lucene, you need to post
> it as a patch to Lucene and grant provenance to the ASF.
>
That is what we want to happen. We are working on it, both of us.


> Here's another question:
> Given the same latitude and same distance, shouldn't there be the same
> number of box ids no matter the longitude?  Yet the following code says
> otherwise:
> public void testCartesianPolyFilterBuilder() throws Exception {
>     CartesianPolyFilterBuilder cpfb = new
> CartesianPolyFilterBuilder(CartesianTierPlotter.DEFALT_FIELD_PREFIX, 2, 15);
>     //try out some shapes
>     final double miles = 20.0;
>         // Hawaii
>         // 2300 miles to Marshall Island Airfield
>     //Hawaii to Midway is 911 miles
>     lat = 0;
>     lng = -179.9;
>     Shape shape;
>     shape = cpfb.getBoxShape(lat, lng, miles);
>     System.out.println("Tier: " + shape.getTierLevel());
>     System.out.println("area: " + shape.getArea().size());
>     lat = 30;
>     lng = -100;
>     shape = cpfb.getBoxShape(lat, lng, miles);
>     System.out.println("Tier: " + shape.getTierLevel());
>     System.out.println("area: " + shape.getArea().size());
>
>     lat = 30;
>     lng = 100;
>     shape = cpfb.getBoxShape(lat, lng, miles);
>     System.out.println("Tier: " + shape.getTierLevel());
>     System.out.println("area: " + shape.getArea().size());
>   }
>
> -Grant
>

No.
The longitude has an effect because of the projection used to go from a
spherical world to a flat coordinates system.
See http://www.nsshutdown.com/projects/lucene/whitepaper/locallucene_v2.html
 and http://en.wikipedia.org/wiki/Sinusoidal_projection

You can clearly see that all longitude are not equals in terms of number of
boxes.

You could ask why using Sinusoidal projection ? Because it is does not have
to  much distance distortion in populated places and it is very simple to
calculate.

Hope it helps.

Nicolas

Mime
View raw message