0

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.

AngelsandDemons
  • 2,823
  • 13
  • 47
  • 70
  • Are you talking about using the JTS plugin inside Lucene? – John Powell Dec 08 '14 at 07:35
  • Don't really know.. But I need to understand if the usecase I am trying to achieve is even possible or not using Lucene ?. I guess JTS needs to be imported in case I am using polygon geometry. – AngelsandDemons Dec 08 '14 at 08:20
  • Point in polygon for this number/size of polygons would be considered a fairly trivial use case of JTS. – John Powell Dec 08 '14 at 10:16
  • Do you mean to say it won't produce the output..Without lucene it is taking 1 hour both using MySQL spatial methodology and custom implementation of RayCrossing algorithm. With lucene I expect the execution time to go down, – AngelsandDemons Dec 09 '14 at 08:57
  • Before going down the Lucene route, have you considered converting your geometry to MySQL geometry, ie, a point and using Contains or Intersects with a spatial index. This kind of query should take milliseconds with a properly setup spatial index. Ray tracing is reinventing the wheel, imho. – John Powell Dec 09 '14 at 09:04
  • See this post for some pointers, http://stackoverflow.com/questions/25232316/table-structure-for-geo-spatial-data/25237180#25237180. I am not saying don't use Lucene, more that you should optimize your existing solution first. – John Powell Dec 09 '14 at 09:07
  • Yes I am using MYSQL geometry and ST-Contains function to achieve this. However with so much of data, MYSQL is taking approx 1 hour to give me the complete output. Hence I was wondering if using Lucene will reduce the time taken. – AngelsandDemons Dec 09 '14 at 10:49
  • had gone through the post when I was exploring why to use MySQL for this spatial analysis.. – AngelsandDemons Dec 09 '14 at 10:51

0 Answers0