Replace osmborder with imposm/SQL (#1213)
Fixes #1156 Fixes #810 Fixes #1228 This PR replaces `osmborder`, which is no longer maintained, with `imposm` mappings and SQL code to generate borders. Key features that were moved into the imposm/SQL layer: 1. Grouping by `osm_id` and aggregating by lowest `admin_level` value so that there's only one copy of ways that are members of multiple relations. 2. Filtering out of point features in boundary relations (typically `admin_centre` and `label` roles). 3. Move disputed boundary detection logic into SQL. This will increase the database size slightly because of the limits of what imposm can do, as some of the filtering is done in the SQL layer after importing, rather than being done in `osmborder`.
This commit is contained in:
committed by
GitHub
parent
bfdbd829dc
commit
b4b897999d
19
Makefile
19
Makefile
@@ -143,11 +143,6 @@ else
|
||||
DOWNLOAD_AREA := $(area)
|
||||
endif
|
||||
|
||||
# import-borders uses these temp files during border parsing/import
|
||||
export BORDERS_CLEANUP_FILE ?= data/borders/$(area).cleanup.pbf
|
||||
export BORDERS_PBF_FILE ?= data/borders/$(area).filtered.pbf
|
||||
export BORDERS_CSV_FILE ?= data/borders/$(area).lines.csv
|
||||
|
||||
# The file is placed into the $EXPORT_DIR=/export (mapped to ./data)
|
||||
export MBTILES_FILE ?= $(area).mbtiles
|
||||
MBTILES_LOCAL_FILE = data/$(MBTILES_FILE)
|
||||
@@ -202,7 +197,6 @@ Hints for downloading & importing data:
|
||||
make download-bbbike area=Amsterdam # download OSM data from bbbike.org and create config file
|
||||
make import-data # Import data from OpenStreetMapData, Natural Earth and OSM Lake Labels.
|
||||
make import-osm # Import OSM data with the mapping rules from build/mapping.yaml
|
||||
make import-borders # Create borders table using extra processing with osmborder tool
|
||||
make import-wikidata # Import labels from Wikidata
|
||||
make import-sql # Import layers (run this after modifying layer SQL)
|
||||
|
||||
@@ -254,7 +248,7 @@ endef
|
||||
init-dirs:
|
||||
@mkdir -p build/sql/parallel
|
||||
@mkdir -p build/openmaptiles.tm2source
|
||||
@mkdir -p data/borders
|
||||
@mkdir -p data
|
||||
@mkdir -p cache
|
||||
@ ! ($(DOCKER_COMPOSE) 2>/dev/null run $(DC_OPTS) openmaptiles-tools df --output=fstype /tileset| grep -q 9p) || ($(win_fs_error))
|
||||
|
||||
@@ -406,17 +400,6 @@ import-diff: all start-db-nowait
|
||||
import-data: start-db
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) import-data
|
||||
|
||||
.PHONY: import-borders
|
||||
import-borders: start-db-nowait
|
||||
ifeq (,$(wildcard $(BORDERS_CSV_FILE)))
|
||||
@$(assert_area_is_given)
|
||||
@echo "Generating borders out of $(PBF_FILE)"
|
||||
else
|
||||
@echo "Borders already exists. Useing $(BORDERS_CSV_FILE) to import borders"
|
||||
endif
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools sh -c \
|
||||
'pgwait && import-borders $$([ -f "$(BORDERS_CSV_FILE)" ] && echo load $(BORDERS_CSV_FILE) || echo import $(PBF_FILE))'
|
||||
|
||||
.PHONY: import-sql
|
||||
import-sql: all start-db-nowait
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools sh -c 'pgwait && import-sql' | \
|
||||
|
||||
Reference in New Issue
Block a user