Rules for coordinates?

Hi all,

Is there a way (in 2.28 or 2.29) to set up validation rules (or another approach) to ensure that when coordinates are captured or entered for an event, they are within the correct country boundaries? Like a min max rule for coordinates for example. Since the coordinates are built into the system (e.g. not a separate data element or attribute), I’m having trouble figuring it out.

Thanks,

Natalie T

Hi Natalie,

This is currently not supported, but sounds like an excellent feature. It would be useful if you could file an issue on the issue tracking system (jira.dhis2.org) and describe the use case in more detail.

Since DHIS2 now requires the use of PostGIS, I think there could be a couple of work arounds.

  1. You might consider to develop a custom JavaScript widget which would perform this check for you. (https://github.com/d3/d3-geo#geoContains) on the client.

  2. A server side script could probably also check for this quite easily, to at least identify if any points do not fall inside a given polygon using the st_contains function of PostGIS. (https://gis.stackexchange.com/questions/222465/how-to-check-a-set-of-points-are-inside-a-polygon-or-not-in-postgis)

Regards,

Jason

···

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049