The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Dissemination and Capacity Strengthening » Application Programming Interface (API)  » Problem opening geojsons using API
Problem opening geojsons using API [message #30672] Fri, 17 January 2025 10:42 Go to next message
oliver-fiala is currently offline  oliver-fiala
Messages: 4
Registered: June 2024
Member
I am familiarising myself at the moment with the possibility to call spatial boundary files for selected DHS surveys using the API (as described here: https://api.dhsprogram.com/#/api-geometry.cfm).

While this works fabulously for some surveys (eg, the suggested example http://api.dhsprogram.com/rest/dhs/geometry/SN2010DHS works well, both with QGIS as well as with geospatial tools in Stata), many other surveyIds or country codes (eg, BD2014DHS or BD or EG) produce errors with any programme, suggesting there are issues with the geojson. I was wondering if this is a known problem or if I am missing anything?
Re: Problem opening geojsons using API [message #30674 is a reply to message #30672] Fri, 17 January 2025 11:28 Go to previous messageGo to next message
admin is currently offline  admin
Messages: 53
Registered: November 2012
Senior Member
Administrator
Thank You Oliver, we are aware that there are some issues with the Geometry in the API. In the meantime, we suggest that you use the Spatial Data Repository to acquire the boundaries or the boundaries joined with survey data: https://spatialdata.dhsprogram.com/home/


We now have repositories of code written in Stata and SPSS available on Github. Please reference these code repositories as a resource for code for matching or calculating DHS indicators. The code repositories can be found at:

https://github.com/DHSProgram/DHS-Indicators-Stata
https://github.com/DHSProgram/DHS-Indicators-SPSS

Re: Problem opening geojsons using API [message #30675 is a reply to message #30674] Fri, 17 January 2025 11:37 Go to previous messageGo to next message
oliver-fiala is currently offline  oliver-fiala
Messages: 4
Registered: June 2024
Member
Thank you very much for your swift reply, that's good to know.

Do you mind posting an update here, once this has been addressed?

Many thanks!
Oliver
Re: Problem opening geojsons using API [message #30775 is a reply to message #30675] Tue, 25 February 2025 05:24 Go to previous messageGo to next message
dejawitting is currently offline  dejawitting
Messages: 2
Registered: November 2023
Member
Much obliged, Oliver. It has come to our attention that the API's Geometry isn't always up to scratch. While you wait, you can get the borders and other information from the Spatial Data Repository.
Re: Problem opening geojsons using API [message #30779 is a reply to message #30672] Mon, 03 March 2025 22:01 Go to previous messageGo to next message
Benjaminn is currently offline  Benjaminn
Messages: 1
Registered: March 2025
Member
oliver-fiala wrote on Fri, 17 January 2025 10:42
I am familiarising myself at the moment with the possibility to call spatial boundary files for selected DHS surveys using the API (as described here: https://api.dhsprogram.com/#/api-geometry.cfm geometry dash).

While this works fabulously for some surveys (eg, the suggested example http://api.dhsprogram.com/rest/dhs/geometry/SN2010DHS works well, both with QGIS as well as with geospatial tools in Stata), many other surveyIds or country codes (eg, BD2014DHS or BD or EG) produce errors with any programme, suggesting there are issues with the geojson. I was wondering if this is a known problem or if I am missing anything?
You are correct in observing that while the DHS Program's API provides access to spatial boundary files for certain surveys (e.g., SN2010DHS), attempts to retrieve geometry data for others, such as BD2014DHS, BD, or EG, result in errors. This issue has been acknowledged by the DHS Program.

[Updated on: Mon, 03 March 2025 22:02]

Report message to a moderator

Re: Problem opening geojsons using API [message #30839 is a reply to message #30672] Tue, 25 March 2025 00:03 Go to previous message
Rosbl is currently offline  Rosbl
Messages: 1
Registered: March 2025
Member
oliver-fiala wrote on Fri, 17 January 2025 10:42
I am familiarising myself at the moment with the possibility to call spatial boundary files for selected DHS surveys using the API (as described here: https://api.dhsprogram.com/#/api-geometry.cfm).

While this works fabulously for some surveys (eg, the suggested example http://api.dhsprogram.com/rest/dhs/geometry/SN2010DHS/agar io works well, both with QGIS as well as with geospatial tools in Stata), many other surveyIds or country codes (eg, BD2014DHS or BD or EG) produce errors with any programme, suggesting there are issues with the geojson. I was wondering if this is a known problem or if I am missing anything?
The API should generally provide valid GeoJSON for available surveys, but not all surveys have spatial boundary files released due to data confidentiality restrictions or availability issues. If a specific survey (e.g., BD2014DHS or EG) does not return a valid response, it is possible that the boundary files are not publicly available. You may want to check the DHS Spatial Data Repository or the survey's documentation for confirmation.
Previous Topic: Web Application Development Agency
Goto Forum:
  


Current Time: Fri Apr 4 13:13:38 Coordinated Universal Time 2025