Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected shapes from z0 layer included in z13 tile #870

Closed
dwoznicki opened this issue Jun 27, 2022 · 7 comments · Fixed by #871
Closed

Unexpected shapes from z0 layer included in z13 tile #870

dwoznicki opened this issue Jun 27, 2022 · 7 comments · Fixed by #871

Comments

@dwoznicki
Copy link

With my custom layer setup, I've noticed that some tiles at higher zoom levels contain shapes from my base zoom level 0 table. This leads to some unexpected results, like the one below where I'd expect the entire 13/1314/3169 to be water.

image

It looks to me like this is happening for any tile that does not contain other layer data in it (you can see an extra land polygon in tile 13/1315/3170 which also should be pure water).

Here's my tegola.toml file.
[webserver]
port = ":8004"

[cache]
type = "file"
# basepath = "/nvme-ssd/tegola-cache"
basepath = "/tmp/tegola-cache"

[[providers]]
name = "all"
type = "mvt_postgis"
host = "localhost"
port = "5435"
database = "vector"
user = "ntk"
password = "storesomething"
max_connections = 300

    #--------------------------------------------------------------------------
    # Land areas
    [[providers.layers]]
    name = "land_areas_z0"
    geometry_fieldname = "geometry"
    id_fieldname = "id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, id, class, type, area, 'z0' AS t FROM ntk_land_areas_z0 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "land_areas_z1"
    geometry_fieldname = "geometry"
    id_fieldname = "id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, id, class, type, area, 'z1' AS t FROM ntk_land_areas_z1 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "land_areas_z2"
    geometry_fieldname = "geometry"
    id_fieldname = "id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, id, class, type, area, 'z2' AS t FROM ntk_land_areas_z2 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "land_areas_z3"
    geometry_fieldname = "geometry"
    id_fieldname = "id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, id, class, type, area, 'z3' AS t FROM ntk_land_areas_z3 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "land_areas_z4"
    geometry_fieldname = "geometry"
    id_fieldname = "id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, id, class, type, area, 'z4' AS t FROM ntk_land_areas_z4 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "land_areas_z5"
    geometry_fieldname = "geometry"
    id_fieldname = "id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, id, class, type, area, 'z5' AS t FROM ntk_land_areas_z5 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "land_areas_z6"
    geometry_fieldname = "geometry"
    id_fieldname = "id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, id, class, type, area, 'z6' AS t FROM ntk_land_areas_z6 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "land_areas_z7"
    geometry_fieldname = "geometry"
    id_fieldname = "id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, id, class, type, area, 'z7' AS t FROM ntk_land_areas_z7 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "land_areas_z8"
    geometry_fieldname = "geometry"
    id_fieldname = "id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, id, class, type, area, 'z8' AS t FROM ntk_land_areas_z8 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "land_areas"
    geometry_fieldname = "geometry"
    id_fieldname = "id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, id, class, type, 'base' AS t FROM ntk_land_areas WHERE geometry && !BBOX!"
    # sql = "SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid AS id, 'land' AS class, 'land' AS type FROM land_polygons WHERE wkb_geometry && !BBOX!"

    #--------------------------------------------------------------------------
    # Water areas
    [[providers.layers]]
    name = "water_areas_z0"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, area FROM ntk_water_areas_z0 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "water_areas_z1"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, area FROM ntk_water_areas_z1 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "water_areas_z2"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, area FROM ntk_water_areas_z2 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "water_areas_z3"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, area FROM ntk_water_areas_z3 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "water_areas_z4"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, area FROM ntk_water_areas_z4 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "water_areas_z5"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, area FROM ntk_water_areas_z5 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "water_areas_z6"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, area FROM ntk_water_areas_z6 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "water_areas_z7"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, area FROM ntk_water_areas_z7 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "water_areas_z8"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, area FROM ntk_water_areas_z8 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "water_areas_z9"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, area FROM ntk_water_areas_z9 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "water_areas_z10"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, area FROM ntk_water_areas_z10 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "water_areas"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "polygon"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, area FROM ntk_water_areas WHERE geometry && !BBOX!"

    #--------------------------------------------------------------------------
    # Country lines
    [[providers.layers]]
    name = "country_lines_z0"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime, CASE WHEN disputed THEN 1 ELSE 0 END AS disputed, disputed_by, claimed_by FROM ntk_country_lines_z0 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "country_lines_z1"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime, CASE WHEN disputed THEN 1 ELSE 0 END AS disputed, disputed_by, claimed_by FROM ntk_country_lines_z1 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "country_lines_z2"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime, CASE WHEN disputed THEN 1 ELSE 0 END AS disputed, disputed_by, claimed_by FROM ntk_country_lines_z2 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "country_lines_z3"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime, CASE WHEN disputed THEN 1 ELSE 0 END AS disputed, disputed_by, claimed_by FROM ntk_country_lines_z3 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "country_lines_z4"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime, CASE WHEN disputed THEN 1 ELSE 0 END AS disputed, disputed_by, claimed_by FROM ntk_country_lines_z4 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "country_lines_z5"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime, CASE WHEN disputed THEN 1 ELSE 0 END AS disputed, disputed_by, claimed_by FROM ntk_country_lines_z5 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "country_lines_z6"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime, CASE WHEN disputed THEN 1 ELSE 0 END AS disputed, disputed_by, claimed_by FROM ntk_country_lines_z6 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "country_lines_z7"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime, CASE WHEN disputed THEN 1 ELSE 0 END AS disputed, disputed_by, claimed_by FROM ntk_country_lines_z7 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "country_lines_z8"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime, CASE WHEN disputed THEN 1 ELSE 0 END AS disputed, disputed_by, claimed_by FROM ntk_country_lines_z8 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "country_lines"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime, CASE WHEN disputed THEN 1 ELSE 0 END AS disputed, disputed_by, claimed_by FROM ntk_country_lines WHERE geometry && !BBOX!"

    #--------------------------------------------------------------------------
    # State province lines
    [[providers.layers]]
    name = "state_province_lines_z0"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime FROM ntk_state_province_lines_z0 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "state_province_lines_z1"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime FROM ntk_state_province_lines_z1 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "state_province_lines_z2"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime FROM ntk_state_province_lines_z2 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "state_province_lines_z3"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime FROM ntk_state_province_lines_z3 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "state_province_lines_z4"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime FROM ntk_state_province_lines_z4 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "state_province_lines_z5"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime FROM ntk_state_province_lines_z5 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "state_province_lines_z6"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime FROM ntk_state_province_lines_z6 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "state_province_lines_z7"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime FROM ntk_state_province_lines_z7 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "state_province_lines_z8"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime FROM ntk_state_province_lines_z8 WHERE geometry && !BBOX!"

    [[providers.layers]]
    name = "state_province_lines"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    geometry_type = "linestring"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime FROM ntk_state_province_lines WHERE geometry && !BBOX!"

    #--------------------------------------------------------------------------
    # Continent points
    [[providers.layers]]
    name = "continent_points"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, name, tags->'name:en' AS name_en, class, type, importance FROM ntk_place_points WHERE type = 'continent' AND geometry && !BBOX!"

    #--------------------------------------------------------------------------
    # Marine points
    [[providers.layers]]
    name = "marine_points"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, name, tags->'name:en' AS name_en, class, type, importance FROM ntk_place_points WHERE type IN ('ocean', 'sea', 'bay') AND geometry && !BBOX!"

    #--------------------------------------------------------------------------
    # Country points
    [[providers.layers]]
    name = "country_points"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, name, tags->'name:en' AS name_en, class, type, importance FROM ntk_place_points WHERE type = 'country' AND geometry && !BBOX!"

    #--------------------------------------------------------------------------
    # State province points
    [[providers.layers]]
    name = "state_province_points"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, name, tags->'name:en' AS name_en, class, type, importance FROM ntk_place_points WHERE type IN ('state', 'province') AND geometry && !BBOX!"

    #--------------------------------------------------------------------------
    # Water points
    [[providers.layers]]
    name = "water_points"
    geometry_fieldname = "geometry"
    id_fieldname = "osm_id"
    sql = "SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, name, tags->'name:en' AS name_en, class, type, importance FROM ntk_water_points WHERE geometry && !BBOX!"

