Hi,
I've been trying to evaluate the use of OrientDB for our spatial data.
I'm using the following version:
OrientDB: orientdb-community-2.2.0-20160217.214325-39
OrientDB-Spatial: JAR built from develop branch of the github Repo
OS: Win7 64Bit
Right now what I was to do, is if I have polygons stored in the db, and the
input is a location (latitude & longitude) then I need to get the polygon
which contains that location.
I created a Class to store the State polygons like this:
CREATE class state
CREATE PROPERTY state.name STRING
CREATE PROPERTY state.shape EMBEDDED OPolygon
I Inserted a State with the following command:
INSERT INTO state SET name = 'Center', shape =
ST_GeomFromText('POLYGON((77.16796875 26.068502530912397,75.7177734375
21.076171072527064,81.650390625 19.012137871930328,82.9248046875
25.196864372861896,77.16796875 26.068502530912397))')
I've tried several ways of getting the state which contains the given
latlong, but all of them give error.
Even something as simple as:
SELECT from state WHERE ST_Contains(shape,
ST_GeomFromText('POINT(77.420654296875 23.23929558106523)'))
Gives the following error:
com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error on
parsing command at position #0: Error parsing query: SELECT from state
WHERE ST_Contains(shape, ST_GeomFromText('POINT(77.420654296875
23.23929558106523)')) Encountered "" at line 1, column 25. Was expecting
one of: Storage URL="plocal:E:/DevTools/OrientDB2.2_new/databases/spatial"
Storage URL="plocal:E:/DevTools/OrientDB2.2_new/databases/spatial" -->
com.orientechnologies.orient.core.sql.OCommandSQLParsingException:
Encountered "" at line 1, column 25. Was expecting one of: Storage
URL="plocal:E:/DevTools/OrientDB2.2_new/databases/spatial"
I can run all the spatial functions when I enter the geometries directly in
the spatial function, such as:
Select ST_Contains(ST_geomFromText('POLYGON((77.16796875
26.068502530912397,75.7177734375 21.076171072527064,81.650390625
19.012137871930328,82.9248046875 25.196864372861896,77.16796875
26.068502530912397))'), ST_GeomFromText('POINT(77.420654296875
23.23929558106523)'))
I just can't figure out how to get these function to run on shapes which
are stored as properties on records.
How are the geometries which are stored, to be used in these spatial
functions? Is there some other syntax for doing so?
--
---
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.