pull/110/head
admire 2021-02-13 22:19:07 +02:00
rodzic 2c6d0f67b0
commit ce4af9794a
5 zmienionych plików z 32 dodań i 121 usunięć

Wyświetl plik

@ -114,3 +114,21 @@ services:
depends_on:
db:
condition: service_healthy
qgisserver:
image: openquake/qgis-server:ltr
environment:
- QGIS_PROJECT_FILE=/project/project.qgs
- QGIS_SERVER_LOG_LEVEL=DEBUG
- QGIS_SERVER_PARALLEL_RENDERING=1
volumes:
- ./logs:/var/log/apache2
- ./web:/project
- ./settings:/web/settings
depends_on:
db:
condition: service_healthy
ports:
- 8198:80
restart: on-failure

Wyświetl plik

@ -1,14 +0,0 @@
FROM alpine:latest
RUN apk --no-cache add --update bash curl
ENV BASE_URL='http://download.geofabrik.de'
ENV CONTINENT=''
ENV COUNTRY=''
ENV MAPPING_URL='https://raw.githubusercontent.com/kartoza/docker-osm/develop/settings'
ENV GEOJSON_URL=''
RUN mkdir /home/settings
ADD download.sh /download.sh
ENTRYPOINT ["/bin/bash", "/download.sh"]

Wyświetl plik

@ -1,31 +0,0 @@
# Download Docker OSM Files
This image is used to facilitate downloading of docker-osm files which are required to get the image
running. The image will download OSM PBF file, Mapping file, Clip Geojson and QGIS Style file.
Environment variables
**BASE_URL='http://download.geofabrik.de'**
This is used to download the OSM PBF file. Currently points to Geofabrik
**CONTINENT=''**
Used to specify what continent you need to download pbf from. This is mandatory eg `CONTINENT=africa`
**COUNTRY=''**
Used to specify which country you need to download pbf from. This is optional if you intent
to only use continent pbf. Eg `COUNTRY=lesotho`
**MAPPING_URL='https://raw.githubusercontent.com/kartoza/docker-osm/develop/settings'**
This currently points to the docker-osm repository to enable downloading of the mapping file, qgis_style
file. These files are mandatory in the running of docker-osm
**GEOJSON_URL=''**
This points to the geojson file that is used for clipping data in OSM. This can be empty if you do
not intent to use the clip functionality in docker-osm

Wyświetl plik

@ -1,48 +0,0 @@
#!/usr/bin/env bash
CONTINENT_LOCKFILE=/home/settings/.${CONTINENT}_lock
COUNTRY_LOCKFILE=/home/settings/.${COUNTRY}_lock
touch /home/settings/last.state.txt
touch /home/settings/timestamp.txt
# Download OSM Mapping file and Associated data
if [ ! -f /home/settings/mapping.yml ]; then \
wget -c ${MAPPING_URL}/mapping.yml -O /home/settings/mapping.yml
fi
if [ ! -f /home/settings/qgis_style.sql ]; then \
wget -c ${MAPPING_URL}/qgis_style.sql -O /home/settings/qgis_style.sql
fi
if [ ! -f /home/settings/post-pbf-import.sql ]; then \
url=${MAPPING_URL}/post-pbf-import.sql
if curl --output /dev/null --silent --head --fail "${url}"; then
wget -c ${MAPPING_URL}/post-pbf-import.sql -O /home/settings/post-pbf-import.sql
else
echo "URL does not exist: ${url}"
fi
fi
if [[ ! -f /home/settings/clip.geojson && -z ${GEOJSON_URL} ]]; then \
echo "We are not downloading any Geojson"
else
wget -c ${GEOJSON_URL} -O /home/settings/clip.geojson
fi
# Download OSM PBF
if [[ ! -f ${CONTINENT_LOCKFILE} && -z ${COUNTRY} ]]; then \
echo "${BASE_URL}/${CONTINENT}-latest.osm.pbf"
wget -c --no-check-certificate ${BASE_URL}/${CONTINENT}-latest.osm.pbf -O /tmp/${CONTINENT}.pbf
mv /tmp/${CONTINENT}.pbf /home/settings/country.pbf
touch ${CONTINENT_LOCKFILE}
elif [[ ! -f ${COUNTRY_LOCKFILE} ]]; then
echo "${BASE_URL}/${CONTINENT}/${COUNTRY}-latest.osm.pbf"
wget -c --no-check-certificate ${BASE_URL}/${CONTINENT}/${COUNTRY}-latest.osm.pbf -O /tmp/${COUNTRY}.pbf
mv /tmp/${COUNTRY}.pbf /home/settings/country.pbf
touch ${COUNTRY_LOCKFILE}
fi

