openstate / npo-backstage-examples

Example code and issue tracker for the NPO Backstage API
http://backstage-docs.npo.nl/
Creative Commons Zero v1.0 Universal
0 stars 2 forks source link

Geo Filters (bounding box, distance) #4

Open dsbaars opened 9 years ago

dsbaars commented 9 years ago

I'm missing geo-related filters like geo_bounding_box and geo_distance_range.

Example for NPO Journalistiek:

 {
    "filters": {
        "geo_bounding_box": {
            "Locations. GeoPoint": {
                "top_left": [52.1181, 5.7777],
                "bottom_right": [52.8542, 7.0728]
            }
        }
    }
}
siccovansas commented 9 years ago

Good point. There are currently just 408 items with locations (only in the journalistiek index), so at this moment we will not be adding this functionality. If geo-tagged items become more prominent in the future then we will reconsider this.

For now, we added a new function today to check if a field exists/contains a value (by posting an empty list to a filter of a field). You can use this to easily retrieve all items with locations:

curl -XPOST 'http://backstage-api.npo.nl/v0/journalistiek/search' -d '{"filters": {"Locations": []}}'