Created
September 2, 2016 15:38
-
-
Save ImreSamu/770b6a15d8a882a2ab72bd12e9e405e4 to your computer and use it in GitHub Desktop.
imposm3 - tilelist test ... for -> https://github.com/osm2vectortiles/osm2vectortiles/pull/416
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -o errexit | |
| set -o pipefail | |
| set -o nounset | |
| readonly IMPOSM_CACHE_DIR=${IMPOSM_CACHE_DIR:-/data/cache} | |
| readonly OSM_DB=${OSM_DB:-osm} | |
| readonly OSM_USER=${OSM_USER:-osm} | |
| readonly OSM_PASSWORD=${OSM_PASSWORD:-osm} | |
| readonly DB_SCHEMA=${OSM_SCHEMA:-public} | |
| readonly DB_HOST=$DB_PORT_5432_TCP_ADDR | |
| readonly PG_CONNECT="postgis://$OSM_USER:$OSM_PASSWORD@$DB_HOST/$OSM_DB" | |
| TILELIST=${TILELIST:-/data/export/tiles.txt} | |
| function exec_sql_code() { | |
| local sql_code=$1 | |
| PG_PASSWORD=$OSM_PASSWORD psql \ | |
| --host="$DB_HOST" \ | |
| --port=5432 \ | |
| --dbname="$OSM_DB" \ | |
| --username="$OSM_USER" \ | |
| -v ON_ERROR_STOP=1 \ | |
| -a -c "$sql_code" | |
| } | |
| function make_test { | |
| rm -f base.o* | |
| rm -f zero.o* | |
| country=malta | |
| wget http://download.geofabrik.de/europe/${country}-160101.osm.pbf -O base.osm.pbf | |
| cat <<OSMEOF > zero.osm | |
| <?xml version='1.0' encoding='UTF-8'?> | |
| <osm version="0.6" generator="osm-tiny-zero-generator"> | |
| </osm> | |
| OSMEOF | |
| osmconvert zero.osm -o=zero.osm.pbf | |
| osmconvert base.osm.pbf -o=base.o5m | |
| osmconvert zero.osm.pbf -o=zero.o5m | |
| osmconvert base.o5m zero.o5m --diff --timestamp=2016-09-01T00:00:00Z --out-osc | gzip > ./osmdiff_all_del.osc.gz | |
| osmconvert zero.o5m base.o5m --diff --timestamp=2016-09-01T00:00:00Z --out-osc | gzip > ./osmdiff_all_add.osc.gz | |
| } | |
| make_test | |
| function i3_import { | |
| echo ' ---- import ----' | |
| imposm3 import \ | |
| -mapping "$MAPPING_YAML" \ | |
| -read $import_osm_pbf \ | |
| -diff \ | |
| -write \ | |
| -overwritecache \ | |
| -cachedir "$IMPOSM_CACHE_DIR" \ | |
| -deployproduction \ | |
| -connection $PG_CONNECT | |
| } | |
| function i3_diff { | |
| echo ' ---- diff ----' | |
| imposm3 diff \ | |
| -mapping "$MAPPING_YAML" \ | |
| -cachedir "$IMPOSM_CACHE_DIR" \ | |
| -connection $PG_CONNECT \ | |
| -tilelist $TILELIST \ | |
| -maxzoom 14 \ | |
| $import_osc_gz | |
| } | |
| import_osm_pbf=base.osm.pbf | |
| import_osc_gz=osmdiff_all_del.osc.gz | |
| TILELIST=_tiles_all_del.txt | |
| i3_import | |
| exec_sql_code "SELECT count(*) as count FROM osm_place_point"; | |
| i3_diff | |
| exec_sql_code "SELECT count(*) as count FROM osm_place_point"; | |
| import_osm_pbf=zero.osm.pbf | |
| import_osc_gz=osmdiff_all_add.osc.gz | |
| TILELIST=_tiles_all_add.txt | |
| i3_import | |
| exec_sql_code "SELECT count(*) as count FROM osm_place_point"; | |
| i3_diff | |
| exec_sql_code "SELECT count(*) as count FROM osm_place_point"; | |
| ls _tiles*.txt -la | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
my log