FIWARE / context.Orion-LD

Context Broker and CEF building block for context data management which supports both the NGSI-LD and the NGSI-v2 APIs
https://www.etsi.org/deliver/etsi_gs/CIM/001_099/009/01.06.01_60/gs_CIM009v010601p.pdf
GNU Affero General Public License v3.0
50 stars 43 forks source link

Strange behavior of subscriptions with geoQ #1668

Open FR-ADDIX opened 1 month ago

FR-ADDIX commented 1 month ago

We are using the Orion-LD fiware/orion-ld:1.6.0 We have several thousand entities of type “AIS” in the Context Broker, some of them do not yet have a location, which is only built up over time. However, we do not want to query these but only the entities with a location should be considered.

Now we want a subscription that provides us with all objects within a distance of 600 m around a point.

As a query I would use

https://apis.captn.addix.io/ngsi-ld/v1/entities/?type=AIS&geometry=Point&coords=[10.162017,54.323833]&georel=near%3BmaxDistance==600&attrs=location,name

and get 3 objects returned. The result is perfect and fulfills all conditions.

Now we build a subscription that should deliver the same result. In this case, significantly more objects are returned, including objects that are not within the radius.

{ “id": ‘urn:ngsi-ld:subscription:d0d261c8-73ff-11ef-a9ee-eeed2df16c72’, “type": ‘Subscription’, “subscriptionName": ‘Notify AIS Geo’, “description": ‘AIS Geo’, “entities": [ { “idPattern": ‘CAPTN’, “type": ”AIS” } ], “geoQ": { “geometry": ‘Point’, “georel": ‘near;maxDistance==100’, “coordinates": [ 10.162017, 54.323833 ] }, “notification": { “attributes": [ }, “name”, “loaction” ], “format": ‘normalized’, “endpoint": { “uri": ‘http://node-red-captn.captn.svc/yvonnegeo’, “accept": ”application/json” } } }

Objects are also output that do not have a location at the moment, which we definitely do not want. We expect the same 3 objects here as for a query.

Are we doing something wrong, or is this an error?

kzangeli commented 1 month ago

Subscriptions with geolocation is not supported yet in the reimplementation the mongodb database layer. The geo-info is simplky ignored. Sorry about that, not a small thing and not bandwidth enough. I assume you start the broker with either "-experimental" or "-mongocOnly" (using the new db layer implementation). With the old implementation (still default) that uses the old legacy mongodb driver, this should work.

So, initial question, are you using the new db layer implementation?

ibordach commented 1 month ago

yes, because of mongodb 7

kzangeli commented 1 month ago

Ok, -mongocOnly then. I'm quite swamped right now. Not sure when I csn start with this. It's not a small thing. Care to contribute? ;)