[[maps]]
name = "osm"
attribution = "OpenStreetMap"

    #--------------------------------------------------------------------------
    # Land areas
    [[maps.layers]]
    name = "land_areas"
    provider_layer = "all.land_areas_z0"
    min_zoom = 0
    max_zoom = 0
    
    [[maps.layers]]
    name = "land_areas"
    provider_layer = "all.land_areas_z1"
    min_zoom = 1
    max_zoom = 1
    
    [[maps.layers]]
    name = "land_areas"
    provider_layer = "all.land_areas_z2"
    min_zoom = 2
    max_zoom = 2
    
    [[maps.layers]]
    name = "land_areas"
    provider_layer = "all.land_areas_z3"
    min_zoom = 3
    max_zoom = 3
    
    [[maps.layers]]
    name = "land_areas"
    provider_layer = "all.land_areas_z4"
    min_zoom = 4
    max_zoom = 4
    
    [[maps.layers]]
    name = "land_areas"
    provider_layer = "all.land_areas_z5"
    min_zoom = 5
    max_zoom = 5
    
    [[maps.layers]]
    name = "land_areas"
    provider_layer = "all.land_areas_z6"
    min_zoom = 6
    max_zoom = 6
    
    [[maps.layers]]
    name = "land_areas"
    provider_layer = "all.land_areas_z7"
    min_zoom = 7
    max_zoom = 7
    
    [[maps.layers]]
    name = "land_areas"
    provider_layer = "all.land_areas_z8"
    min_zoom = 8
    max_zoom = 8
    
    [[maps.layers]]
    name = "land_areas"
    provider_layer = "all.land_areas"
    min_zoom = 9
    max_zoom = 20

    #--------------------------------------------------------------------------
    # Water areas
    [[maps.layers]]
    name = "water_areas"
    provider_layer = "all.water_areas_z0"
    min_zoom = 0
    max_zoom = 0

    [[maps.layers]]
    name = "water_areas"
    provider_layer = "all.water_areas_z1"
    min_zoom = 1
    max_zoom = 1

    [[maps.layers]]
    name = "water_areas"
    provider_layer = "all.water_areas_z2"
    min_zoom = 2
    max_zoom = 2

    [[maps.layers]]
    name = "water_areas"
    provider_layer = "all.water_areas_z3"
    min_zoom = 3
    max_zoom = 3

    [[maps.layers]]
    name = "water_areas"
    provider_layer = "all.water_areas_z4"
    min_zoom = 4
    max_zoom = 4

    [[maps.layers]]
    name = "water_areas"
    provider_layer = "all.water_areas_z5"
    min_zoom = 5
    max_zoom = 5

    [[maps.layers]]
    name = "water_areas"
    provider_layer = "all.water_areas_z6"
    min_zoom = 6
    max_zoom = 6

    [[maps.layers]]
    name = "water_areas"
    provider_layer = "all.water_areas_z7"
    min_zoom = 7
    max_zoom = 7

    [[maps.layers]]
    name = "water_areas"
    provider_layer = "all.water_areas_z8"
    min_zoom = 8
    max_zoom = 8

    [[maps.layers]]
    name = "water_areas"
    provider_layer = "all.water_areas_z9"
    min_zoom = 9
    max_zoom = 9

    [[maps.layers]]
    name = "water_areas"
    provider_layer = "all.water_areas_z10"
    min_zoom = 10
    max_zoom = 10

    [[maps.layers]]
    name = "water_areas"
    provider_layer = "all.water_areas"
    min_zoom = 11
    max_zoom = 20

    #--------------------------------------------------------------------------
    # Country lines
    [[maps.layers]]
    name = "country_lines"
    provider_layer = "all.country_lines_z0"
    min_zoom = 0
    max_zoom = 0

    [[maps.layers]]
    name = "country_lines"
    provider_layer = "all.country_lines_z1"
    min_zoom = 1
    max_zoom = 1

    [[maps.layers]]
    name = "country_lines"
    provider_layer = "all.country_lines_z2"
    min_zoom = 2
    max_zoom = 2

    [[maps.layers]]
    name = "country_lines"
    provider_layer = "all.country_lines_z3"
    min_zoom = 3
    max_zoom = 3

    [[maps.layers]]
    name = "country_lines"
    provider_layer = "all.country_lines_z4"
    min_zoom = 4
    max_zoom = 4

    [[maps.layers]]
    name = "country_lines"
    provider_layer = "all.country_lines_z5"
    min_zoom = 5
    max_zoom = 5

    [[maps.layers]]
    name = "country_lines"
    provider_layer = "all.country_lines_z6"
    min_zoom = 6
    max_zoom = 6

    [[maps.layers]]
    name = "country_lines"
    provider_layer = "all.country_lines_z7"
    min_zoom = 7
    max_zoom = 7

    [[maps.layers]]
    name = "country_lines"
    provider_layer = "all.country_lines_z8"
    min_zoom = 8
    max_zoom = 8

    [[maps.layers]]
    name = "country_lines"
    provider_layer = "all.country_lines"
    min_zoom = 9
    max_zoom = 20

    #--------------------------------------------------------------------------
    # State province lines
    [[maps.layers]]
    name = "state_province_lines"
    provider_layer = "all.state_province_lines_z2"
    min_zoom = 2
    max_zoom = 2

    [[maps.layers]]
    name = "state_province_lines"
    provider_layer = "all.state_province_lines_z3"
    min_zoom = 3
    max_zoom = 3

    [[maps.layers]]
    name = "state_province_lines"
    provider_layer = "all.state_province_lines_z4"
    min_zoom = 4
    max_zoom = 4

    [[maps.layers]]
    name = "state_province_lines"
    provider_layer = "all.state_province_lines_z5"
    min_zoom = 5
    max_zoom = 5

    [[maps.layers]]
    name = "state_province_lines"
    provider_layer = "all.state_province_lines_z6"
    min_zoom = 6
    max_zoom = 6

    [[maps.layers]]
    name = "state_province_lines"
    provider_layer = "all.state_province_lines_z7"
    min_zoom = 7
    max_zoom = 7

    [[maps.layers]]
    name = "state_province_lines"
    provider_layer = "all.state_province_lines_z8"
    min_zoom = 8
    max_zoom = 8

    [[maps.layers]]
    name = "state_province_lines"
    provider_layer = "all.state_province_lines"
    min_zoom = 9
    max_zoom = 20

    #--------------------------------------------------------------------------
    # Marine points
    [[maps.layers]]
    name = "marine_points"
    provider_layer = "all.marine_points"
    min_zoom = 0
    max_zoom = 20

    #--------------------------------------------------------------------------
    # Continent points
    [[maps.layers]]
    name = "continent_points"
    provider_layer = "all.continent_points"
    min_zoom = 0
    max_zoom = 20

    #--------------------------------------------------------------------------
    # Country points
    [[maps.layers]]
    name = "country_points"
    provider_layer = "all.country_points"
    min_zoom = 0
    max_zoom = 20

    #--------------------------------------------------------------------------
    # State province points
    [[maps.layers]]
    name = "state_province_points"
    provider_layer = "all.state_province_points"
    min_zoom = 2
    max_zoom = 20

    #--------------------------------------------------------------------------
    # Water points
    [[maps.layers]]
    name = "water_points"
    provider_layer = "all.water_points"
    min_zoom = 2
    max_zoom = 20

