我正在使用功能内的GEO扩展到执行计划中。我有多个事件流,其中包含传感器信息,包括每个传感器的位置(在地理坐标中)。此外,我有一个多边形(下面的例子,其中包含每个点的坐标)。我想看看是否有可能确定传感器是否在这个多边形的边界内。
我的执行计划如下:
@Plan:name('TestExecutionPlan')
define stream sensorStream (id string, lat double, longi double);
define stream outputStream (id string);
from sensorStream [geo:within(lat,longi,{"type": "Polygon", "coordinates": [[[37.9807986, 23.7262081],[37.9807986, 23.7262081],[37.9792256, 23.7302850],[37.9789888, 23.7268089],[37.9807986, 23.7262081]]]})]
select id
insert into outputStream;当我在Siddhi中运行我的执行计划时,尝试WSO2CEP管理控制台的工具时,会发生以下错误:
您的SiddhiQL在第16:108行有一个错误,在输入‘geo: in (sensorStream.lat,sensorStream.longi,{'type':'Polygon',’坐标‘:[37.9807986,23.7262081,37.9807986,23.7262081,37.9792256,23.7302850,37.9789888,23.7268089,37.9807986,23.7262081]}}
我不知道为什么会发生这种错误。
如果有人能在这件事上帮助我,我将非常感激。
谢谢!
发布于 2017-04-26 11:52:10
我解决了错误。错误是存在的,因为它需要包含带有问号的{"type": "Polygon", "coordinates": [[[-104.05,48.99],[-97.22,48.98],[-96.58,45.94],[-104.03,45.94],[-104.05,48.99]]]},即"{"type": "Polygon", "coordinates": [[[-104.05,48.99],[-97.22,48.98],[-96.58,45.94],[-104.03,45.94],[-104.05,48.99]]]}",因为它是一个字符串值,正如它在Siddhi扩展(https://docs.wso2.com/display/CEP420/Geo+Extension)中的Geo : in函数中解释的那样。
因此,有效的执行计划如下:
@Plan:name('TestExecutionPlan')
define stream sensorStream (id string, lat double, longi double);
define stream outputStream (id string);
from sensorStream [geo:within(lat, longi, " { 'type': 'Polygon', 'coordinates': [[[37.9807986, 23.7262081],[37.9807986, 23.7262081],[37.9792256, 23.7302850],[37.9789888, 23.7268089],[37.9807986, 23.7262081]]] } " )]
select id
insert into outputStream;https://stackoverflow.com/questions/43540520
复制相似问题