Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/dbca-wa/ckan-docker into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
MarkCalvert committed Apr 30, 2024
2 parents c1968b5 + 5792a24 commit 14c5fc0
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion spatial_data/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,37 @@

This directory is used to store GeoJSON files that will be loaded from docker entrypoint file `02_setup_dbca.sh` using the CLI command `ckan -c $CKAN_INI dbca load_spatial_data` if the mapping exists in `ckanext.dbca.spatial_data_mapping`.

## Creating the data files

As each base layer can have many rows per named feature, it is important that we convert this to a dataset that contains only one row for each named feature. The base layers can have many rows because some features are naturally separate from one another, such as the polygon for an island in the same named feature as that on the mainland.

| Layer Name | Agency Layer Name | Property for Label | Property for Code | Output Filename |
|------------------------|-----------------------------------|--------------------|-------------------|-------------------------|
| IBRA Regions | IBRA Vegetation (Subregions) - WA | IWA_REG_NAME_7 | IWA_REG_CODE_7 | ibra-regions.geojson |
| IBRA Subregions | IBRA Vegetation (Subregions) - WA | IWA_SUB_NAME_7 | IWA_SUB_CODE_7 | ibra-subregions.geojson |
| IMCRA Regions | IMCRA Regions (Australia) | MESO_NAME | MESO_ABBR | imcra-regions.geojson |
| Local Government Areas | Local Govt. Authorities (LGA) | LGA_LGA_NAME | LGA_TYPE | lga-wa.geojson |
| DBCA Managed Tenure | Managed Tenure | LEG_NAME | LEG_TENURE | tenure.geojson |

For each layer:

1. Firstly, we must convert the layer into a single row for each unique label-polygon instance. We accomplish this by using the “Dissolve” command in QGIS.
1. With the new temporary layer selected, choose <kbd>Vector > Geoprocessing Tools > Dissolve…</kbd> from the menu.
2. Select the layer property for the label for the newly created temporary layer (see the table above) to tell QGIS which attribute to “unique” on.
3. Run the command.

2. Secondly, we must simplify each polygon in a layer so it takes up less than 1 MB per polygon. We accomplish this by using the “Simplify” command in QGIS.
1. Open one of the target layers (above) in QGIS, then select <kbd>Vector > Geometry Tools > Simplify…</kbd> from the menu.
2. While the layer is selected in the Layers window, choose <kbd>Distance (Douglas-Peucker)</kbd> from the <kbd>Simplification</kbd> method dropdown and use a tolerance of <kbd>0.05</kbd>. Leave the other options as they are to generate a temporary layer.
3. Run the command.

3. Lastly, export the resulting layer to GeoJSON.

1. Right-click the layer in the Layer window and choose <kbd>Export > Save Features As…</kbd> from the popup menu.
2. Give the file a name, e.g. <kbd>ibra-subregions.geojson</kbd> matching the above name in the Output Filename column.
3. Run the command.
4. Archive the file to zip, e.g. <kbd>ibra-subregions.zip</kbd>.

## Usage

To add a new GeoJSON file, simply place it in this directory. The ckan-worker container will automatically load any files on deployment if there is a corresponding mapping defined in `ckanext.dbca.spatial_data_mapping`.
Expand Down Expand Up @@ -38,4 +69,4 @@ Example:
ReDeploy ckan-worker container or run CLI command in container ckan-worker to load spatial data
```
ckan -c $CKAN_INI dbca load_spatial_data
```
```

0 comments on commit 14c5fc0

Please sign in to comment.