I can't quite set TEGOLA_SQL_DEBUG to print SQL statements right now, but here's the query for tile 13/1314/3169 in my PostgreSQL log. I've split the query at || to make it a bit more readable.

SELECT ((SELECT ST_AsMVT(q,'land_areas',4096,'geometry','id') AS data FROM (SELECT ST_AsMVTGeom(geometry, ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS geometry, id, class, type, area, 'z0' AS t FROM ntk_land_areas_z0 WHERE geometry && ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS q)
||(SELECT ST_AsMVT(q,'land_areas',4096,'geometry','id') AS data FROM (SELECT ST_AsMVTGeom(geometry, ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS geometry, id, class, type, 'base' AS t FROM ntk_land_areas WHERE geometry && ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS q)
||(SELECT ST_AsMVT(q,'water_areas',4096,'geometry','osm_id') AS data FROM (SELECT ST_AsMVTGeom(geometry, ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS geometry, osm_id, class, type, area FROM ntk_water_areas_z0 WHERE geometry && ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS q)
||(SELECT ST_AsMVT(q,'water_areas',4096,'geometry','osm_id') AS data FROM (SELECT ST_AsMVTGeom(geometry, ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS geometry, osm_id, class, type, area FROM ntk_water_areas WHERE geometry && ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS q)
||(SELECT ST_AsMVT(q,'country_lines',4096,'geometry','osm_id') AS data FROM (SELECT ST_AsMVTGeom(geometry, ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime, CASE WHEN disputed THEN 1 ELSE 0 END AS disputed, disputed_by, claimed_by FROM ntk_country_lines_z0 WHERE geometry && ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS q)
||(SELECT ST_AsMVT(q,'country_lines',4096,'geometry','osm_id') AS data FROM (SELECT ST_AsMVTGeom(geometry, ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime, CASE WHEN disputed THEN 1 ELSE 0 END AS disputed, disputed_by, claimed_by FROM ntk_country_lines WHERE geometry && ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS q)
||(SELECT ST_AsMVT(q,'state_province_lines',4096,'geometry','osm_id') AS data FROM (SELECT ST_AsMVTGeom(geometry, ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS geometry, osm_id, class, type, CASE WHEN maritime THEN 1 ELSE 0 END AS maritime FROM ntk_state_province_lines WHERE geometry && ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS q)
||(SELECT ST_AsMVT(q,'marine_points',4096,'geometry','osm_id') AS data FROM (SELECT ST_AsMVTGeom(geometry, ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS geometry, osm_id, name, tags->'name:en' AS name_en, class, type, importance FROM ntk_place_points WHERE type IN ('ocean', 'sea', 'bay') AND geometry && ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS q)
||(SELECT ST_AsMVT(q,'continent_points',4096,'geometry','osm_id') AS data FROM (SELECT ST_AsMVTGeom(geometry, ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS geometry, osm_id, name, tags->'name:en' AS name_en, class, type, importance FROM ntk_place_points WHERE type = 'continent' AND geometry && ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS q)
||(SELECT ST_AsMVT(q,'country_points',4096,'geometry','osm_id') AS data FROM (SELECT ST_AsMVTGeom(geometry, ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS geometry, osm_id, name, tags->'name:en' AS name_en, class, type, importance FROM ntk_place_points WHERE type = 'country' AND geometry && ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS q)
||(SELECT ST_AsMVT(q,'state_province_points',4096,'geometry','osm_id') AS data FROM (SELECT ST_AsMVTGeom(geometry, ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS geometry, osm_id, name, tags->'name:en' AS name_en, class, type, importance FROM ntk_place_points WHERE type IN ('state', 'province') AND geometry && ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS q)
||(SELECT ST_AsMVT(q,'water_points',4096,'geometry','osm_id') AS data FROM (SELECT ST_AsMVTGeom(geometry, ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS geometry, osm_id, name, tags->'name:en' AS name_en, class, type, importance FROM ntk_water_points WHERE geometry && ST_MakeEnvelope(-1.360946001022461e+07,4.52018010404297e+06,-1.3599676070605468e+07,4.5299640436621085e+06,3857)) AS q)) AS data

It looks like Tegola makes a query to my ntk_land_areas_z0 at the start, which is probably bringing in the extra polygon. Is there something I can do to fix this?

@dwoznicki dwoznicki changed the title Unexpected shapes from z0 layer included in z12 tile Unexpected shapes from z0 layer included in z13 tile Jun 27, 2022
@iwpnd
Copy link
Member

iwpnd commented Jul 1, 2022

What version of tegola are you using? Can you start it with --log-level DEBUG to see if something pops up?

@dwoznicki
Copy link
Author

I'm fairly certain I'm on v0.15.1. I didn't see any additional logs pop up when I ran the Tegola server with --log-level DEBUG.

@iwpnd
Copy link
Member

iwpnd commented Jul 2, 2022

@dwoznicki Pretty sure I found the issue. Tegola does not filter by zoom level properly if min/max zoom is 0. You can validate that for me real quick. Set it to 1 for the layer in question and see if it still queries it. If so, I can fix it maybe tomorrow afternoon/evening.

@dwoznicki
Copy link
Author

Nice! I've confirmed that changing max_zoom = 0 to max_zoom = 1 in my first land layer solves the issue.

@iwpnd
Copy link
Member

iwpnd commented Jul 10, 2022

Awesome @dwoznicki, when @ARolek is back we'll discuss how we fix this for good :)

@ARolek
Copy link
Member

ARolek commented Jul 17, 2022

@dwoznicki thanks for the report! And @iwpnd thanks for the debugging help. Did you figure out a fix for this?

@ARolek
Copy link
Member

ARolek commented Jul 17, 2022

Did you figure out a fix for this?

Never mind this comment. I see you sent in a PR!

iwpnd added a commit to iwpnd/tegola that referenced this issue Jul 24, 2022
as per go-spatial#870, setting max_zoom to 0 currently causes the layer to bleed through
over the entire zoom range. Either we fix filtering as per go-spatial#871
or make sure max_zoom is never 0 as I do in this PR.
@gdey gdey closed this as completed in #871 Aug 30, 2022
gdey pushed a commit to iwpnd/tegola that referenced this issue Aug 30, 2022
as per go-spatial#870, setting max_zoom to 0 currently causes the layer to bleed through
over the entire zoom range. Either we fix filtering as per go-spatial#871
or make sure max_zoom is never 0 as I do in this PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants