Preparing location taxonomy and boundary geo files - kwantu/platformconfiguration GitHub Wiki

Preparing location taxonomy and boundary geo files

Step 1: Preparing taxonomy file

Taxonomies are being stored in kwantu_taxonomies bucket in CouchDB.

For location taxonomies, we named them as level00 (countries), level 01 (province or similar), level 02 (district or similar) so on...

For the first level of ttaxonomy structure is

{
  "_id": "level00_1", <taxonomy name><underscore><version number>
  "data": {
    "items": {
      "item": [
        {
          "lng": "67.709953" <This is the longitude for the state to represent with a pin location>,
          "lat": "33.93911" This is the latitude for the state to represent with a pin location,
          "code": "AF", <A code (ISO code if possible) for the location>
          "label": {
            "en": "Afghanistan" <Display name of the location>
          }
          
        },
        ....
        ....
        ....
        {
          "lng": "90.356331",
          "code": "BD",
          "label": {
            "en": "Bangladesh"
          },
          "lat": "23.684994"
        }
      ]
     }
  }
}

For the second level onwards structure of the file will be similar, however, to establish the mapping we use naming as

<taxonomy_name>_<version>_<parent_taxonomy_name>_<parent_version>_<code of parent for which this branch shows children>

For example: level01_1_level00_1_AF Here, level01 is the name of a taxonomy, which will list provinces and 1 is the version, followed by level00 as the parent taxonomy followed by its version, and finally "AF" as the code of Afghanistan, so that level01_1_level00_1_AF will list provinces in Afghanistan... similarly level01_1_level00_1_ZA will list provinces in South Africa and so on...

With the same logic, the next level will be named as: level02_1_level01_1_WC...

Step 2: Preparing geo file

The structure for the file is given below

{
  "_id": "<Location_Code>:geo",
  "feature": {
    "geometry": {
      "type": "Polygon",
      "coordinates": [[
          [
            18.951480036623252,
            -30.744439830321426
          ],....
          .....
          ....
          ]
    },
    "properties": {
      "editable": "false",
      "Name": "Matzikama(WC011 )", <name of the location>
      "layer": "Municipality", <name of the layer>
      "municId": "WC011", <code of the location>
       "code": "WC011" <code of the location>
    },
    "type": "Feature"
  }
}

In the above geo file, the naming convention maps this to a particular location... the name of the geo file is <LOCATION_CODE_AS_IN_TAXONOMY>:geo"

The geo file represents boundary in standard GeoJson format You can find more details about GeoJson here https://geojson.org/

The properties section holds the meta-information about the Geo file, we have placed some of the properties for our use... this section can be enhanced as needed.

One more important thing to note is that GeoJSON file structure can further hold geometry values in different formats... like decimal-degree, points, etc. We prefer to store these as decimal-degree. If you find the source file with a different format, there are some free online tools available to convert the data from one format to another. You can also use online GeoJson viewer to see the shape and verify the format of your file.

⚠️ **GitHub.com Fallback** ⚠️