我试图了解如何使用pyorient在Orientdb 2.2.17中使用LUCENE Spatial查询。
我已经注意到如何选择如何从另一个类中选择多边形顶点内的点顶点类的所有属性。
Region Vertex Class有两个属性:
坐标(EMBEDDED OPolygon)LUCENE指数
CREATE CLASS Region EXTENDS V
CREATE PROPERTY Region.name IF NOT EXISTS STRING
CREATE PROPERTY Region.coordinates IF NOT EXISTS EMBEDDED OPolygon
CREATE INDEX Region.coordinates ON Region(coordinates) SPATIAL ENGINE LUCENE
指向顶点类,也有两个属性:
坐标(EMBEDDED OPoint)LUCENE指数
CREATE CLASS Point EXTENDS V
CREATE PROPERTY Point.station_name IF NOT EXISTS STRING
CREATE PROPERTY Point.coordinates IF NOT EXISTS EMBEDDED OPoint
CREATE INDEX Point.coordinates ON Point(coordinates) SPATIAL ENGINE LUCENE
现在,添加区域多边形点:
INSERT INTO Region SET name = 'region01', coordinates = St_GeomFromText("POLYGON ((13.178784796476098 59.058001210852922,14.161006039084404 59.058001210852922,14.176596852459138 58.122552408368826,13.178784796476098 58.122552408368826,13.178784796476098 59.058001210852922))")
添加点顶点:
INSERT INTO Point SET station_name = 0, coordinates = st_GeomFromText("POINT (13.459419437221328 58.808548196857167)")
INSERT INTO Point SET station_name = 1, coordinates = st_GeomFromText("POINT (14.332504986206489 58.605867622985606)")
INSERT INTO Point SET station_name = 2, coordinates = st_GeomFromText("POINT (13.724463264591824 57.779554514124655)")
INSERT INTO Point SET station_name = 3, coordinates = st_GeomFromText("POINT (12.617515514985637 58.66823087648455)")
我试过类似的东西和它的变化但失败了,这是查询示例:
SELECT from Point WHERE ST_WITHIN(coordinates, ST_AsText(SELECT coordinates FROM Region where name='region01')) = true
我收到以下错误,我在查询上尝试了不同的方法但没有成功。
解析查询时出错:从Point WHERE ST_WITHIN(坐标, ST_AsText(SELECT坐标FROM Region,其中name ='region01'))= true ^在第1行第25列遇到“”。期待其中一个:DB NAME = “envlay-DB”
预期的结果是检索多边形包含的station_name = 0的点。
非常感谢任何帮助。
)
Jobel