Skip to content

Updating Cluster Zone Shapes

zaven edited this page Oct 15, 2020 · 7 revisions

Testing new cluster regions locally - new, streamlined process

  1. Create desired cluster shape features in QGIS
  2. Use field calculator create and save a unique, serial column called 'gid' based on row number
  3. Export the shapefile as a postgres SQL file
    1. Check that gid field is exported
    2. IMPORTANT: set 'geometry name' parameter to 'geom'
    3. IMPORTANT: set 'schema' parameter to 'import'
  4. Use a modified version of update_region.sh to process and load this SQL file into local postgres/postgis
  5. View the locally running version of the treetracker web map to assess cluster regions

Testing new cluster regions locally - legacy process

  1. Create desired cluster shape features in QGIS
  2. Decided if you want to backed up database locally so you have a restore point
  3. Save shapefile from QGIS into postgis as new table in import schema
    1. Drop temporary table if already exists for this database session
  4. Copy new table to temporary table and prepare that data
  5. Insert or check that region type exists
  6. Delete existing region data if necessary
  7. Insert regions, update centroids, insert zoom levels
  8. Rebuild tree region data
  9. Refresh materialized view

Publishing shapes for test and production

After determining that cluster shape features work well locally, export the shape files and store them on github

  1. Somehow we get the pgsql dump of our new shapefile
    1. File type is '??'
    2. CRS is EPSG:4326
  2. Filename is going to be {descriptive_text}zoom_levels{zoom levels this is for}.pgsql
  3. tar and gzip this file into an archive
    1. tar -cvzf {filename}.pgsql.tar.gz {filename}.pgsq
  4. upload this file into github
    1. https://github.com/Greenstand/treetracker-gis
  5. upload a tar.gz of the shapefile source itself

Deploying shapes into a test and production

  1. https://github.com/Greenstand/treetracker-database/blob/master/main/sql/update_region/update_regions.sh