Merge branch 'master' into power_facilities
|
@ -0,0 +1,22 @@
|
|||
# Workflow to run unit tests on OMT`s new Pull Requests and commits pushed into OMT repo
|
||||
|
||||
name: OpenMapTiles SQL Test CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, master-tools ]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
|
||||
unit_tests:
|
||||
name: Run unit test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout the changes
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Run unit tests
|
||||
run: |
|
||||
make clean && make test-sql
|
|
@ -41,3 +41,33 @@ When you modify import data rules in `mapping.yaml` or `*.sql`, please update:
|
|||
5. check if OMT styles are affected by the PR and if there is a need for style updates
|
||||
|
||||
When you are making PR that adds new spatial features to OpenMapTiles schema, please make also PR for at least one of our GL styles to show it on the map. Visual check is crucial.
|
||||
|
||||
# SQL unit testing
|
||||
|
||||
It is recommended that you create a [unit test](TESTING.md) when modifying the behavior of the SQL layer. This will ensure that your changes are working as expected when importing or updating OSM data into an OpenMapTiles database.
|
||||
|
||||
# Verifying that updates still work
|
||||
|
||||
When testing a PR, you shoud also verify that the update process completes without error. The following procedure will run the update process.
|
||||
|
||||
1. Change .env to set `DIFF_MODE=true`. In addition, if you're testing changes that impact zooms higher than the default zoom of 7, you should also change `MAX_ZOOM` to be up to 14.
|
||||
2. Set the test area to the appropriate geofabrik extract, for example:
|
||||
|
||||
```
|
||||
export area=north-america/us/indiana
|
||||
```
|
||||
|
||||
3. Build 1-month-old tiles:
|
||||
|
||||
```
|
||||
rm -fr data build cache
|
||||
make download-geofabrik area=$area
|
||||
docker-compose run --rm --user=$(id -u):$(id -g) openmaptiles-tools sh -c "wget -O data/$area.osm.pbf http://download.geofabrik.de/$area-$(date --date="$(date +%Y-%m-15) -1 month" +'%y%m01').osm.pbf"
|
||||
./quickstart.sh $area
|
||||
```
|
||||
4. Update with the changes since then:
|
||||
```
|
||||
docker-compose run --rm --user=$(id -u):$(id -g) openmaptiles-tools sh -c "osmupdate --base-url=$(sed -n 's/ *\"replication_url\": //p' data/$area.repl.json) data/$area.osm.pbf data/changes.osc.gz"
|
||||
make import-diff
|
||||
make generate-tiles-pg
|
||||
```
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2016, KlokanTech.com & OpenMapTiles contributors.
|
||||
Copyright (c) 2021, MapTiler.com & OpenMapTiles contributors.
|
||||
All rights reserved.
|
||||
|
||||
The vector tile schema has been developed by Klokan Technologies GmbH and
|
||||
|
@ -55,6 +55,6 @@ For printed and static maps a similar attribution should be made in a textual
|
|||
description near the image, in the same fashion as if you cite a photograph.
|
||||
|
||||
Exceptions to OpenMapTiles attribution requirement can be in a written form granted
|
||||
by Klokan Technologies GmbH (info@klokantech.com).
|
||||
The project contributors grant Klokan Technologies GmbH the license to give such
|
||||
by MapTiler (info@maptiler.com).
|
||||
The project contributors grant MapTiler AG the license to give such
|
||||
exceptions on a commercial basis.
|
||||
|
|
47
Makefile
|
@ -184,6 +184,7 @@ Hints for developers:
|
|||
make generate-qa # statistics for a given layer's field
|
||||
make generate-tiles-pg # generate vector tiles based on .env settings using PostGIS ST_MVT()
|
||||
make generate-tiles # generate vector tiles based on .env settings using Mapnik (obsolete)
|
||||
make test-sql # run unit tests on the OpenMapTiles SQL schema
|
||||
cat .env # list PG database and MIN_ZOOM and MAX_ZOOM information
|
||||
cat quickstart.log # transcript of the last ./quickstart.sh run
|
||||
make help # help about available commands
|
||||
|
@ -276,9 +277,14 @@ ifeq (,$(wildcard build/sql/run_last.sql))
|
|||
endif
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
clean: clean-test-data
|
||||
rm -rf build
|
||||
|
||||
clean-test-data:
|
||||
rm -rf data/changes.state.txt
|
||||
rm -rf data/last.state.txt
|
||||
rm -rf data/changes.repl.json
|
||||
|
||||
.PHONY: destroy-db
|
||||
# TODO: Use https://stackoverflow.com/a/27852388/177275
|
||||
destroy-db: DC_PROJECT := $(shell echo $(DC_PROJECT) | tr A-Z a-z)
|
||||
|
@ -589,3 +595,42 @@ debug: ## Use this target when developing Makefile itself to verify loaded envi
|
|||
@echo BBOX = $(BBOX) , $$BBOX
|
||||
@echo MIN_ZOOM = $(MIN_ZOOM) , $$MIN_ZOOM
|
||||
@echo MAX_ZOOM = $(MAX_ZOOM) , $$MAX_ZOOM
|
||||
|
||||
build/import-tests.osm.pbf: init-dirs
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'osmconvert tests/import/*.osm -o=build/import-tests.osm.pbf'
|
||||
|
||||
data/changes.state.txt:
|
||||
cp -f tests/changes.state.txt data/
|
||||
|
||||
data/last.state.txt:
|
||||
cp -f tests/last.state.txt data/
|
||||
|
||||
data/changes.repl.json:
|
||||
cp -f tests/changes.repl.json data/
|
||||
|
||||
data/changes.osc.gz: init-dirs
|
||||
@echo " UPDATE unit test data..."
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'osmconvert tests/update/*.osc --merge-versions -o=data/changes.osc && gzip -f data/changes.osc'
|
||||
|
||||
test-sql: clean refresh-docker-images destroy-db start-db-nowait build/import-tests.osm.pbf data/changes.state.txt data/last.state.txt data/changes.repl.json build/mapping.yaml data/changes.osc.gz
|
||||
$(eval area := changes)
|
||||
|
||||
@echo "Load IMPORT test data"
|
||||
sed -ir "s/^[#]*\s*MAX_ZOOM=.*/MAX_ZOOM=14/" .env
|
||||
sed -ir "s/^[#]*\s*DIFF_MODE=.*/DIFF_MODE=false/" .env
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && import-osm build/import-tests.osm.pbf'
|
||||
|
||||
@echo "Apply OpenMapTiles SQL schema to test data @ Zoom 14..."
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools sh -c 'pgwait && import-sql' | \
|
||||
awk -v s=": WARNING:" '1{print; fflush()} $$0~s{print "\n*** WARNING detected, aborting"; exit(1)}' | \
|
||||
awk '1{print; fflush()} $$0~".*ERROR" {txt=$$0} END{ if(txt){print "\n*** ERROR detected, aborting:"; print txt; exit(1)} }'
|
||||
|
||||
@echo "Test SQL output for Import Test Data"
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && psql.sh < tests/test-post-import.sql'
|
||||
|
||||
@echo "Run UPDATE process on test data..."
|
||||
sed -ir "s/^[#]*\s*DIFF_MODE=.*/DIFF_MODE=true/" .env
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && import-diff'
|
||||
|
||||
@echo "Test SQL output for Update Test Data"
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && psql.sh < tests/test-post-update.sql'
|
||||
|
|
|
@ -415,33 +415,59 @@ the current output:
|
|||
|
||||
```
|
||||
==============================================================================
|
||||
OpenMapTiles https://github.com/openmaptiles/openmaptiles
|
||||
OpenMapTiles https://github.com/openmaptiles/openmaptiles
|
||||
|
||||
Hints for testing areas
|
||||
make download-geofabrik-list # list actual geofabrik OSM extracts for download -> <<your-area>>
|
||||
make list-geofabrik # list actual geofabrik OSM extracts for download -> <<your-area>>
|
||||
./quickstart.sh <<your-area>> # example: ./quickstart.sh madagascar
|
||||
|
||||
Hints for designers:
|
||||
make start-postserve # start Postserver + Maputnik Editor [ see localhost:8088 ]
|
||||
make start-tileserver # start maptiler/tileserver-gl [ see localhost:8080 ]
|
||||
make start-maputnik # start Maputnik Editor + dynamic tile server [ see http://localhost:8088 ]
|
||||
make start-postserve # start dynamic tile server [ see http://localhost:8090 ]
|
||||
make stop-postserve # stop dynamic tile server
|
||||
make start-tileserver # start maptiler/tileserver-gl [ see http://localhost:8080 ]
|
||||
|
||||
Hints for developers:
|
||||
make # build source code
|
||||
make download-geofabrik area=albania # download OSM data from geofabrik, and create config file
|
||||
make bash # start openmaptiles-tools /bin/bash terminal
|
||||
make generate-bbox-file # compute bounding box of a data file and store it in a file
|
||||
make generate-devdoc # generate devdoc including graphs for all layers [./layers/...]
|
||||
make generate-qa # statistics for a given layer's field
|
||||
make generate-tiles-pg # generate vector tiles based on .env settings using PostGIS ST_MVT()
|
||||
make generate-tiles # generate vector tiles based on .env settings using Mapnik (obsolete)
|
||||
make test-sql # run unit tests on the OpenMapTiles SQL schema
|
||||
cat .env # list PG database and MIN_ZOOM and MAX_ZOOM information
|
||||
cat quickstart.log # transcript of the last ./quickstart.sh run
|
||||
make help # help about available commands
|
||||
|
||||
Hints for downloading & importing data:
|
||||
make list-geofabrik # list actual geofabrik OSM extracts for download
|
||||
make list-bbbike # list actual BBBike OSM extracts for download
|
||||
make download area=albania # download OSM data from any source and create config file
|
||||
make download-geofabrik area=albania # download OSM data from geofabrik.de and create config file
|
||||
make download-osmfr area=asia/qatar # download OSM data from openstreetmap.fr and create config file
|
||||
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-wikidata # Import labels from Wikidata
|
||||
make import-sql # Import layers (run this after modifying layer SQL)
|
||||
|
||||
Hints for database management:
|
||||
make psql # start PostgreSQL console
|
||||
make psql-list-tables # list all PostgreSQL tables
|
||||
make psql-vacuum-analyze # PostgreSQL: VACUUM ANALYZE
|
||||
make psql-analyze # PostgreSQL: ANALYZE
|
||||
make generate-qa # statistics for a given layer's field
|
||||
make generate-devdoc # generate devdoc [./build/devdoc]
|
||||
make tools-dev # start import-sql /bin/bash terminal
|
||||
make db-destroy # remove docker containers, PG data volume
|
||||
make docker-unnecessary-clean # clean unnecessary docker image(s) and container(s)
|
||||
make refresh-docker-images # refresh openmaptiles docker images from Docker HUB
|
||||
make remove-docker-images # remove openmaptiles docker images
|
||||
make list-views # list PostgreSQL public schema views
|
||||
make list-tables # list PostgreSQL public schema tables
|
||||
cat .env # list PG database and MIN_ZOOM and MAX_ZOOM information
|
||||
cat ./quickstart.log # backup of the last ./quickstart.sh
|
||||
make help # help about available commands
|
||||
make vacuum-db # PostgreSQL: VACUUM ANALYZE
|
||||
make analyze-db # PostgreSQL: ANALYZE
|
||||
make destroy-db # remove docker containers and PostgreSQL data volume
|
||||
make start-db # start PostgreSQL, creating it if it doesn't exist
|
||||
make start-db-preloaded # start PostgreSQL, creating data-prepopulated one if it doesn't exist
|
||||
make stop-db # stop PostgreSQL database without destroying the data
|
||||
|
||||
Hints for Docker management:
|
||||
make clean-unnecessary-docker # clean unnecessary docker image(s) and container(s)
|
||||
make refresh-docker-images # refresh openmaptiles docker images from Docker HUB
|
||||
make remove-docker-images # remove openmaptiles docker images
|
||||
make list-docker-images # show a list of available docker images
|
||||
==============================================================================
|
||||
```
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
# OpenMapTiles SQL Testing
|
||||
|
||||
The OpenMapTiles SQL tests ensure that OSM data is properly imported and updated in the OpenMapTiles data schema. The tests work by injecting test OSM data into the database and checking to ensure that the data is properly reflected in the SQL output.
|
||||
|
||||
Usage:
|
||||
|
||||
`make clean && make sql-test`
|
||||
|
||||
## How it works
|
||||
|
||||
The SQL tests consist of the following parts:
|
||||
|
||||
1. **Test import data**, located in `tests/import`. This test data is in the [OSM XML](https://wiki.openstreetmap.org/wiki/OSM_XML) format and contains the data that should be initially injected into the database. The files are numbered in order to ensure that each test data file OSM id numbers that are unique from the other files. For example, the file starting with `100` will use node ids from 100000-199999, way ids from 1000-1999, and relation ids from 100-199.
|
||||
2. **Test update data**, located in `tests/update`. This test data is in the [osmChange XML](https://wiki.openstreetmap.org/wiki/OsmChange) format, and contains the data that will be used to update the test import data (in order to verify that the update process is working correctly. These files are also numbered using the same scheme as the test import data.
|
||||
3. **Import SQL test script**, located at `tests/test-post-import.sql`. This script is executed after the test import data has been injected, and runs SQL-based checks to ensure that the import data was properly imported. If there are failures in the tests, an entry will be added to the table `omt_test_failures`, with one record per error that occurs during the import process. A test failure will also fail the build. To inspect the test failure messages, run `make psql` and issue the comment `SELECT * FROM omt_test_failures`.
|
||||
4. **Update SQL test script**, located at `tests/test-post-update.sql`. This script performs the same function as the import test script, except that it occurs after the test update data has been applied to the database. Note that script will only run if the import script passes all tests.
|
||||
|
|
@ -60,11 +60,14 @@ tables:
|
|||
aeroway:
|
||||
- terminal
|
||||
- hangar
|
||||
location:
|
||||
- underground
|
||||
filters:
|
||||
reject:
|
||||
building: ["no","none","No"]
|
||||
building:part: ["no","none","No"]
|
||||
man_made: ["bridge"]
|
||||
location: ["underground"]
|
||||
type: polygon
|
||||
|
||||
# etldoc: imposm3 -> osm_building_relation
|
||||
|
@ -157,4 +160,4 @@ tables:
|
|||
type: member_type
|
||||
mapping:
|
||||
type: [building]
|
||||
type: relation_member
|
||||
type: relation_member
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 19 KiB Po Szerokość: | Wysokość: | Rozmiar: 28 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 192 KiB Po Szerokość: | Wysokość: | Rozmiar: 194 KiB |
|
@ -19,7 +19,7 @@ ALTER TABLE osm_park_polygon_gen_z6
|
|||
ALTER TABLE osm_park_polygon_gen_z5
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
|
||||
-- etldoc: osm_park_polygon_dissolve_z4 -> osm_park_polygon_gen_z4
|
||||
-- etldoc: osm_park_polygon_gen_z4 -> osm_park_polygon_dissolve_z4
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_park_polygon_dissolve_z4 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_park_polygon_dissolve_z4 AS
|
||||
(
|
||||
|
|
|
@ -66,7 +66,8 @@ SELECT CASE
|
|||
(
|
||||
'motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'raceway',
|
||||
'motorway_construction', 'trunk_construction', 'primary_construction',
|
||||
'secondary_construction', 'tertiary_construction', 'raceway_construction'
|
||||
'secondary_construction', 'tertiary_construction', 'raceway_construction',
|
||||
'busway'
|
||||
) THEN TRUE --includes ramps
|
||||
ELSE FALSE
|
||||
END
|
||||
|
|
|
@ -45,7 +45,7 @@ generalized_tables:
|
|||
# etldoc: osm_highway_linestring -> osm_highway_linestring_gen_z11
|
||||
highway_linestring_gen_z11:
|
||||
source: highway_linestring
|
||||
sql_filter: (highway IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link') OR highway = 'construction' AND construction IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link')) AND NOT is_area AND ST_IsValid(geometry)
|
||||
sql_filter: (highway IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link', 'busway') OR highway = 'construction' AND construction IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link', 'busway')) AND NOT is_area AND ST_IsValid(geometry)
|
||||
tolerance: ZRES12
|
||||
|
||||
name_field: &name
|
||||
|
@ -227,6 +227,7 @@ tables:
|
|||
- service
|
||||
- track
|
||||
- raceway
|
||||
- busway
|
||||
- construction
|
||||
public_transport:
|
||||
- platform
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 126 KiB Po Szerokość: | Wysokość: | Rozmiar: 128 KiB |
|
@ -53,10 +53,10 @@ SELECT osm_id,
|
|||
NULLIF(network, '') AS network,
|
||||
-- All links are considered as ramps as well
|
||||
CASE
|
||||
WHEN highway_is_link(highway) OR highway = 'steps'
|
||||
THEN 1
|
||||
ELSE is_ramp::int END AS ramp,
|
||||
is_oneway::int AS oneway,
|
||||
WHEN highway_is_link(highway)
|
||||
OR is_ramp
|
||||
THEN 1 END AS ramp,
|
||||
CASE WHEN is_oneway <> 0 THEN is_oneway::int END AS oneway,
|
||||
brunnel(is_bridge, is_tunnel, is_ford) AS brunnel,
|
||||
NULLIF(service, '') AS service,
|
||||
access,
|
||||
|
|
|
@ -45,6 +45,8 @@ layer:
|
|||
highway: track
|
||||
raceway:
|
||||
highway: raceway
|
||||
busway:
|
||||
highway: busway
|
||||
motorway_construction:
|
||||
__AND__:
|
||||
highway: construction
|
||||
|
|
|
@ -61,8 +61,8 @@ SELECT ST_Simplify(geometry, ZRes(12)) AS geometry,
|
|||
toll,
|
||||
layer
|
||||
FROM osm_transportation_merge_linestring_gen_z11
|
||||
WHERE highway NOT IN ('tertiary', 'tertiary_link')
|
||||
AND construction NOT IN ('tertiary', 'tertiary_link')
|
||||
WHERE highway NOT IN ('tertiary', 'tertiary_link', 'busway')
|
||||
AND construction NOT IN ('tertiary', 'tertiary_link', 'busway')
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z10_geometry_idx
|
||||
ON osm_transportation_merge_linestring_gen_z10 USING gist (geometry);
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 126 KiB Po Szerokość: | Wysokość: | Rozmiar: 128 KiB |
|
@ -318,8 +318,8 @@ $$
|
|||
SELECT geometry,
|
||||
class,
|
||||
NULLIF(name, '') AS name,
|
||||
COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
||||
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
|
||||
COALESCE(NULLIF(name_en, ''), NULLIF(name, '')) AS name_en,
|
||||
COALESCE(NULLIF(name_de, ''), NULLIF(name, ''), NULLIF(name_en, '')) AS name_de,
|
||||
waterway_brunnel(is_bridge, is_tunnel) AS brunnel,
|
||||
is_intermittent::int AS intermittent,
|
||||
tags
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"replication_interval": "24h",
|
||||
"replication_url": "dummy"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
#Sat Sep 25 23:23:00 UTC 2021
|
||||
sequenceNumber=4730693
|
||||
timestamp=2021-09-25T23\:22\:58Z
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<osm version="0.6" generator="Manual">
|
||||
<node id="100001" timestamp="2019-01-01T00:00:00Z" visible="true" version="1" lat="44.5" lon="-103.0" />
|
||||
<node id="100002" timestamp="2019-01-01T00:00:00Z" visible="true" version="1" lat="40.5" lon="-103.0" />
|
||||
<node id="100003" timestamp="2019-01-01T00:00:00Z" visible="true" version="1" lat="40.5" lon="-97.0" />
|
||||
<node id="100004" timestamp="2019-01-01T00:00:00Z" visible="true" version="1" lat="44.5" lon="-97.0" />
|
||||
<node id="100101" timestamp="2019-01-01T00:00:00Z" visible="true" version="1" lat="39.5" lon="-103.0" />
|
||||
<node id="100102" timestamp="2019-01-01T00:00:00Z" visible="true" version="1" lat="35.5" lon="-103.0" />
|
||||
<node id="100103" timestamp="2019-01-01T00:00:00Z" visible="true" version="1" lat="35.5" lon="-97.0" />
|
||||
<node id="100104" timestamp="2019-01-01T00:00:00Z" visible="true" version="1" lat="39.5" lon="-97.0" />
|
||||
<node id="100201" timestamp="2019-01-01T00:00:00Z" visible="true" version="1" lat="44.5" lon="-95.0" />
|
||||
<node id="100202" timestamp="2019-01-01T00:00:00Z" visible="true" version="1" lat="40.5" lon="-95.0" />
|
||||
<node id="100203" timestamp="2019-01-01T00:00:00Z" visible="true" version="1" lat="40.5" lon="-89.0" />
|
||||
<node id="100204" timestamp="2019-01-01T00:00:00Z" visible="true" version="1" lat="44.5" lon="-89.0" />
|
||||
<way id="1000" timestamp="2019-01-01T00:00:00Z" version="1" visible="true">
|
||||
<nd ref="100001" />
|
||||
<nd ref="100002" />
|
||||
<nd ref="100003" />
|
||||
<nd ref="100004" />
|
||||
<nd ref="100001" />
|
||||
<tag k="boundary" v="national_park" />
|
||||
<tag k="name" v="test-national-park" />
|
||||
</way>
|
||||
<way id="1001" timestamp="2019-01-01T00:00:00Z" version="1" visible="true">
|
||||
<nd ref="100101" />
|
||||
<nd ref="100102" />
|
||||
<nd ref="100103" />
|
||||
<nd ref="100104" />
|
||||
<nd ref="100101" />
|
||||
<tag k="leisure" v="nature_reserve" />
|
||||
<tag k="name" v="test-nature-reserve" />
|
||||
</way>
|
||||
<way id="1002" timestamp="2019-01-01T00:00:00Z" version="1" visible="true">
|
||||
<nd ref="100201" />
|
||||
<nd ref="100202" />
|
||||
<nd ref="100203" />
|
||||
<nd ref="100204" />
|
||||
<nd ref="100201" />
|
||||
<tag k="boundary" v="protected_area" />
|
||||
<tag k="name" v="test-protected-area" />
|
||||
<tag k="protect_class" v="5" />
|
||||
</way>
|
||||
</osm>
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<osm version="0.6" generator="Manual">
|
||||
<node id="200001" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="35.0" lon="-80.0" />
|
||||
<node id="200002" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="35.1" lon="-80.0" />
|
||||
<node id="200003" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="35.1" lon="-80.1" />
|
||||
<node id="200004" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="35.0" lon="-80.1" />
|
||||
<node id="200100" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="35.2" lon="-80.2">
|
||||
<tag k="aeroway" v="aerodrome"/>
|
||||
<tag k="ele" v="123"/>
|
||||
<tag k="faa" v="90F"/>
|
||||
<tag k="name" v="OpenMapTiles Airport"/>
|
||||
</node>
|
||||
<node id="200101" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="35.2" lon="-80.3">
|
||||
<tag k="aeroway" v="aerodrome"/>
|
||||
<tag k="ele" v="456"/>
|
||||
<tag k="faa" v="90G"/>
|
||||
<tag k="name" v="OpenMapTiles Airport #2"/>
|
||||
</node>
|
||||
<way id="2000" version="1" timestamp="2019-01-01T00:00:00Z" visible="true">
|
||||
<nd ref="200001" />
|
||||
<nd ref="200002" />
|
||||
<nd ref="200003" />
|
||||
<nd ref="200004" />
|
||||
<nd ref="200001" />
|
||||
<tag k="aerodrome" v="international"/>
|
||||
<tag k="aeroway" v="aerodrome"/>
|
||||
<tag k="name" v="test-airport"/>
|
||||
</way>
|
||||
</osm>
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<osm version="0.6" generator="Manual">
|
||||
<node id="300001" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="34.0" lon="-80.0" />
|
||||
<node id="300002" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="34.1" lon="-80.0" />
|
||||
<node id="300003" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="34.1" lon="-80.1" />
|
||||
<node id="300004" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="34.0" lon="-80.1" />
|
||||
<way id="3000" timestamp="2019-01-01T00:00:00Z" version="1" visible="true">
|
||||
<nd ref="300001" />
|
||||
<nd ref="300002" />
|
||||
<nd ref="300003" />
|
||||
<nd ref="300004" />
|
||||
<nd ref="300001" />
|
||||
<tag k="natural" v="wood"/>
|
||||
</way>
|
||||
</osm>
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<osm version="0.6" generator="Manual">
|
||||
<node id="400001" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="33.0" lon="-80.0" />
|
||||
<node id="400002" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="33.1" lon="-80.0" />
|
||||
<node id="400003" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="33.1" lon="-80.1" />
|
||||
<node id="400004" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="33.0" lon="-80.1" />
|
||||
|
||||
<node id="400005" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="32.0" lon="-79.0" />
|
||||
<node id="400006" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="34.0" lon="-79.0" />
|
||||
<node id="400007" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="34.0" lon="-81.0" />
|
||||
<node id="400008" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="32.0" lon="-81.0" />
|
||||
<way id="4000" version="1" timestamp="2019-01-01T00:00:00Z" visible="true">
|
||||
<nd ref="400001" />
|
||||
<nd ref="400002" />
|
||||
<nd ref="400003" />
|
||||
<nd ref="400004" />
|
||||
<nd ref="400001" />
|
||||
</way>
|
||||
<way id="4001" version="1" timestamp="2019-01-01T00:00:00Z" visible="true">
|
||||
<nd ref="400005" />
|
||||
<nd ref="400006" />
|
||||
<nd ref="400007" />
|
||||
<nd ref="400008" />
|
||||
</way>
|
||||
<way id="4002" version="1" timestamp="2019-01-01T00:00:00Z" visible="true">
|
||||
<nd ref="400005" />
|
||||
<nd ref="400008" />
|
||||
<tag k="boundary" v="maritime"/>
|
||||
</way>
|
||||
<relation id="400" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" changeset="1" user="u" uid="1">
|
||||
<member type="way" ref="4000" role="outer"/>
|
||||
<tag k="admin_level" v="8"/>
|
||||
<tag k="boundary" v="administrative"/>
|
||||
<tag k="name" v="OpenMapTiles City"/>
|
||||
<tag k="place" v="city"/>
|
||||
<tag k="type" v="boundary"/>
|
||||
</relation>
|
||||
<relation id="401" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" changeset="1" user="u" uid="1">
|
||||
<member type="way" ref="4000" role="inner"/>
|
||||
<member type="way" ref="4001" role="outer"/>
|
||||
<member type="way" ref="4002" role="outer"/>
|
||||
<tag k="admin_level" v="2"/>
|
||||
<tag k="boundary" v="administrative"/>
|
||||
<tag k="name" v="OpenMapTiles Nation"/>
|
||||
<tag k="type" v="boundary"/>
|
||||
</relation>
|
||||
</osm>
|
|
@ -0,0 +1,3 @@
|
|||
#Sat Sep 25 23:23:00 UTC 2021
|
||||
sequenceNumber=4730692
|
||||
timestamp=2021-09-25T23\:21\:58Z
|
|
@ -0,0 +1,88 @@
|
|||
-- Store test results
|
||||
|
||||
DROP TABLE IF EXISTS omt_test_failures;
|
||||
CREATE TABLE omt_test_failures(
|
||||
test_id integer,
|
||||
test_type varchar(6),
|
||||
error_message text
|
||||
);
|
||||
|
||||
-- Checks to ensure that test data was imported correctly
|
||||
DO $$
|
||||
|
||||
DECLARE
|
||||
cnt integer;
|
||||
|
||||
BEGIN
|
||||
|
||||
-- Test 100
|
||||
SELECT COUNT(*) INTO cnt FROM osm_park_polygon;
|
||||
IF cnt <> 3 THEN
|
||||
INSERT INTO omt_test_failures VALUES(100, 'import', 'osm_park_polygon expected 3, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(*) INTO cnt FROM osm_park_polygon_gen_z5;
|
||||
IF cnt <> 3 THEN
|
||||
INSERT INTO omt_test_failures VALUES(100, 'import', 'osm_park_polygon_gen_z5 expected 3, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(*) INTO cnt FROM osm_park_polygon_gen_z5 WHERE leisure='nature_reserve';
|
||||
IF cnt <> 1 THEN
|
||||
INSERT INTO omt_test_failures VALUES(100, 'import', 'osm_park_polygon_gen_z5 nature_reserve expected 1, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(*) INTO cnt FROM osm_park_polygon_gen_z5 WHERE boundary='protected_area';
|
||||
IF cnt <> 1 THEN
|
||||
INSERT INTO omt_test_failures VALUES(100, 'import', 'osm_park_polygon_gen_z5 protected_area expected 1, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(*) INTO cnt FROM osm_park_polygon_gen_z5 WHERE boundary='national_park';
|
||||
IF cnt <> 1 THEN
|
||||
INSERT INTO omt_test_failures VALUES(100, 'import', 'osm_park_polygon_gen_z5 national_park expected 1, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
-- Test 200
|
||||
SELECT COUNT(*) INTO cnt FROM osm_aerodrome_label_point;
|
||||
IF cnt <> 3 THEN
|
||||
INSERT INTO omt_test_failures VALUES(200, 'import', 'osm_aerodrome_label expected 3, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(*) INTO cnt FROM osm_aerodrome_label_point WHERE ele=123;
|
||||
IF cnt <> 1 THEN
|
||||
INSERT INTO omt_test_failures VALUES(200, 'import', 'osm_aerodrome_label ele=123 expected 1, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
-- Test 300
|
||||
SELECT COUNT(*) INTO cnt FROM osm_landcover_polygon WHERE mapping_key='natural' AND subclass='wood';
|
||||
IF cnt <> 1 THEN
|
||||
INSERT INTO omt_test_failures VALUES(300, 'import', 'osm_landcover_polygon natural=wood expected 1, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
-- Test 400
|
||||
SELECT COUNT(DISTINCT relation_id) INTO cnt FROM osm_border_linestring WHERE admin_level=8;
|
||||
IF cnt <> 1 THEN
|
||||
INSERT INTO omt_test_failures VALUES(400, 'update', 'osm_border_linestring city count expected 1, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(DISTINCT relation_id) INTO cnt FROM osm_border_linestring WHERE admin_level=2;
|
||||
IF cnt <> 1 THEN
|
||||
INSERT INTO omt_test_failures VALUES(400, 'update', 'osm_border_linestring country count expected 1, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
END;
|
||||
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
|
||||
DO $$
|
||||
|
||||
DECLARE
|
||||
cnt integer;
|
||||
BEGIN
|
||||
SELECT COUNT(*) INTO cnt FROM omt_test_failures;
|
||||
IF cnt > 0 THEN
|
||||
RAISE '% unit test(s) failed on imports. Details can be found in table omt_test_failures.', cnt USING ERRCODE = '0Z000';
|
||||
END IF;
|
||||
END;
|
||||
|
||||
$$;
|
|
@ -0,0 +1,67 @@
|
|||
-- Checks to ensure that test data was imported correctly
|
||||
DO $$
|
||||
|
||||
DECLARE
|
||||
cnt integer;
|
||||
|
||||
BEGIN
|
||||
|
||||
-- Clear prior results
|
||||
DELETE FROM omt_test_failures WHERE test_type='update';
|
||||
|
||||
-- Test 100: Verify re-tag of national_park to protected_area worked
|
||||
SELECT COUNT(*) INTO cnt FROM osm_park_polygon_gen_z5 WHERE boundary='national_park';
|
||||
IF cnt <> 0 THEN
|
||||
INSERT INTO omt_test_failures VALUES(100, 'update', 'osm_park_polygon_gen_z5 national_park expected 0, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(*) INTO cnt FROM osm_park_polygon_gen_z5 WHERE boundary='protected_area';
|
||||
IF cnt <> 2 THEN
|
||||
INSERT INTO omt_test_failures VALUES(100, 'update', 'osm_park_polygon_gen_z5 protected_area expected 2, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
-- Test 200: Verify aerodrome deleted and modified
|
||||
SELECT COUNT(*) INTO cnt FROM osm_aerodrome_label_point;
|
||||
IF cnt <> 2 THEN
|
||||
INSERT INTO omt_test_failures VALUES(200, 'update', 'osm_aerodrome_label_point expected 2, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(*) INTO cnt FROM osm_aerodrome_label_point WHERE icao='KOMT' AND ele='124' AND name='OpenMapTiles International Airport';
|
||||
IF cnt <> 1 THEN
|
||||
INSERT INTO omt_test_failures VALUES(200, 'update', 'osm_aerodrome_label_point failed to update attributes');
|
||||
END IF;
|
||||
|
||||
-- Test 300: Verify landuse modified
|
||||
SELECT COUNT(*) INTO cnt FROM osm_landcover_polygon WHERE mapping_key='natural' AND subclass='scrub';
|
||||
IF cnt <> 1 THEN
|
||||
INSERT INTO omt_test_failures VALUES(300, 'import', 'osm_landcover_polygon natural=scrub expected 1, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(*) INTO cnt FROM osm_landcover_polygon WHERE mapping_key='natural' AND subclass='wood';
|
||||
IF cnt <> 0 THEN
|
||||
INSERT INTO omt_test_failures VALUES(300, 'import', 'osm_landcover_polygon natural=wood expected 0, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
-- Test 400: Verify new city added
|
||||
SELECT COUNT(DISTINCT relation_id) INTO cnt FROM osm_border_linestring WHERE admin_level=8;
|
||||
IF cnt <> 2 THEN
|
||||
INSERT INTO omt_test_failures VALUES(400, 'update', 'osm_border_linestring city count expected 2, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
END;
|
||||
|
||||
$$;
|
||||
|
||||
|
||||
DO $$
|
||||
|
||||
DECLARE
|
||||
cnt integer;
|
||||
BEGIN
|
||||
SELECT COUNT(*) INTO cnt FROM omt_test_failures;
|
||||
IF cnt > 0 THEN
|
||||
RAISE '% unit test(s) failed on updates. Details can be found in table omt_test_failures.', cnt USING ERRCODE = '0Z000';
|
||||
END IF;
|
||||
END;
|
||||
|
||||
$$;
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<osmChange version="0.6" generator="Manual" timestamp="2020-01-02T00:00:00Z">
|
||||
<!--
|
||||
Test 100: Park polygons
|
||||
Move geometry
|
||||
Change name
|
||||
-->
|
||||
<modify>
|
||||
<!-- Move polygon positions -->
|
||||
<node id="100001" version="2" timestamp="2020-01-01T00:00:00Z" uid="1" user="u" changeset="2" lat="44.6" lon="-103.1"/>
|
||||
<node id="100002" version="2" timestamp="2020-01-01T00:00:00Z" uid="1" user="u" changeset="2" lat="40.6" lon="-103.1"/>
|
||||
<node id="100003" version="2" timestamp="2020-01-01T00:00:00Z" uid="1" user="u" changeset="2" lat="40.6" lon="-97.1"/>
|
||||
<node id="100004" version="2" timestamp="2020-01-01T00:00:00Z" uid="1" user="u" changeset="2" lat="44.6" lon="-97.1"/>
|
||||
|
||||
<!-- Change polygon tags -->
|
||||
<way id="1000" version="2" timestamp="2020-01-01T00:00:00Z" uid="1" user="u" changeset="2">
|
||||
<nd ref="100001" />
|
||||
<nd ref="100002" />
|
||||
<nd ref="100003" />
|
||||
<nd ref="100004" />
|
||||
<nd ref="100001" />
|
||||
<tag k="boundary" v="protected_area" /> <!-- Change from national_park -->
|
||||
<tag k="name" v="update-protected-area" /> <!-- Change from test-national-park -->
|
||||
</way>
|
||||
</modify>
|
||||
</osmChange>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<osmChange version="0.6" generator="Manual" timestamp="2020-01-02T00:00:00Z">
|
||||
<!--
|
||||
Test 200: Airports
|
||||
Delete airport
|
||||
Change elevation
|
||||
Add ICAO tag
|
||||
Change name
|
||||
-->
|
||||
<modify>
|
||||
<node id="200100" visible="true" timestamp="2020-01-02T00:00:00Z" version="1" lat="35.2" lon="-80.2">
|
||||
<tag k="aeroway" v="aerodrome"/>
|
||||
<tag k="ele" v="124"/>
|
||||
<tag k="icao" v="KOMT"/>
|
||||
<tag k="name" v="OpenMapTiles International Airport"/>
|
||||
</node>
|
||||
</modify>
|
||||
<delete>
|
||||
<node id="200101" timestamp="2020-01-02T00:00:00Z" uid="1" user="u" changeset="2" />
|
||||
</delete>
|
||||
</osmChange>
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<osmChange version="0.6" generator="Manual" timestamp="2020-01-02T00:00:00Z">
|
||||
<!--
|
||||
Test 300: Landcover
|
||||
Change type of land cover from wood to scrub
|
||||
-->
|
||||
<modify>
|
||||
<way id="3000" timestamp="2020-01-02T00:00:00Z" version="2">
|
||||
<nd ref="300001" />
|
||||
<nd ref="300002" />
|
||||
<nd ref="300003" />
|
||||
<nd ref="300004" />
|
||||
<nd ref="300001" />
|
||||
<tag k="natural" v="scrub"/>
|
||||
</way>
|
||||
</modify>
|
||||
</osmChange>
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<osmChange version="0.6" generator="Manual" timestamp="2020-01-02T00:00:00Z">
|
||||
<!--
|
||||
Test 400: Boundaries
|
||||
Add new boundary
|
||||
-->
|
||||
<create>
|
||||
<!-- Add new adjacent rectangular boundary -->
|
||||
<node id="400009" version="1" timestamp="2019-01-01T00:00:00Z" uid="1" user="u" changeset="2" lat="32.0" lon="-82.0" />
|
||||
<node id="400010" version="1" timestamp="2019-01-01T00:00:00Z" uid="1" user="u" changeset="2" lat="34.0" lon="-82.0" />
|
||||
|
||||
<way id="4003" version="2" timestamp="2020-01-01T00:00:00Z" uid="1" user="u" changeset="2">
|
||||
<nd ref="400007" />
|
||||
<nd ref="400008" />
|
||||
<nd ref="400009" />
|
||||
<nd ref="400010" />
|
||||
<nd ref="400007" />
|
||||
</way>
|
||||
|
||||
<relation id="402" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" changeset="1" user="u" uid="1">
|
||||
<member type="way" ref="4003" role="outer"/>
|
||||
<tag k="admin_level" v="8"/>
|
||||
<tag k="boundary" v="administrative"/>
|
||||
<tag k="name" v="OpenMapTiles Suburb"/>
|
||||
<tag k="place" v="suburb"/>
|
||||
<tag k="type" v="boundary"/>
|
||||
</relation>
|
||||
</create>
|
||||
</osmChange>
|