Description
The new geotile_grid
, as well as the older geohash_grid
return bucket keys in an algorithm-specific format. This make adaption slower because it requires each client to have a copy of the key decoding algorithm in order to figure out the extent of each bucket.
I would like to propose for all geo grids to include an additional value for each bucket - the geometry of the bucket. For example, if the bucket is a rectangular shape (geotile_grid
, geohash_grid
, pluscode_grid
, etc), the response would look like this:
{
"key": "0/0/0", // geotile_grid key representing the whole world
"geo": [[-180,-90],[-180,90],[180,90],[180,-90]], // GeoJSON-encoded four corners
"count": 42,
}
For the non-rectangular geo grids like geohex_grid
, the "geo"
value would look different, e.g. have 6 geo points for the hex cell.
Benefits: simpler client - rapid developer adaption because there is no need to decode complex key into geoshape, client does not have to know the details of the hashing algorithm.
Cons: slightly larger resultset (each bucket will have at least 4 lat/lng pairs)
Optionally, we could make this into an by-request feature - e.g. the user has to request extra geo data with an optional request parameter.