Dear All,
Is there a way to pull facility geo coordinates using the API or any other method in DHIS2?
Would appreciate your help.
Thank you.
Dear All,
Is there a way to pull facility geo coordinates using the API or any other method in DHIS2?
Would appreciate your help.
Thank you.
Hi Dr. Okoye,
You can use the below api to pull facility geo coordinates:
baseUrl+âapi/organisationUnits.json?fields=id,code,name,latitude,longitude,coordinatesâ
In React JS you can fetch:
const fetchOptions = {
headers: {
Accept: âapplication/jsonâ,
Authorization: Basic ${btoa('admin:district')}
}
};
return new Promise( (resolve, reject) => {
fetch(baseUrl+âapi/organisationUnits.json?fields=id,code,name,latitude,longitude,coordinatesâ, fetchOptions)
.then(r => resolve(r.json()))
.catch(err => reject(err));
});
Thanks
Thank you. Will get back to you on this.
Hi Dr Okoye,
It might also be helpful to add âfeatureTypeâ, which helps you distinguish points from polygons/areas. See a similar discussion here.
Cheers, Sam.
Sure, just add â,levelâ to the list of fields. To see a full list of all fields available, you can do ?fields=* - this will return every available field (but Iâd remove â&paging=falseâ before you do that, as otherwise it will return a lot of data!).