GML Files

Can i get some GML file sample that can import in DHIS2. I want to make a GML file for my country OUs but i dont know how to make one? Is GML file is some .gml file like that or else?

Hi Muhammad,

Actually, the GML route is not strictly necessary, and quite cumbersome, as it involves a number of tools. I strongly suggest you rather work with Sushil Chitrakar (copied) and try his App which takes care of both properly formatting and importing shapefiles directly. Sushil can guide you through all the steps, and will also be grateful for any feedback on the App and the process.

Regards,

Knut

···

On Fri, Apr 10, 2015 at 9:32 AM, Muhammad Bilal Siddqui m.bilalsiddqui@micromerger.com wrote:

Can i get some GML file sample that can import in DHIS2. I want to make a GML file for my country OUs but i dont know how to make one? Is GML file is some .gml file like that or else?


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

Hi Muhammad,

I recently made a .gml file for a Sri Lankan project which involved over 14500 org units. Since you have not specified, I hope you must be already having the org units setup in your DHIS2 instance. In that case you can follow the method below. Most of this detail is in user manual.

  1. You need to have shape files for the org units your gonna use. Make sure shape file attributes have a field which bears the same org unit name that relates to the geographic boundary in the shapefile.

  2. You need to use a tool called mapshaper. (http://mapshaper.org). you should select the shape file you want to extract GIS location data from. once uploaded it will preview the geographic boundary related to that shape file.

  3. drag and drop .dbf file that comes with the shape file on to the mapshaper window. it contains all attribute data. Then you can drag the slider to a percentage of your choice. (lesser the percentage, less detailed the boundaries will appear. if you slide it to very low levels make sure “prevent shape removal” option is ticked, otherwise you will lose smaller org units during the process.

  4. once done you should download the shape file that is generated. it will have lesser detailed GIS data which will make a smaller .gml file

  5. if you are on windows download FWTools (http://fwtools.maptools.org/). You have to make sure the GIS cordinates of your shafiles are in then in EPSG:4326(WGS84 in arcgis), otherwise the final .gml file will have misplaced orgunits. open console window and user ogr2ogr to generate .gml file from shape file as follows

**ogr2ogr -f GML filename.gml filename.shp**

you may have to add additional parameters if your coordinates are not in (EPSG:4326)

  1. This will generate the .gml file. .gml file is an xml file it has various tags representing attributes that came with shapefile and .dbf file. you can open .gml file from notepad or notepad++.

  2. then find the attribute data equivalent to the data bearing org unit name in your DHIS2 instance. following is a part of my .gml file

gml:featureMember
<ogr:sl_moh_gn_wgs84 fid=“F575”>
ogr:geometryProperty<gml:Polygon srsName=“EPSG:4326”>gml:outerBoundaryIsgml:LinearRinggml:coordinates80.526509481818522,6.037236515074813 80.527137163010295,6.036849434859485 80.526354327120274,6.036559412410804 80.526509481818522,6.037236515074813</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
ogr:OBJECTID_1576</ogr:OBJECTID_1>
ogr:PROVINCE_NSOUTHERN</ogr:PROVINCE_N>
ogr:PROVINCE_C3</ogr:PROVINCE_C>
ogr:DISTRICT_NMATARA</ogr:DISTRICT_N>
ogr:DISTRICT_C2</ogr:DISTRICT_C>
ogr:DSD_NTHIHAGODA</ogr:DSD_N>
ogr:DSD_C36</ogr:DSD_C>
ogr:GND_NO349A</ogr:GND_NO>
ogr:GND_NNarangala</ogr:GND_N>
ogr:GND_C090</ogr:GND_C>
ogr:MC_UC_PS_NThihagoda PS</ogr:MC_UC_PS_N>
ogr:AREA1514070.7600000000</ogr:AREA>
ogr:ORIG_FID0</ogr:ORIG_FID>
ogr:SHAPE_LENG387.5145839710</ogr:SHAPE_LENG>
ogr:SHAPE_LE_1387.5145839710</ogr:SHAPE_LE_1>
ogr:MOH_NTHIHAGODA</ogr:MOH_N>
ogr:OBJECTID0</ogr:OBJECTID>
ogr:SHAPE_LE_20.0000000000</ogr:SHAPE_LE_2>
ogr:RDHSMATARA</ogr:RDHS>
ogr:SHAPE_LE_3387.5145621700</ogr:SHAPE_LE_3>
ogr:SHAPE_AREA9244.0032229500</ogr:SHAPE_AREA>
</ogr:sl_moh_gn_wgs84>
</gml:featureMember>

In above example “GND_N” is the metadata holding my org unit name … So you need to find and replace all “GND_N” to “Name”. following is the one after replacement.

gml:featureMember
<ogr:sl_moh_gn_wgs84 fid=“F575”>
ogr:geometryProperty<gml:Polygon srsName=“EPSG:4326”>gml:outerBoundaryIsgml:LinearRinggml:coordinates80.526509481818522,6.037236515074813 80.527137163010295,6.036849434859485 80.526354327120274,6.036559412410804 80.526509481818522,6.037236515074813</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
ogr:OBJECTID_1576</ogr:OBJECTID_1>
ogr:PROVINCE_NSOUTHERN</ogr:PROVINCE_N>
ogr:PROVINCE_C3</ogr:PROVINCE_C>
ogr:DISTRICT_NMATARA</ogr:DISTRICT_N>
ogr:DISTRICT_C2</ogr:DISTRICT_C>
ogr:DSD_NTHIHAGODA</ogr:DSD_N>
ogr:DSD_C36</ogr:DSD_C>
ogr:GND_NO349A</ogr:GND_NO>
ogr:NameNarangala</ogr:Name>
ogr:GND_C090</ogr:GND_C>
ogr:MC_UC_PS_NThihagoda PS</ogr:MC_UC_PS_N>
ogr:AREA1514070.7600000000</ogr:AREA>
ogr:ORIG_FID0</ogr:ORIG_FID>
ogr:SHAPE_LENG387.5145839710</ogr:SHAPE_LENG>
ogr:SHAPE_LE_1387.5145839710</ogr:SHAPE_LE_1>
ogr:MOH_NTHIHAGODA</ogr:MOH_N>
ogr:OBJECTID0</ogr:OBJECTID>
ogr:SHAPE_LE_20.0000000000</ogr:SHAPE_LE_2>
ogr:RDHSMATARA</ogr:RDHS>
ogr:SHAPE_LE_3387.5145621700</ogr:SHAPE_LE_3>
ogr:SHAPE_AREA9244.0032229500</ogr:SHAPE_AREA>
</ogr:sl_moh_gn_wgs84>
</gml:featureMember>

  1. Once done you will have the completed .gml file that you can import to DHIS2. but better do a dry run first to exclude any org units that are duplicates/ignored etc.

hope this helps.

Regards,

Pamod

···

On Fri, Apr 10, 2015 at 1:25 PM, Knut Staring knutst@gmail.com wrote:

Hi Muhammad,

Actually, the GML route is not strictly necessary, and quite cumbersome, as it involves a number of tools. I strongly suggest you rather work with Sushil Chitrakar (copied) and try his App which takes care of both properly formatting and importing shapefiles directly. Sushil can guide you through all the steps, and will also be grateful for any feedback on the App and the process.

Regards,

Knut


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

On Fri, Apr 10, 2015 at 9:32 AM, Muhammad Bilal Siddqui m.bilalsiddqui@micromerger.com wrote:

Can i get some GML file sample that can import in DHIS2. I want to make a GML file for my country OUs but i dont know how to make one? Is GML file is some .gml file like that or else?


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

Pamod

Hi Sushil,

It will be very interesting to work with such an app. Can you please guide us for the app.

···

On Fri, Apr 10, 2015 at 1:25 PM, Knut Staring knutst@gmail.com wrote:

Hi Muhammad,

Actually, the GML route is not strictly necessary, and quite cumbersome, as it involves a number of tools. I strongly suggest you rather work with Sushil Chitrakar (copied) and try his App which takes care of both properly formatting and importing shapefiles directly. Sushil can guide you through all the steps, and will also be grateful for any feedback on the App and the process.

Regards,

Knut


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

On Fri, Apr 10, 2015 at 9:32 AM, Muhammad Bilal Siddqui m.bilalsiddqui@micromerger.com wrote:

Can i get some GML file sample that can import in DHIS2. I want to make a GML file for my country OUs but i dont know how to make one? Is GML file is some .gml file like that or else?


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

Thanks,
Neeraj Gupta

Thanks Sushil for your commitment.

Actually, to use GIS in any of the application we are working with shape files and converting shape files to GML files and then we are importing to DHIS2 which needs a number of tools but as per my understanding with Knut’s mail, with your app we can cut down the processes and tools.

I am eager to know about your app and would definitely like to use the app for future.

···

On Wed, Apr 15, 2015 at 2:58 PM, Sushil Chitrakar sushilchitr@gmail.com wrote:

Hello Neeraj,
yeah sure. Just let me know what you need, and the we can move ahead.

Regards,

Sushil

On 15 April 2015 at 15:11, Neeraj Gupta neeraj.hisp@gmail.com wrote:

Hi Sushil,

It will be very interesting to work with such an app. Can you please guide us for the app.

On Fri, Apr 10, 2015 at 1:25 PM, Knut Staring knutst@gmail.com wrote:

Hi Muhammad,

Actually, the GML route is not strictly necessary, and quite cumbersome, as it involves a number of tools. I strongly suggest you rather work with Sushil Chitrakar (copied) and try his App which takes care of both properly formatting and importing shapefiles directly. Sushil can guide you through all the steps, and will also be grateful for any feedback on the App and the process.

Regards,

Knut


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Thanks,
Neeraj Gupta

On Fri, Apr 10, 2015 at 9:32 AM, Muhammad Bilal Siddqui m.bilalsiddqui@micromerger.com wrote:

Can i get some GML file sample that can import in DHIS2. I want to make a GML file for my country OUs but i dont know how to make one? Is GML file is some .gml file like that or else?


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

Thanks,
Neeraj Gupta

Thanks Sushil,

I will surely get back to you with feedback and my queries if I will have any.

···

On Wed, Apr 15, 2015 at 3:12 PM, Sushil Chitrakar sushilchitr@gmail.com wrote:

Hello Neeraj,
yes you are right. With this email I am sending you the app. I hope this will head start the work.

So features and key notes:

  1. remove digits from the coordinates, ie. coordinates will have only 4 digits after .(eg: 23.33333333 -> 23.3333)
  1. display the dbf values
  1. allow user to map the columns with the columns in the DHIS2 database.
  1. automatically try to find the parent of each organisation units from the db, if not all user to select the parent.
  1. import the organisation units into the db with coordinates.

Things you need:

  1. Shaper files(.dbf and .shp) for each layer
  1. coordinates in the .shp file must be of projection EPSG:4326 in case of DHIS2

I have included the steps to follow after installing the app for importing:

  1. open the app.
  1. choose the level*.shp file. level*.shp file is the shape file that you have. First(zero level) is country
  1. now drag the corresponding .dbf file into the browser. ie dbf file of the country ( you can drag or upload both files at once aswell)
  1. after dragging the .dbf , adjust the detail of map you want to be imported using the slider in the browser. You can see slight changes in the map detail.
  1. now use the button Org Unit to display the list of org units in the .dbf file.
  1. in the same page, you choose column with the id of the org unit, its parent, name and short name and level of the organisation units. The columns for corresponding data are listed in the select box on top of table. For country since its a zero level, it does not have a parent, so do not choose anything. For other level like in the first level, development region , you need to choose the id of country or its parent there. After choosing all the mandatory fields the Map field button will be enabled.
  1. Use the map fields button to map the fields with the database and find the parent automatically on the basis of code.
  1. If the app finds the matching parent it will show up in the parent column. If not you will be allowed to choose the parent from the select box.
  1. Then choose the organisations units that you want to import. After choosing the at least one row from the list, import button will be displayed.
  1. then use import button to import the data into the dhis.
  1. If you want to see the GML data, please choose the “show GML text” check box. It will also display the GML data at the right side in a text box.
  1. now follow the same process again.

I hope that you can provided me some feedback on this app and help me work on this more and also for my thesis. Let me know if you have any issues installing the app or using it. One link that can be helpful for installing the app is: https://www.dhis2.org/doc/snapshot/en/developer/html/ch02s03.html

Please take a look on the work and also please send me some feedback how this app worked for you. What are the issues that you find with the GML, how this solved your problem if it did and your other remarks.

Regards,

Sushil

On 15 April 2015 at 15:22, Neeraj Gupta neeraj.hisp@gmail.com wrote:

Thanks Sushil for your commitment.

Actually, to use GIS in any of the application we are working with shape files and converting shape files to GML files and then we are importing to DHIS2 which needs a number of tools but as per my understanding with Knut’s mail, with your app we can cut down the processes and tools.

I am eager to know about your app and would definitely like to use the app for future.

On Wed, Apr 15, 2015 at 2:58 PM, Sushil Chitrakar sushilchitr@gmail.com wrote:

Hello Neeraj,
yeah sure. Just let me know what you need, and the we can move ahead.

Regards,

Sushil

Thanks,
Neeraj Gupta

On 15 April 2015 at 15:11, Neeraj Gupta neeraj.hisp@gmail.com wrote:

Hi Sushil,

It will be very interesting to work with such an app. Can you please guide us for the app.

On Fri, Apr 10, 2015 at 1:25 PM, Knut Staring knutst@gmail.com wrote:

Hi Muhammad,

Actually, the GML route is not strictly necessary, and quite cumbersome, as it involves a number of tools. I strongly suggest you rather work with Sushil Chitrakar (copied) and try his App which takes care of both properly formatting and importing shapefiles directly. Sushil can guide you through all the steps, and will also be grateful for any feedback on the App and the process.

Regards,

Knut


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Thanks,
Neeraj Gupta

On Fri, Apr 10, 2015 at 9:32 AM, Muhammad Bilal Siddqui m.bilalsiddqui@micromerger.com wrote:

Can i get some GML file sample that can import in DHIS2. I want to make a GML file for my country OUs but i dont know how to make one? Is GML file is some .gml file like that or else?


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

Thanks,
Neeraj Gupta