Code Monkey home page Code Monkey logo

leipzig-giesst-treedata's Introduction

Leipzig Gießt – Tree Data

Please review the content of the README.md and adjust it to the project.

Prerequisites

Install & Development

Windows

QGIS

Local PostgreSQL

CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
  • alternatives
    • with Docker: docker run --name treedata-postgis -e POSTGRES_PASSWORD=treedata -d postgis/postgis
    • with Supabase (see below)

Miniconda

Linux

Miniconda

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh
rm ./Miniconda3-latest-Linux-x86_64.sh

All

Miniconda

  • change to folder containing this locally checked out Git repo
conda update conda
conda create -n treedata
conda activate treedata
conda install pip
pip install -r requirements.txt
  • install GDAL
conda install -c conda-forge gdal
  • support for gdalwarp
conda install -c conda-forge krb5
pip install gssapi
gdalwarp -v

Troubleshooting

  • error when executing gdalwarp -v: gdalwarp: error while loading shared libraries: libpoppler.so.126: cannot open shared object file: No such file or directory
    • solution: conda install -c conda-forge gdal libgdal tiledb=2.2
  • error while converting WFS XML to GeoJSON (e.g. city shape): fiona._err.CPLE_AppDefinedError: PROJ: internal_proj_create: no database context specified
    • solution: remove environments via unset PROJ_LIB and unset GDAL_DATA as they conflict

PyCharm

Next steps

  • copy resources/sample.env to resources/.env
    • set your (locally) PostgreSQL connection data

Local Supabase

resources/.env

PG_SERVER=localhost
PG_PORT=54322
PG_USER=postgres
PG_PASS=postgres
PG_DB=postgres
  • run supabase status in musterstadt-giesst-api and add the values
SUPABASE_URL=<API URL, e.g. http://localhost:54321>
SUPABASE_BUCKET_NAME=<create new public bucket under http://localhost:54323/project/default/storage/buckets and name it e.g. "radolan_data" and use this name here>
SUPABASE_SERVICE_ROLE_KEY=<service role key)

and

MAPBOXUSERNAME=<username as displayed in https://account.mapbox.com/ under "Account" on the right upper side>
MAPBOXTOKEN=<create secret access token as described here https://docs.mapbox.com/help/tutorials/upload-curl/#getting-started>
MAPBOXTILESET=<create new tileset under https://studio.mapbox.com/tilesets/ and the copy tile set id and use it here>

Demo

  • Download trees Shapefile file to geojson: python ./treedata/main.py trees-shp
    • process local shp file: python ./treedata/main.py trees-shp --skip-download-shp --shp-file-name strassenbaumkataster_leipzig
    • command with all options: python ./treedata/main.py trees-shp --shp-url <Shapefile-URL> --source-encoding iso-8859-1 --shp-file-name shp --geojson-file-name trees --skip-download-shp --skip-convert-to-geojson
  • Process trees: python ./treedata/main.py trees_process
    • process specific trees geojson (from resources/trees): python ./treedata/main.py trees_process --trees-geojson-file-name s_wfs_baumbestand_2023-07-23
    • command with all options: python ./treedata/main.py trees_process --city-shape-geojson-file-name city_shape --trees-geojson-file-name trees --geojson-file-name trees-transformed --database-table-name trees_tmp --skip-transform --skip-store-as-geojson --skip-upload-to-db
    • store as file only: python ./treedata/main.py trees_process --city-shape-geojson-file-name city_shape --skip-upload-to-db --trees-geojson-file-name s_wfs_baumbestand_2023-07-15
    • store in db only: python ./treedata/main.py trees_process --skip-transform --skip-store-as-geojson --trees-geojson-file-name trees_transformed --database-table-name trees_tmp
  • Process weather data (under Windows run these commands in Anaconda Prompt (miniconda3) console): python ./treedata/main.py weather
    • command with all options: python ./treedata/main.py weather --start-days-offset 2 --end-days-offset 1 --city-shape-geojson-file-name city_shape-small --city-shape-buffer-file-name city_shape-small-buffered --city-shape-buffer 2000 --city-shape-simplify 1000 --skip-buffer-city-shape --skip-download-weather-data --skip-polygonize-weather-data --skip-join-radolan-data --skip-upload-radolan-data --skip-update-tree-radolan-days --skip-upload-geojsons-to-s3 --skip-upload-csvs-to-s3 --skip-upload-csvs-to-mapbox
    • only join radolan shp files: python ./treedata/main.py weather --skip-download-weather-data --skip-unzip-weather-data --skip-buffer-city-shape --skip-polygonize-weather-data
    • only upload radolan geojson file: python ./treedata/main.py weather --skip-download-weather-data --skip-unzip-weather-data --skip-buffer-city-shape --skip-polygonize-weather-data --skip-join-radolan-data

leipzig-giesst-treedata's People

Contributors

joergreichert avatar julizet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.