Skip to content

Instantly share code, notes, and snippets.

@typebrook
Last active March 19, 2020 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save typebrook/4d1b430193a26a41756824acaa688b3c to your computer and use it in GitHub Desktop.
Save typebrook/4d1b430193a26a41756824acaa688b3c to your computer and use it in GitHub Desktop.
[tile-server] Imposm/t-rex config #tile-host #t-rex
# stop postgres
sudo pkill -u postgres
# launch a postgis container with default user "postgres"
docker run --name rex -e POSTGRES_PASSWORD=rex -d mdillon/postgis
# into psql with identity postgres
docker run -it --link rex:postgres --rm mdillon/postgis sh -c 'exec psql -h rex -p 5432 -U postgres' sh -c 'exec psql -h rex -p 5432 -U postgres'
# launch a postgis container with db called rex
docker run --name rex \
-e POSTGRES_PASSWORD=rex \
-e POSTGRES_USER=rex \
-e POSTGRES_DB=rex \
-d mdillon/postgis
# use openmaptiles with custom mapping file to import data into postgis container
docker run --rm \ [0]
--link rex:postgres \
-v $(pwd):/import \
-v $(pwd):/mapping \
-e POSTGRES_USER="rex" \
-e POSTGRES_PASSWORD="rex" \
-e POSTGRES_HOST="rex" \
-e POSTGRES_DB="rex" \
-e POSTGRES_PORT="5432" \
openmaptiles/import-osm
# serve osm.pbf at localhost:6767 using t-rex docker
docker run -it --rm -p 6767:6767 -v `pwd`:/data sourcepole/t-rex serve --datasource /data/taiwan-latest.osm.pbf --openbrowser=false --bind=0.0.0.0
{
"cachedir": "/tmp/imposm_cache_rex",
"connection": "postgis://rex:rex@localhost/rex",
"mapping": "mapping"
}
tables:
peaks:
type: point
columns:
- name: osm_id
type: id
- name: geometry
type: geometry
- key: name
name: name
type: string
- key: ele
name: ele
type: integer
filter:
require:
ele: [__any__]
name: [__any__]
mapping:
natural: [peak]
buildings:
type: polygon
columns:
- name: osm_id
type: id
- name: geometry
type: geometry
- key: name
name: name
type: string
filter:
require:
name: [__any__]
mapping:
building: ['yes']
paths:
type: linestring
columns:
- name: osm_id
type: id
- name: geometry
type: geometry
- key: name
name: name
type: string
filter:
require:
surface: ['unpaved']
mapping:
highway: ['path']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment