Search code examples
fiwarefiware-orion

Fiware Orion: Geoqueries do not work for geojson polygons, only points seem to work


I am having issues with a geo query, it seems only to work if the stored entity location geojson type is of type "Point", but not for polygons.

I am running Orion 2.5.2 in docker

I tested both near

https://{{orion}}/v2/entities/?type=Building&georel=near;maxDistance:2000&geometry=point&coords=51.706774495,8.776277548

and also intersects/coveredBy:

https://{{orion}}/v2/entities/?type=Building&georel=intersects&coords=51.70683451303916,8.77602696418762;51.706462195326104,8.776386380195618;51.70663838176868,8.776847720146177;51.706965820787424,8.776482939720154;51.70683451303916,8.77602696418762&geometry=polygon

but orion always returns empty results for the example entry: I could not find any hints in the spec nor the orion manual that this only works for points. Seems like a bug to me

{
  "id": "urn:ngsi-ld:Building:1",
  "type": "Building",
  "location": {
    "type": "geojson",
    "value": {
      "type": "Polygon",
      "coordinates": [
        [
          [8.776530571, 51.706858417],
          [8.776277548, 51.706774495],
          [8.776343457, 51.706697699],
          [8.77633707, 51.706695601],
          [8.776363068, 51.706665196],
          [8.776369454, 51.706667303],
          [8.776457838, 51.706563935],
          [8.776710906, 51.706647506],
          [8.776620847, 51.706753038],
          [8.776627233, 51.706755145],
          [8.776605064, 51.706781115],
          [8.776598678, 51.706779008],
          [8.776530571, 51.706858417]
        ]
      ]
    }
  }
}

Solution

  • I could solve it. Turns out I had type "geojson" instead of "geo:json". Changing to the latter works now.