segrada
segrada copied to clipboard
Add geographic shapes
Add geographic shapes to maps: lines and polygons.
Hm, Lucene 5.3 can work with complex shapes, using JTS Topology suite => https://lucene.apache.org/core/5_3_2/spatial/index.html
Question is, can OrientDB integate this? Testing this a bit now...
Ah, OrientDB can work with spatial stuff starting with version 2.2: http://orientdb.com/docs/2.2.x/Spatial-Index.html
So, this should actually work - uses the JTS stuff with WKT, as I see.
For testing, one can play a bit with collections:
OShapeFactory factory = OShapeFactory.INSTANCE;
ODocument odoc = factory.toDoc("GEOMETRYCOLLECTION (POINT (40 10), LINESTRING (10 10, 20 20, 10 40), POLYGON ((40 40, 20 45, 45 30, 40 40)))");
Shape shape = factory.fromText("GEOMETRYCOLLECTION (POINT (40 10), LINESTRING (10 10, 20 20, 10 40), POLYGON ((40 40, 20 45, 45 30, 40 40)))");
System.out.println(shape);
System.out.println(odoc);
Question is, how to index collections to OrientDB. OrientDB works with Lucene spatial indexes internally?
Ok, some hints here:
- https://stackoverflow.com/questions/39536706/lucene-5-5-3-spatial-indexing-with-recursive-prefix-tree-strategy
Possible problem:
- https://stackoverflow.com/questions/52302394/poor-lucene-in-memory-spatial-index-performance => yeah, JTS is old and quite slow, I have noticed that in Solr...
OrientDB documentation is a bit sparse here, I will need to test a bit...