Go to file
tomasz t e960d21681 fixed taginfo project definition 2022-03-31 20:27:46 +02:00
.github/workflows cleaned up structure of the repo 2022-03-31 20:27:17 +02:00
web fixed taginfo project definition 2022-03-31 20:27:46 +02:00
.gitignore Prepare web to PWA installable app. 2022-01-22 18:05:53 +01:00
LICENSE Initial commit 2021-11-26 20:01:12 +01:00
README.md cleaned up structure of the repo 2022-03-31 20:27:17 +02:00
download_data.py removed download of custom_layer data 2022-03-27 01:44:55 +01:00
requirements.txt removed download of custom_layer data 2022-03-27 01:44:55 +01:00
taginfo.json fixed taginfo project definition 2022-03-31 20:27:46 +02:00

README.md

Mapa defibrylatorów AED

English: Map presenting locations of defibrillators based on OpenStreetMap data.

To repozytorium zawiera kod strony prezentujacej lokalizacje defibrylatorów AED.

Dane pochodzą z bazy OpenStreetMap, którą każdy może uzupełniać do czego chcemy zachęcić.

Informacje o defibrylatorach są zawyczaj udostępniane przez poszczególnych operatorów lub jednostki samorządowe. Przez taką fragmentację ciężej znaleźć takie urządzenia. OSM jest otwartym zbiorem danych i zawsze taki pozostanie, więc dane mogą być wykorzystywane przez inne aplikacje webowe i mobilne.

Poza pobieraniem danych bezpośrednio z OSM albo za pomocą usług jak Overpass API dane wyświetlane na stronie można pobrać w formacie:

Gitflow

branch 'development' -> branch 'main'

Branch 'development' jest hostowany pod: https://aed.openstreetmap.org.pl/dev/ a branch 'main' pod: https://aed.openstreetmap.org.pl/

Github actions robi deploy gdy pojawiają się nowe commity na tych branch-ach.

Nowe branche powinny być bazowane na 'development' i PR mergowane również do 'development'. Następnie PR z brancha 'development' do 'main'.

Technical information [ENG]

This is a simple static website using HTML and vanilla JavaScript. Any webserver (Nginx/Apache) or things like S3 or GitHub Pages can be used to host frontend part.

File js/osm-integration.js contains placeholders for OAuth1 tokens for OpenStreetMap application which are filled during deploy (this allows us to have both prod and dev environments one pointing to OSM DEV API one to osm.org).

The only thing that requires code execution is Python script that downloads data from Overpass API and converts it to GeoJSON and CSV files.

File requirements.txt contains packages used by python script. The script was updated to create additional layer from Google Sheets to before use you would need to comment out last line from download_data.py

Example CSV and GeoJSON files are uploaded to repo.

Scripts used to deploy on our server

Stack: Ubuntu/Nginx

Clone repo:

git clone --branch main --single-branch https://github.com/openstreetmap-polska/aed-mapa.git /home/aeduser/aed-mapa/

Command to deploy are in .github/workflows/ but they pretty much boil down to copying files to /var/www/.

Download new data (set crontab to run it periodically):

python3 /home/aeduser/aed-mapa/web/download_data.py /home/aeduser/data_dir/
cp /home/aeduser/data_dir/aed_poland.geojson /var/www/html/aed_poland.geojson
cp /home/aeduser/data_dir/aed_poland_metadata.json /var/www/html/aed_poland_metadata.json
cp /home/aeduser/data_dir/aed_poland.csv /var/www/html/aed_poland.csv

Alternatives / Inne podobne

Additional info about development

Editing style

You can use Maputnik editor to prepare new style for the map.

Steps:

  1. Open https://aed.openstreetmap.org.pl/maputnik/?layer=1311944204%7E0#6/52/20 (it's a copy of maputnik editor with newer version than what is available on the official site).
  2. If the AED map style has not been loaded click open and select it.
  3. Once finished click export and create PR or an issue with your style attached.

Creating sprites with icons

If you want to add new icons to the sprite sheet please place the SVG files in ./web/marker_icons/ folder.

SVG should be scaled to 50x50px size.

# install requirements (assumes NVM has been installed)
nvm use 8
npm install -g @mapbox/spritezero-cli
# create sprite for regular screens
spritezero --ratio 1 ./web/map_style/sprite ./web/marker_icons/
# create sprite for high-dpi screens
spritezero --ratio 2 ./web/map_style/sprite@2x ./web/marker_icons/