The geoFeatures resource lets you retrieve geospatial information from DHIS2. Geospatial features are stored together with organisation units. The syntax for retrieving features is identical to the syntax used for the organisation unit dimension for the analytics resource. It is recommended to read up on the analytics api resource before continuing reading this section. You must use the GET request type, and only JSON response format is supported.
As an example, to retrieve geo features for all organisation units at level 3 in the organisation unit hierarchy you can use a GET request with the following URL:
To retrieve geo features for organisation units at level within the boundary of an organisation unit (e.g. at level 2) you can use this URL:
The semantics of the response properties are described in the following table.
|id||Organisation unit / geo feature identifier|
|na||Organisation unit / geo feature name|
|hcd||Has coordinates down, indicating whether one or more children organisation units exist with coordinates (below in the hierarchy)|
|hcu||Has coordinates up, indicating whether the parent organisation unit has coordinates (above in the hierarchy)|
|le||Level of this organisation unit / geo feature.|
|pg||Parent graph, the graph of parent organisation unit identifiers up to the root in the hierarchy|
|pi||Parent identifier, the identifier of the parent of this organisation unit|
|pn||Parent name, the name of the parent of this organisation unit|
|ty||Geo feature type, 1 = point and 2 = polygon or multi-polygon|
|co||Coordinates of this geo feature|
To export GeoJSON, you can simple add .geosjon as an extension to the endpoint /api/organisationUnits , or you can use the Accept header application/json+geojson .
Two parameters are supported level (defaults to 1) and parent (defaults to root organisation units), both can be added multiple times, some examples follow.
Get all features at level 2 and 4:
Get all features at level 3 with a boundary organisation unit: