I'm working on a progression where my ultimate goal is to be able to generate connected components of vertices that are within some proximity of each other. Ideally, I'd have two sets of vertices, A and B where vertices va and vb come from A and B respectively. I'd like to generate edges (va,vb) if dist(va,vb) is under some threshold.
Building up to this, the first thing I'm trying to do is identify which vertices are within 2km of some named vertex. The dataset that I put together for this has the locations of a few of the nazca lines geoglyphs in Peru that I found using Google Earth: Name,Location Hummingbird,"POINT(-75.148892 -14.692131)" Monkey,"POINT(-75.138532 -14.706940)" Condor,"POINT(-75.126208 -14.697444)" Spider,"POINT(-75.122381 -14.694145)" Spiral,"POINT(-75.122746 -14.688277)" Hands,"POINT(-75.113881 -14.694459)" Tree,"POINT(-75.114520 -14.693898)" Astronaut,"POINT(-75.079755 -14.745222)" Dog,"POINT(-75.130788 -14.706401)" Wing,"POINT(-75.100385 -14.680309)" Parrot,"POINT(-75.107498 -14.689463)" The vertex class GeoGlyphWKT is created in this manner: CREATE CLASS GeoGlyphWKT EXTENDS V CLUSTERS 1 CREATE PROPERTY GeoGlyphWKT.Name STRING CREATE PROPERTY GeoGlyphWKT.Location EMBEDDED OPoint CREATE PROPERTY GeoGlyphWKT.Tag EMBEDDEDSET STRING CREATE INDEX GeoGlyphWKT.idxLocation ON GeoGlyphWKT (Location) SPATIAL ENGINE LUCENE I've looked over the help documentation <http://orientdb.com/docs/2.2.x/Spatial-Index.html> and have figured out do a rooted search if I directly enter the coordinates. For example looking for what's within 2km of the "Hands" geoglyph: SELECT *, $Distance AS Distance FROM GeoGlyphWKT LET Distance = ST_Distance_Sphere(Location, ST_GeomFromText('POINT(-75.148892 -14.692131)')) WHERE $Distance <= 2000 +----+-----+-----------+-----------------------+-----------+------------------+ |# |@RID |@CLASS |Location |Name |Distance | +----+-----+-----------+-----------------------+-----------+------------------+ |0 |#25:0|GeoGlyphWKT|OPoint{coordinates:[2]}|Hummingbird|0.0 | |1 |#25:1|GeoGlyphWKT|OPoint{coordinates:[2]}|Monkey |1990.4884419468854| +----+-----+-----------+-----------------------+-----------+------------------+ ... but I'd rather just do a named search where GeoGlyphWKT.Name = "Hands" ... So, I tried to follow the template that I used on the old-style indexes (see (1) in the stack overflow links at the bottom). I ended up with the following query which doesn't work: SELECT FROM GeoGlyphWKT LET Source = (SELECT FROM GeoGlyphWKT WHERE Name="Hands") WHERE ST_Distance_Sphere(Location, $Source.Location) < 2000 Error: com.orientechnologies.orient.core.exception. OCommandExecutionException: Error on execution of command: sql.select FROM GeoGlyphWKT LET Source = (SELECT FROM GeoGlyphWKT WHERE Name="Hands") WHERE ST_Distance_Sphere(Location, $Source.Location) < 2000 DB name="nazca-wkt.orientdb" Error: java.lang.NullPointerException Any suggestions on how to do this search would be great! Thanks! -William *Related stack overflow questions* 1. rooted spatial query with sub-select in OrientDB <http://stackoverflow.com/questions/40942434/rooted-spatial-query-with-sub-select-in-orientdb> - uses the older spatial index that omits the use of WKT. 2. Importing OPoint data into OrientDB 2.2.x using ETL from a CSV file <http://stackoverflow.com/questions/41027600/importing-opoint-data-into-orientdb-2-2-x-using-etl-from-a-csv-file> - For help with loading the WKT into a graph using the oetl.sh tool. -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
