To support easy use of the data in map applications the datagarden API provides access to the GeoJSON data for all regions for which public GeoJSON data is available. GeoJSON is a widely used format for representing spatial data and is supported by most mapping applications.
You can retrieve the geojson for a region by adding the include_geojson=y when requesting the region object.
# retrieve Country resource with geojson
>>> url = "https://www.the-datagarden.io/country/netherlands/?include_geojson=y"
>>> headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer <access_token>'}
>>>
>>> response = requests.request("GET", url, headers=headers)
>>> print(response.json())
The response on this request will now include a geojson entry. The geojson data is returned in a standard GeoJSON format and can be used in directly in mapping applications and or spatial queries queries. For most regions the geojson will be a MultiPolygon but for the smaller regions it can also be a Polygon.
{
"geojson": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
7.194591,
53.245022
],
...
]
]
]
}
}