This is a small demo application using plotly's dash framework. Dash was chosen because it combines relatively simple and straight forward means for creating interactive react.js web apps and is still able to fulfill the requirements of this small application. Those requirements are:
- Upload GeoJSON files, containing geo-referenced features and their properties.
- Show uploaded features and their properties on a dynamic web map.
- Modify existing properties for features shown on the map.
- Save updated features with their properties to GeoJson file.
The application backend runs in a python environment, hence python should be available on your computer.
This application is best set up by is using a dedicated anaconda environment. Hence it is strongly recommended to have anaconda installed on the executing computer. All dependencies can be installed using the following conda command:
conda env create -q -n geoviewer python=3.10 -f environment.yml
Resolving dependencies can be quite slow. An alternative is using mamba instead of conda.
mamba env create -q -n geoviewer python=3.10 -f environment.yml
If conda is not available you can directly install the dependencies via pip.
Still, it is recommended to use some kind of isolated python environment
for example provided by virtualenv
or pipenv
.
python -m pip install .
If you have used the recommended anaconda command above you'd have to activate the environment first:
conda activate geoviewer
To start the application use the following command:
geojson-viewer --help
usage: geojson-viewer [-h] [--debug] [--port PORT] [-V]
View and manipulate geojson files
options:
-h, --help show this help message and exit
--debug
--port PORT The port the app should be running on. (default: 8050)
-V, --version show program's version number and exit
For example the command:
geojson-viewer --debug
will start the application in debug mode on port 8050. You can then open
the app via http://localhost:8050/
on your browser.
If the installation fails and you have access to docker on your machine you can use the fallback solution of creating a docker container and running the app inside the container. For example:
docker build -t geoviewer . && docker run -it --net=host geoviewer geojson-viewer --debug
Sample geojson data is provided in the repository (montreal_elections.geojson
)
the same data can also be accessed via the following url:
https://nextcloud.dkrz.de/s/keAxAjE5SMFQZ7C/download/montreal_elections.geojson