Skip to content

Commit 03238bc

Browse files
Merge pull request #126 from rustprooflabs/v0_2_0_rc
Prepare Release v0.2.0
2 parents bea98ca + c6e345f commit 03238bc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+775
-733
lines changed

.github/workflows/docker-build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ name: Publish PgOSM-Flex Docker image
22
on:
33
push:
44
branches:
5-
- main
5+
- broken-see-gh132
66
jobs:
77
push_to_registry:
88
name: Push PgOSM-Flex image to Docker Hub
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Check out the repo
1212
uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 0
1315
- name: Login to DockerHub
1416
uses: docker/login-action@v1
1517
with:

DOCKER-RUN.md

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,38 @@ docker run --name pgosm -d \
2727
-p 5433:5432 -d rustprooflabs/pgosm-flex
2828
```
2929

30-
## Run and Customize PgOSM-Flex
30+
## Run PgOSM-Flex
31+
32+
The following `docker exec` command runs PgOSM Flex to load the District of Columbia
33+
region
34+
35+
The command `bash docker/run_pgosm_flex.sh` runs the full process. The
36+
script uses a region (`north-america/us`) and sub-region (`district-of-columbia`)
37+
that must match values in URLs from the Geofabrik download server.
38+
The 3rd parameter tells the script the server has 8 GB RAM available for osm2pgsql, Postgres, and the OS. The PgOSM-Flex layer set is defined (`run-all`).
39+
40+
41+
```bash
42+
docker exec -it \
43+
-e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_USER=postgres \
44+
pgosm bash docker/run_pgosm_flex.sh \
45+
north-america/us \
46+
district-of-columbia \
47+
8 \
48+
run-all
49+
```
50+
51+
52+
## Customize PgOSM-Flex
3153

3254
The following command sets the four (4) main env vars used to customize PgOSM-Flex.
3355

34-
* `PGOSM_SRID` - Override default SRID 3857 to custom SRID
56+
* `PGOSM_SRID` - Set custom SRID, must be in `public.spatial_ref_sys`. Default `3857`
3557
* `PGOSM_DATA_SCHEMA_NAME` - Final schema name for the OpenStreetMap data. Default `osm`
36-
* `PGOSM_DATA_SCHEMA_ONLY` - When `false` (default) the `pgosm` schema is exported along with the `PGOSM_DATA_SCHEMA_NAME` schema
58+
* `PGOSM_DATA_SCHEMA_ONLY` - When `false` (default) the QGIS styles and `pgosm` schema are exported along with the `PGOSM_DATA_SCHEMA_NAME` schema
3759
* `PGOSM_DATE` - Used to document data loaded to DB in `osm.pgosm_flex.pgosm_date`, and for archiving PBF/MD5 files. Defaults to today.
3860
* `PGOSM_LANGUAGE` - Used to prefer specific language when it exists.
3961

40-
The command `bash docker/run_pgosm_flex.sh` runs the full process. The
41-
script uses a region (`north-america/us`) and sub-region (`district-of-columbia`)
42-
that must match values in URLs from the Geofabrik download server.
43-
The osm2pgsql cache is set (`2000`) and the PgOSM-Flex layer set is defined (`run-all`).
44-
4562

4663
```bash
4764
docker exec -it \
@@ -50,11 +67,11 @@ docker exec -it \
5067
-e PGOSM_DATA_SCHEMA_ONLY=true \
5168
-e PGOSM_DATA_SCHEMA_NAME=osm_dc \
5269
-e PGOSM_DATE='2021-03-11' \
53-
-e PGOSM_LANGUAGE=kn \
70+
-e PGOSM_LANGUAGE=en \
5471
pgosm bash docker/run_pgosm_flex.sh \
5572
north-america/us \
5673
district-of-columbia \
57-
500 \
74+
8 \
5875
run-all
5976
```
6077

@@ -81,5 +98,26 @@ docker run --name pgosm -d \
8198
-p 5433:5432 -d rustprooflabs/pgosm
8299
```
83100

101+
## Configure Postgres in Docker
102+
103+
Add customizations with the `-c` switch, e.g. `-c shared_buffers=1GB`,
104+
to customize Postgres' configuration at run-time in Docker.
105+
106+
107+
108+
```bash
109+
docker run --name pgosm -d \
110+
-v ~/pgosm-data:/app/output \
111+
-v /etc/localtime:/etc/localtime:ro \
112+
-e POSTGRES_PASSWORD=mysecretpassword \
113+
-p 5433:5432 -d rustprooflabs/pgosm-flex \
114+
-c shared_buffers=1GB \
115+
-c maintenance_work_mem=1GB \
116+
-c checkpoint_timeout=300min \
117+
-c max_wal_senders=0 -c wal_level=minimal \
118+
-c checkpoint_completion_target=0.9 \
119+
-c random_page_cost=1.0
120+
```
121+
84122

85123

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@ RUN apt-get update \
99
libboost-dev libboost-system-dev \
1010
libboost-filesystem-dev libexpat1-dev zlib1g-dev \
1111
libbz2-dev libpq-dev libproj-dev lua5.2 liblua5.2-dev \
12+
python3 python3-distutils \
13+
curl \
1214
&& rm -rf /var/lib/apt/lists/*
1315

16+
RUN curl -o /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py \
17+
&& python3 /tmp/get-pip.py \
18+
&& rm /tmp/get-pip.py
19+
20+
RUN pip install requests
21+
1422

1523
WORKDIR /tmp
1624
RUN git clone git://github.com/openstreetmap/osm2pgsql.git \
@@ -24,6 +32,7 @@ RUN git clone git://github.com/openstreetmap/osm2pgsql.git \
2432
libboost-dev libboost-system-dev \
2533
libboost-filesystem-dev libexpat1-dev zlib1g-dev \
2634
libbz2-dev libpq-dev libproj-dev \
35+
curl \
2736
&& apt autoremove -y \
2837
&& cd /tmp && rm -r /tmp/osm2pgsql
2938

MANUAL-STEPS-RUN.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,30 @@ psql -d $PGOSM_CONN -f ./sql/road_major.sql
226226

227227

228228
> WARNING: Running multiple `osm2pgsql` commands requires processing the source PBF multiple times. This can waste considerable time on larger imports. Further, attempting to define multiple styles with additional `--style=style.lua` switches results in only the last style being processed. To mix and match multiple styles, create a custom Lua script similar to `run-all.lua` or `run-no-tags.lua`.
229+
230+
231+
232+
## Additional structure and helper data
233+
234+
**Optional**
235+
236+
Deploying the additional table structure is done via [sqitch](https://sqitch.org/).
237+
238+
Assumes this repo is cloned under `~/git/pgosm-flex/` and a local Postgres
239+
DB named `pgosm` has been created with the `postgis` extension installed.
240+
241+
```bash
242+
cd ~/git/pgosm-flex/db
243+
sqitch deploy db:pg:pgosm
244+
```
245+
246+
With the structures created, load helper road data.
247+
248+
```bash
249+
cd ~/git/pgosm-flex/db
250+
psql -d pgosm -f data/roads-us.sql
251+
```
252+
253+
254+
Currently only U.S. region drafted, more regions with local `maxspeed` are welcome via PR!
255+

0 commit comments

Comments
 (0)