How to use Lucene 4.0 Spatial API?



I cannot find any complete examples of how to use this API. The code below is not giving any results. Any idea why?


static String spatialPrefix = "_point";
static String latField = spatialPrefix + "lat";
static String lngField = spatialPrefix + "lon";
public static void main(String[] args) throws IOException {
SpatialLuceneExample spatial = new SpatialLuceneExample();
spatial.addData();
IndexReader reader = DirectoryReader.open(modules.getDirectory());
IndexSearcher searcher = new IndexSearcher(reader);
searchAndUpdateDocument(38.9510000, -77.4107000, 100.0, searcher,
module

Related to : How to use Lucene 4.0 Spatial API?
How to use Lucene 4.0 Spatial API?
Development Tools & Services

I cannot find any complete examples of how to use this API. The code below is not giving any results. Any idea why?


static String spatialPrefix = "_point";
static String latField = spatialPrefix + "lat";
static String lngField = spatialPrefix + "lon";
public static void main(String[] args) throws IOException {
SpatialLuceneExample spatial = new SpatialLuceneExample();
spatial.addData();
IndexReader reader = DirectoryReader.open(modules.getDirectory());
IndexSearcher searcher = new IndexSearcher(reader);
searchAndUpdateDocument(38.9510000, -77.4107000, 100.0, searcher,
module
Lucene Spatial Search for Point inside a polygon
7/12/2014 1:40 pm Development Tools & Services

I have a KML file which contains many latitudes/longitudes which make up

around 500 odd polygons (approx 6,000 points are present).

I also have a sample file which contains

latitude and longitude for the entire area of say a particular city. (approx 10 million odd points latitude/longitude)

I have been going around Lucene Spatial documentation from some time but I am unable to understand if it will serve the following purpose:

a. To find for each point whether it lies inside some polygon or not. (effectively a point can be either inside or outside all of the polygons) with close to 100% accuracy.

As of now, I have achieved this usecase by

implementing RayCrossing algorithm in Java

however

I am inclined to use Lucene

as I am already using it for number of other usecases. Additionally RayCrossing algorithm is slow for such a huge number of points.

Please advise. Please point to some code samples which can get me started on achieving the usecase if it's possible using Lucene.


Spatial lucene simple query doesn't work?
Development Tools & Services

does anyone have any experiences using the lucene's spatial search component (lucene 3.0)?


I tried a very simple example but could not get the search to return anything, see below for all the codes


import java.io.IOException;
import org.apache.lucene.analysis.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.Field.Index;
import org.apache.lucene.document.Field.Store;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.IndexWriter.MaxFieldLength;<
Lucene 4.0 spatial calculate max. distance dynamically (using indexed documet's field)
Development Tools & Services

It is possibile to to make query where max distance dist is calculated dynamically, depending on what is a field connected with a document being searched.


I mean something like:


ctx.makeCircle(la, lo, DistanceUtils.dist2Degrees(Min(100km, currentDocumnet.getField("max_distance")),DistanceUtils.EARTH_MEAN_RADIUS_KM))

Instead of:


new SpatialArgs(SpatialOperation.Intersects,ctx.makeCircle(la, lo, DistanceUtils.dist2Degrees(dist,DistanceUtils.EARTH_MEAN_RADIUS_KM)));

To get the results I want I'm doing some manual filtering on my ScoreDoc:





HD Wallpapers
3D
3D Abstract
City
Celebrities
Indian Celebrities
Cars
Travel
Girls
Animals Birds
Movies
Sports
Black White
Nature
Planes
Anime
Food Drink
Dreamy Fantasy
Architecture
Games
Space
Holidays
Flowers
Love
Artistic
Baby
Beach
Bikes Motorcycles
Macro
Computers
Vector
Funny
Army
Textures
Brands
Misc
Music
Other
Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .