gost / server

GOST - Go implementation of OGC SensorThings API
MIT License
61 stars 19 forks source link

Geo.intersects returns null #119

Closed bertt closed 7 years ago

bertt commented 7 years ago

sample:

$ curl http://localhost:8080/v1.0/Locations?$filter=geo.intersects(location, geography'POLYGON ((30 10, 10 20, 20 40, 40 40, 30 10))')

response:

{
   "value": null
}
tebben commented 7 years ago

Works on my machine

bertt commented 7 years ago

i've got the following 2 locations in the db:

{
   "@iot.count": 2,
   "value": [
      {
         "@iot.id": 2,
         "@iot.selfLink": "http://localhost:8080/v1.0/Locations(2)",
         "name": "TestPoly",
         "description": "TestPoly",
         "encodingType": "application/vnd.geo+json",
         "location": {
            "coordinates": [
               [
                  [
                     100,
                     50
                  ],
                  [
                     10,
                     9
                  ],
                  [
                     23,
                     4
                  ],
                  [
                     100,
                     50
                  ]
               ],
               [
                  [
                     30,
                     20
                  ],
                  [
                     10,
                     4
                  ],
                  [
                     4,
                     22
                  ],
                  [
                     30,
                     20
                  ]
               ]
            ],
            "type": "Polygon"
         },
         "Things@iot.navigationLink": "http://localhost:8080/v1.0/Locations(2)/Things",
         "HistoricalLocations@iot.navigationLink": "http://localhost:8080/v1.0/Locations(2)/HistoricalLocations"
      },
      {
         "@iot.id": 1,
         "@iot.selfLink": "http://localhost:8080/v1.0/Locations(1)",
         "name": "bla",
         "description": "my backyard",
         "encodingType": "application/vnd.geo+json",
         "location": {
            "coordinates": [
               -117.123,
               54.123
            ],
            "type": "Point"
         },
         "Things@iot.navigationLink": "http://localhost:8080/v1.0/Locations(1)/Things",
         "HistoricalLocations@iot.navigationLink": "http://localhost:8080/v1.0/Locations(1)/HistoricalLocations"
      }
   ]
}
bertt commented 7 years ago

getting now different response (no null value):

{
   "value": []
}

whats your test geometry in db?

bertt commented 7 years ago

got the polygon using:

$ http://localhost:8080/v1.0/Locations?$filter=geo.intersects(location, geography'POLYGON ((-180 -90, -180 90, 180 90, 180 -90, -180 -90))')