← Back to team overview

dhis2-devs team mailing list archive

Info on GIS development

 

We are in the process of changing the GIS module in terms of how the
geographical information is persisted and presented.

In the snapshot version we now store the coordinates in JSON format directly
in the database on the OrganisationUnit.coordinates property. This gives us
a lot more flexibility in the way maps are presented.

Previously maps had to be registered explicitly either in the form of
GeoJson files or Shapefiles. Then the user had to select a map together with
indicator and period. Now the user can select an orgunit from a tree and the
children of that orgunit at the level below will be displayed in the map.

In large countries in India it is impossible to display a single map at the
lower levels (eg. for thousands of districts) as the map will be too heavy
and slow to load. Registering and managing maps for every e.g. provinces
will also be too cumbersome. With the current solution there is no more work
of registering and selecting maps - only the one time job of importing
geographical data/coordinates into the database.

Importing is a 4 step process:


*1.* Convert your shapefiles (or whatever format you have) into GML.

The recommended tool is FWTools, http://fwtools.maptools.org/ . The command
for converting shapefiles into GML is

ogr2ogr -F GML output.gml input.shp

(make sure you stand inside the folder containing the shape files)

Check available formats with the command ogr2ogr



*2.* Make sure the XML element inside the GML file which contains the
orgunit name is called exactly *ogr:Name* (use search and replace if not),
e.g.

<ogr:Name>Badjia</ogr:Name>


*3.* Import the GML file into DHIS through the regular import interface (no
need to zip it)


*4.* In the GIS module, make sure the Administrator - Map Source setting is
set to *DHIS database*.

In the Polygon Layer screen, you can then select the orgunit from the tree
which appears by clicking on the Parent orgunit field.


Caveat: Shapefiles tend to have duplicate orgunit names, at least at the
lower levels, which will cause the import to crash as DHIS requires unique
names. This will have to be taken care of in the GML/shapefile manually for
now, will see if we can handle this better in the future.

Feedback on this is appreciated as we hope to release soon. Using the module
with GeoJson as map source works as before.


Thanks to Jan and Bob for great work on GIS / import so far...


Lars

Follow ups