Avoiding the common pitfalls of GIS scripting
Daniel Silk | Senior Location Data Analyst
This work is licensed under a Creative Commons Attribution 4.0 International License.
Geospatial
LINZ Data Service
Geodetic
Survey and Titles
Valuation
Topographic
Hydrographic Charts
Notices to Mariners
Overseas Investment
Electoral Support
Place Names
Crown Land, River and Lake Bed
High Country Pastoral Leases
Started using PostgreSQL / PostGIS
- Free with great community support
- QGIS 0.1 for visualisation
Internal application development
- Cadastral adjustment blocks
PostGIS data store
QGIS 2.6 deployed via Citrix environment
- accessible to every LINZ staff member
More internal application development
- Place names (gazetteer)
More internal application development
- Address points
- Roads
Advanced selection tools
WFS provider rewrite
Delimited text plugin rewrite
WMTS rendering improvements
Various plugins
- produce Topo50 / Topo250 map series
- historically, data a by-product of map production
- now key national datasets available for re-use
- existing map data captured with 1Spatial software
- As a [role] I want to [feature] so that [reason]
- As a [topographic data analyst] I want to [identify all unnamed roads under 300m] so that [I can check that those roads are suitable for a Topo50 map]
- I can choose which layer to run the script against
- All roads in the output are unnamed
- All roads in the output are shorter than 300m
- The output is provided as a geopackage
- The output retains all of the attributes of the input
shapefile
- Spatial professionals often end up scripting something
- But no version control?
- Visible, enables collaboration
- Manage production vs dev versions
- Easily compare any code state - easy debugging
- Heaps of free courses online
- So worth paying for structured training if possible
- Maintain a version number somewhere in your code
- Format: MAJOR.MINOR.PATCH
- Branch for each minor release
- release-0.2
- release-1.0
- Maintain a list of notable changes for each version
- Split into subsections e.g. Added / Changed / Fixed
- Maintain an Unreleased section too!
- Check against acceptance criteria
- Frequent demos allow for fast fails
- Acceptance criteria are a good place to start
- Running tests in QGIS got tedious
- Enter the Script Assistant plugin
- What are other people in the QGIS community doing?
- Allows plugin tests to be automated to run in a real instance of QGIS
- Support for QGIS 2.14 / 2.18 / 2.99
slides
slides.com/dwsilk/flip-the-script
other resources
github.com/linz/qgis-scriptassistant-plugin
github.com/boundlessgeo/qgis-testing-environment-docker
contact
@dwsilk on The Spatial Community (Slack channel)
spatialcommunity.org
slides
slides.com/dwsilk/flip-the-script
other resources
github.com/linz/qgis-scriptassistant-plugin
github.com/boundlessgeo/qgis-testing-environment-docker
contact
@dwsilk on The Spatial Community (Slack channel)
spatialcommunity.org
This work is licensed under a Creative Commons Attribution 4.0 International License.