Wyświetl plik

@ -2,7 +2,7 @@
A docker compose project to setup an OSM PostGIS database with automatic
updates from OSM periodically.
The only files you need is a PBF file, geojson (if you intent to restrict data download to
The only files you need is a PBF file, geojson (if you intend to restrict data download to
a smaller extent than the one specified by the PBF) and run the docker compose project.
## General architecture
@ -20,6 +20,9 @@ Alternatively you can execute the `settings_downloader.sh` script to download th
./settings_downloader.sh GEOJSON_URL CONTINENT COUNTRY ie
./settings_downloader.sh https://github.com/kartoza/docker-osm/raw/develop/settings/clip.geojson africa south-africa
```
For a full list of allowed file names read json file `countries.json`
Alternatively you can use the python script `pbf_downloader.py`
* If you want to connect from your local QGIS Desktop:
* In the file `docker-compose.yml`, uncomment the block:
@ -71,9 +74,7 @@ website: https://imposm.org/docs/imposm3/latest/mapping.html
The default file in Docker-OSM is coming from
https://raw.githubusercontent.com/omniscale/imposm3/master/example-mapping.yml
**Note** that you can't import OSM metadata such as author, timestamp or version.
This is a limitation from ImpOSM, check the feature request on the [Imposm repository](https://github.com/omniscale/imposm3/issues/58).
Imposm is designed for spatial analysis, not for OSM contribution analysis.
**Note** Imposm is designed for spatial analysis, not for OSM contribution analysis.
If you need such a feature, you need to use another database schema supporting OSM Metadata.
You can check the [OSM Wiki](https://wiki.openstreetmap.org/wiki/Databases_and_data_access_APIs#Database_Schemas) for "Lossless" schemas.
@ -93,14 +94,14 @@ you to define a smaller area that you can work with.
This is always desirable to limit the features being imported into the database rather
than clipping them.
**NB:** Ensure you add a geojson covering the area you intent to clip into the settings folder.
The geojson can be the same extent of the administrative area of your country or it can be a
**NB:** Ensure you add a geojson covering the area you intend to clip into the `settings` folder.
The geojson can be the same extent of the administrative area for your country, or it can be a
smaller extent. The CRS of the geojson should always be EPSG:4326.
**NB:** It is encouraged to simplify the geometry for the `clip.geojson` as
a simplified geometry is easier to process during the import.
Rather use the minimum bounding box for the area you intent to clip your dataset with.
Rather use the minimum bounding box for the area you intend to clip your dataset with.
### QGIS Styles
@ -116,8 +117,7 @@ make backup_styles
### SQL Trigger, functions, views...
You can add PostGIS functions, triggers, materialized views in a
SQL file called `post-pbf-import.sql`.
You can add PostGIS functions, triggers, materialized views into an SQL file called `post-pbf-import.sql`.
It will be imported automatically in the database.
### Build and run
@ -129,7 +129,7 @@ docker-compose build
docker-compose up
```
In production you should daemonize the services when bringing them up:
In production, you should daemonize the services when bringing them up:
```bash
docker-compose up -d
@ -245,26 +245,12 @@ in this repository.
# PostGIS
With -e, you can add some settings to PostGIS:
```bash
- ALLOW_IP_RANGE= 0.0.0.0/0
```
More environment variables for Kartoza/postgis image can be found from https://github.com/kartoza/docker-postgis#environment-variables
For environment variables associated with `docker-postgis` refer to [docker postgis repository](https://github.com/kartoza/docker-postgis)
# QGIS Server and Martin Vector tiles
### Support
You can run a QGIS Server front end or martin vector tiles to the OSM mirror by using the provided
docker-compose-web.yml file. For example:
```bash
docker-compose -f docker-compose.yml -f docker-compose-web.yml qgisserver up
```
or
```bash
docker-compose -f docker-compose.yml -f docker-compose-web.yml martin up
```
For more information about martin configuration and usage can be found from https://github.com/urbica/martin
If you require more substantial assistance from [kartoza](https://kartoza.com) (because our work and interaction on docker-osm is pro bono),
please consider taking out a [Support Level Agreeement](https://kartoza.com/en/shop/product/support)
# Credits