From 3fcad4009a8fe279eee277a160f1a3aa720b71e9 Mon Sep 17 00:00:00 2001 From: Alexander Rolek Date: Tue, 30 May 2017 11:19:23 -0700 Subject: [PATCH] implemented http request context & removed http.CloseNotifier. Bumped required Go version to 1.8+ in readme. --- README.md | 2 +- cmd/tegola/static/bonn/mapbox/index.html | 28 + cmd/tegola/static/bonn/mapbox/js/mapbox.json | 3677 ++++++++++++++++++ cmd/tegola/static/bonn/{ => ol}/index.html | 3 - cmd/tegola/static/bonn/{ => ol}/js/style.js | 0 provider/postgis/postgis.go | 4 +- server/handle_map_layer_zxy.go | 23 +- server/handle_map_zxy.go | 40 +- 8 files changed, 3741 insertions(+), 36 deletions(-) create mode 100644 cmd/tegola/static/bonn/mapbox/index.html create mode 100644 cmd/tegola/static/bonn/mapbox/js/mapbox.json rename cmd/tegola/static/bonn/{ => ol}/index.html (89%) rename cmd/tegola/static/bonn/{ => ol}/js/style.js (100%) diff --git a/README.md b/README.md index 6131beec4..2750cc0e7 100644 --- a/README.md +++ b/README.md @@ -174,7 +174,7 @@ The requested tile will be encode a layer with the `name` value set to `debug` a ## Building from source -Tegola is written in [Go](https://golang.org/) and requires Go 1.7+ to compile from source. To build tegola from source, make sure you have Go installed and have cloned the repository to your `$GOPATH` or `$GOROOT`. Navigate to the repository then run the following commands: +Tegola is written in [Go](https://golang.org/) and requires Go 1.8+ to compile from source. To build tegola from source, make sure you have Go installed and have cloned the repository to your `$GOPATH` or `$GOROOT`. Navigate to the repository then run the following commands: ```bash cd cmd/tegola/ diff --git a/cmd/tegola/static/bonn/mapbox/index.html b/cmd/tegola/static/bonn/mapbox/index.html new file mode 100644 index 000000000..d5060d32b --- /dev/null +++ b/cmd/tegola/static/bonn/mapbox/index.html @@ -0,0 +1,28 @@ + + + + + Tegola Mapbox Demo + + + + + + +
+ + + \ No newline at end of file diff --git a/cmd/tegola/static/bonn/mapbox/js/mapbox.json b/cmd/tegola/static/bonn/mapbox/js/mapbox.json new file mode 100644 index 000000000..c97fccf5f --- /dev/null +++ b/cmd/tegola/static/bonn/mapbox/js/mapbox.json @@ -0,0 +1,3677 @@ +{ + "version": 8, + "name": "HOTOSMstyle", + "metadata": { + "mapbox:autocomposite": false, + "mapbox:type": "template", + "maputnik:renderer": "mbgljs", + "openmaptiles:version": "3.x", + "openmaptiles:mapbox:owner": "openmaptiles", + "openmaptiles:mapbox:source:url": "mapbox://openmaptiles.4qljc88t" + }, + "center": [ + 8.54806714892635, + 47.37180823552663 + ], + "zoom": 12.241790506353492, + "bearing": 0, + "pitch": 0, + "sources": { + "tegola-osm": { + "type": "vector", + "url": "http://localhost:8080/capabilities/osm.json?debug=true" + } + }, + "glyphs": "https://free.tilehosting.com/fonts/{fontstack}/{range}.pbf?key={key}", + "layers": [ + { + "id": "background", + "type": "background", + "minzoom": 0, + "maxzoom": 20, + "layout": { + "visibility": "visible" + }, + "paint": { + "background-color": "rgba(144, 204, 203, 1)" + } + }, + { + "id": "land_10-20", + "type": "fill", + "source": "tegola-osm", + "source-layer": "land_10-20", + "minzoom": 10, + "maxzoom": 20, + "paint": { + "fill-color": "rgba(247, 246, 241, 1)" + } + }, + { + "id": "land_0-9", + "type": "fill", + "source": "tegola-osm", + "source-layer": "land_0-9", + "maxzoom": 10, + "paint": { + "fill-color": "rgba(247, 246, 241, 1)" + } + }, + { + "id": "landusages", + "type": "fill", + "source": "tegola-osm", + "source-layer": "landusages", + "minzoom": 13, + "maxzoom": 24, + "paint": { + "fill-color": { + "property": "type", + "type": "categorical", + "stops": [ + [ + "", + "rgba(202, 57, 57, 0)" + ], + [ + "wetland", + "rgba(227, 233, 226, 1)" + ], + [ + "military", + "rgba(209, 191, 170, 1)" + ], + [ + "salt_pond", + "rgba(236, 240, 241, 1)" + ], + [ + "basin", + "rgba(144, 204, 203, 1)" + ], + [ + "beach", + "rgba(238, 229, 178, 1)" + ], + [ + "desert", + "rgba(238, 229, 178, 1)" + ], + [ + "farmland", + "rgba(222, 221, 190, 1)" + ], + [ + "farm", + "rgba(222, 221, 190, 1)" + ], + [ + "orchard", + "rgba(222, 221, 190, 1)" + ], + [ + "allotments", + "rgba(222, 221, 190, 1)" + ], + [ + "heath", + "rgba(225, 233, 214, 1)" + ], + [ + "meadow", + "rgba(225, 233, 214, 1)" + ], + [ + "residential", + "rgba(237, 236, 231, 1)" + ], + [ + "retail", + "rgba(237, 236, 231, 1)" + ], + [ + "industrial", + "rgba(215, 200, 203, 1)" + ], + [ + "quarry", + "rgba(215, 200, 203, 1)" + ], + [ + "landfill", + "rgba(215, 200, 203, 1)" + ], + [ + "college", + "rgba(226, 214, 205, 1)" + ], + [ + "school", + "rgba(226, 214, 205, 1)" + ], + [ + "education", + "rgba(226, 214, 205, 1)" + ], + [ + "university", + "rgba(226, 214, 205, 1)" + ], + [ + "cemetery", + "rgba(214, 222, 210, 1)" + ], + [ + "grave_yard", + "rgba(214, 222, 210, 1)" + ], + [ + "park", + "rgba(208, 220, 174, 1)" + ], + [ + "sports_centre", + "rgba(208, 220, 174, 1)" + ], + [ + "stadium", + "rgba(208, 220, 174, 1)" + ], + [ + "grass", + "rgba(208, 220, 174, 1)" + ], + [ + "grassland", + "rgba(208, 220, 174, 1)" + ], + [ + "garden", + "rgba(208, 220, 174, 1)" + ], + [ + "village_green", + "rgba(208, 220, 174, 1)" + ], + [ + "recreation_ground", + "rgba(208, 220, 174, 1)" + ], + [ + "picnic_site", + "rgba(208, 220, 174, 1)" + ], + [ + "camp_site", + "rgba(208, 220, 174, 1)" + ], + [ + "playground", + "rgba(208, 220, 174, 1)" + ], + [ + "forest", + "rgba(178, 194, 157, 1)" + ], + [ + "wood", + "rgba(178, 194, 157, 1)" + ], + [ + "nature_reserve", + "rgba(178, 194, 157, 1)" + ] + ] + } + } + }, + { + "id": "landusages_gen1forest", + "type": "fill", + "source": "tegola-osm", + "source-layer": "landusages_gen1", + "minzoom": 10, + "maxzoom": 13, + "filter": [ + "all", + [ + "in", + "type", + "forest", + "wood", + "nature_reserve" + ] + ], + "paint": { + "fill-color": "rgba(178, 194, 157, 1)" + } + }, + { + "id": "landusages_gen1park", + "type": "fill", + "source": "tegola-osm", + "source-layer": "landusages_gen1", + "minzoom": 10, + "maxzoom": 13, + "filter": [ + "all", + [ + "==", + "type", + "park" + ] + ], + "paint": { + "fill-color": "rgba(208, 220, 174, 1)" + } + }, + { + "id": "landusages_gen0_z9", + "type": "fill", + "source": "tegola-osm", + "source-layer": "landusages_gen0", + "minzoom": 7, + "maxzoom": 10, + "filter": [ + "all", + [ + "in", + "type", + "forest", + "wood", + "nature_reserve" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "fill-color": "rgba(178, 194, 157, 1)" + } + }, + { + "id": "landusages_gen0_z7", + "type": "fill", + "source": "tegola-osm", + "source-layer": "landusages_gen0", + "minzoom": 5, + "maxzoom": 7, + "filter": [ + "all", + [ + "in", + "type", + "forest", + "wood" + ], + [ + ">", + "area", + 50000000 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "fill-color": "rgba(178, 194, 157, 1)" + } + }, + { + "id": "landusages_gen0_z5", + "type": "fill", + "source": "tegola-osm", + "source-layer": "landusages_gen0", + "minzoom": 3, + "maxzoom": 5, + "filter": [ + "all", + [ + "in", + "type", + "forest", + "wood" + ], + [ + ">", + "area", + 500000000 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "fill-color": "rgba(178, 194, 157, 1)" + } + }, + { + "id": "buildings_flat", + "type": "fill", + "source": "tegola-osm", + "source-layer": "buildings", + "minzoom": 14, + "maxzoom": 24, + "filter": [ + "all" + ], + "layout": { + "visibility": "none" + }, + "paint": { + "fill-color": "rgba(220, 215, 215, 1)", + "fill-outline-color": "rgba(195, 188, 188, 1)" + } + }, + { + "id": "waterways", + "type": "line", + "source": "tegola-osm", + "source-layer": "waterways", + "minzoom": 15, + "maxzoom": 20, + "filter": [ + "all", + [ + "!in", + "type", + "stream", + "drain", + "ditch" + ] + ], + "paint": { + "line-color": "rgba(144, 204, 203, 1)", + "line-width": { + "stops": [ + [ + 15, + 5 + ], + [ + 20, + 8 + ] + ] + } + } + }, + { + "id": "waterways_stream", + "type": "line", + "source": "tegola-osm", + "source-layer": "waterways", + "minzoom": 15, + "maxzoom": 20, + "filter": [ + "all", + [ + "==", + "type", + "stream" + ] + ], + "paint": { + "line-color": "rgba(144, 204, 203, 1)", + "line-width": { + "stops": [ + [ + 15, + 0.8 + ], + [ + 20, + 2 + ] + ] + } + } + }, + { + "id": "waterways_ditch", + "type": "line", + "source": "tegola-osm", + "source-layer": "waterways", + "minzoom": 15, + "maxzoom": 20, + "filter": [ + "all", + [ + "in", + "type", + "ditch", + "drain" + ] + ], + "paint": { + "line-color": "rgba(144, 204, 203, 1)", + "line-width": { + "stops": [ + [ + 15, + 0.2 + ], + [ + 20, + 1.5 + ] + ] + } + } + }, + { + "id": "waterways_gen1", + "type": "line", + "source": "tegola-osm", + "source-layer": "waterways_gen1", + "minzoom": 13, + "maxzoom": 15, + "filter": [ + "all", + [ + "!=", + "type", + "stream" + ] + ], + "paint": { + "line-color": "rgba(144, 204, 203, 1)", + "line-width": { + "stops": [ + [ + 13, + 1 + ], + [ + 14, + 1.5 + ] + ] + } + } + }, + { + "id": "waterways_gen1stream", + "type": "line", + "source": "tegola-osm", + "source-layer": "waterways_gen1", + "minzoom": 13, + "maxzoom": 15, + "filter": [ + "all", + [ + "==", + "type", + "stream" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(144, 204, 203, 1)", + "line-width": { + "stops": [ + [ + 13, + 0.5 + ], + [ + 14, + 0.8 + ] + ] + } + } + }, + { + "id": "waterways_gen0", + "type": "line", + "source": "tegola-osm", + "source-layer": "waterways_gen0", + "minzoom": 8, + "maxzoom": 13, + "filter": [ + "all", + [ + "in", + "type", + "river", + "canal" + ] + ], + "paint": { + "line-color": "rgba(144, 204, 203, 1)", + "line-width": { + "stops": [ + [ + 8, + 0.1 + ], + [ + 13, + 0.8 + ] + ] + } + } + }, + { + "id": "waterareas", + "type": "fill", + "source": "tegola-osm", + "source-layer": "waterareas", + "minzoom": 13, + "maxzoom": 20, + "paint": { + "fill-color": "rgba(144, 204, 203, 1)" + } + }, + { + "id": "waterareas_gen1", + "type": "fill", + "source": "tegola-osm", + "source-layer": "waterareas_gen1", + "minzoom": 10, + "maxzoom": 13, + "paint": { + "fill-color": "rgba(144, 204, 203, 1)" + } + }, + { + "id": "waterareas_gen0_z9", + "type": "fill", + "source": "tegola-osm", + "source-layer": "waterareas_gen0", + "minzoom": 5, + "maxzoom": 10, + "layout": { + "visibility": "visible" + }, + "paint": { + "fill-color": "rgba(144, 204, 203, 1)" + } + }, + { + "id": "waterareas_gen0_z5", + "type": "fill", + "source": "tegola-osm", + "source-layer": "waterareas_gen0", + "minzoom": 3, + "maxzoom": 5, + "filter": [ + "all", + [ + ">", + "area", + 1000000000 + ] + ], + "layout": { + "visibility": "none" + }, + "paint": { + "fill-color": "rgba(144, 204, 203, 1)" + } + }, + { + "id": "roads14_trackfillcase", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "minzoom": 0, + "maxzoom": 24, + "filter": [ + "all", + [ + "==", + "type", + "track" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(239, 221, 203, 1)", + "line-width": { + "stops": [ + [ + 14, + 4 + ], + [ + 20, + 16 + ] + ] + } + } + }, + { + "id": "roads14_trackfill", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "minzoom": 0, + "maxzoom": 24, + "filter": [ + "all", + [ + "==", + "type", + "track" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(251, 247, 245, 1)", + "line-width": { + "stops": [ + [ + 14, + 1 + ], + [ + 20, + 3 + ] + ] + } + } + }, + { + "id": "roads14_track", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "maxzoom": 24, + "filter": [ + "all", + [ + "==", + "type", + "track" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(218, 191, 164, 1)", + "line-dasharray": [ + 2, + 5 + ], + "line-width": 2 + } + }, + { + "id": "roads14_footway", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "maxzoom": 24, + "filter": [ + "all", + [ + "in", + "type", + "footway", + "cycleway" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(191, 147, 98, 1)", + "line-width": 1, + "line-dasharray": [ + 1, + 2 + ] + } + }, + { + "id": "roads14_pier", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "maxzoom": 24, + "filter": [ + "all", + [ + "==", + "type", + "pier" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(255, 255, 255, 1)", + "line-width": 4 + } + }, + { + "id": "roads14_railyard", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "minzoom": 0, + "maxzoom": 24, + "filter": [ + "any", + [ + "in", + "type", + "rail", + "disused" + ], + [ + "in", + "service", + "yard", + "siding" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(153, 153, 153, 1)", + "line-width": { + "stops": [ + [ + 15, + 0.35 + ], + [ + 20, + 2.25 + ] + ] + } + } + }, + { + "id": "roads14_rail", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "maxzoom": 24, + "filter": [ + "all", + [ + "==", + "type", + "rail" + ], + [ + "!in", + "service", + "yard", + "siding" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(153, 153, 153, 1)", + "line-width": { + "stops": [ + [ + 14, + 1.25 + ], + [ + 20, + 2.25 + ] + ] + } + } + }, + { + "id": "roads14_residentialcase", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "minzoom": 0, + "maxzoom": 24, + "filter": [ + "all", + [ + "in", + "type", + "residential", + "service", + "unclassified", + "steps", + "living_street", + "raceway" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(226, 225, 221, 1)", + "line-width": { + "stops": [ + [ + 14, + 4 + ], + [ + 18, + 16 + ] + ] + } + } + }, + { + "id": "roads14_residential", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "maxzoom": 24, + "filter": [ + "all", + [ + "==", + "type", + "residential" + ] + ], + "paint": { + "line-color": "rgba(237, 236, 231, 1)", + "line-width": { + "stops": [ + [ + 14, + 1 + ], + [ + 15, + 1.5 + ], + [ + 16, + 1.5 + ], + [ + 17, + 2 + ], + [ + 18, + 3 + ] + ] + } + } + }, + { + "id": "roads14_tertiarytunnel", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "minzoom": 0, + "filter": [ + "all", + [ + "==", + "type", + "tertiary" + ], + [ + "==", + "tunnel", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(245, 237, 179, 1)", + "line-width": { + "stops": [ + [ + 14, + 3.5 + ], + [ + 15, + 4 + ], + [ + 16, + 6 + ], + [ + 17, + 8 + ], + [ + 18, + 12 + ] + ] + } + } + }, + { + "id": "roads14_tertiarycase", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "filter": [ + "all", + [ + "==", + "type", + "tertiary" + ], + [ + "!=", + "tunnel", + 1 + ], + [ + "!=", + "bridge", + 1 + ] + ], + "paint": { + "line-color": "rgba(194, 186, 128, 1)", + "line-width": { + "stops": [ + [ + 14, + 3.5 + ], + [ + 15, + 4 + ], + [ + 16, + 6 + ], + [ + 17, + 8 + ], + [ + 18, + 12 + ] + ] + } + } + }, + { + "id": "roads14_tertiarybridge", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "filter": [ + "all", + [ + "==", + "type", + "tertiary" + ], + [ + "==", + "bridge", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(169, 161, 103, 1)", + "line-width": { + "stops": [ + [ + 14, + 3.5 + ], + [ + 15, + 4 + ], + [ + 16, + 6 + ], + [ + 17, + 8 + ], + [ + 18, + 12 + ] + ] + } + } + }, + { + "id": "roads14_tertiary", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "filter": [ + "all", + [ + "==", + "type", + "tertiary" + ], + [ + "!=", + "tunnel", + 1 + ] + ], + "paint": { + "line-color": "rgba(219, 211, 153, 1)", + "line-width": { + "stops": [ + [ + 14, + 1 + ], + [ + 18, + 3 + ] + ] + } + } + }, + { + "id": "roads14_secondarytunnel", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "filter": [ + "all", + [ + "==", + "type", + "secondary" + ], + [ + "==", + "tunnel", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(255, 229, 202, 1)", + "line-width": { + "stops": [ + [ + 14, + 4.5 + ], + [ + 15, + 5 + ], + [ + 16, + 8 + ], + [ + 17, + 10 + ], + [ + 18, + 14 + ] + ] + } + } + }, + { + "id": "roads14_secondarycase", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "filter": [ + "all", + [ + "==", + "type", + "secondary" + ], + [ + "!=", + "tunnel", + 1 + ], + [ + "!=", + "bridge", + 1 + ] + ], + "paint": { + "line-color": "rgba(208, 178, 151, 1)", + "line-width": { + "stops": [ + [ + 14, + 4.5 + ], + [ + 15, + 5 + ], + [ + 16, + 8 + ], + [ + 17, + 10 + ], + [ + 18, + 14 + ] + ] + } + } + }, + { + "id": "roads14_secondarybridge", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "filter": [ + "all", + [ + "==", + "type", + "secondary" + ], + [ + "==", + "bridge", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(183, 153, 126, 1)", + "line-width": { + "stops": [ + [ + 14, + 4.5 + ], + [ + 15, + 5 + ], + [ + 16, + 8 + ], + [ + 17, + 10 + ], + [ + 18, + 14 + ] + ] + } + } + }, + { + "id": "roads14_secondary", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "filter": [ + "all", + [ + "==", + "type", + "secondary" + ], + [ + "!=", + "tunnel", + 1 + ] + ], + "paint": { + "line-color": "rgba(233, 203, 176, 1)", + "line-width": { + "stops": [ + [ + 14, + 2 + ], + [ + 17, + 2 + ], + [ + 18, + 3 + ] + ] + } + } + }, + { + "id": "roads14_primarytunnel", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "filter": [ + "all", + [ + "==", + "type", + "primary" + ], + [ + "==", + "tunnel", + 1 + ] + ], + "paint": { + "line-color": "rgba(236, 173, 168, 1)", + "line-width": { + "stops": [ + [ + 14, + 4.5 + ], + [ + 15, + 5 + ], + [ + 16, + 8 + ], + [ + 17, + 10 + ], + [ + 18, + 14 + ] + ] + } + } + }, + { + "id": "roads14_primarycase", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "maxzoom": 20, + "filter": [ + "all", + [ + "==", + "type", + "primary" + ], + [ + "!=", + "tunnel", + 1 + ], + [ + "!=", + "bridge", + 1 + ] + ], + "layout": { + "line-cap": "butt" + }, + "paint": { + "line-color": "rgba(185, 122, 117, 1)", + "line-width": { + "stops": [ + [ + 14, + 4.5 + ], + [ + 15, + 5 + ], + [ + 16, + 8 + ], + [ + 17, + 10 + ], + [ + 18, + 14 + ] + ] + } + } + }, + { + "id": "roads14_primarybridge", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "maxzoom": 20, + "filter": [ + "all", + [ + "==", + "type", + "primary" + ], + [ + "==", + "bridge", + 1 + ] + ], + "layout": { + "line-cap": "butt", + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(160, 97, 92, 1)", + "line-width": { + "stops": [ + [ + 14, + 4.5 + ], + [ + 15, + 5 + ], + [ + 16, + 8 + ], + [ + 17, + 10 + ], + [ + 18, + 14 + ] + ] + } + } + }, + { + "id": "roads14_primary", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "filter": [ + "all", + [ + "==", + "type", + "primary" + ], + [ + "!=", + "tunnel", + 1 + ] + ], + "paint": { + "line-color": "rgba(210, 147, 142, 1)", + "line-width": { + "stops": [ + [ + 14, + 2 + ], + [ + 17, + 2 + ], + [ + 18, + 3 + ] + ] + } + } + }, + { + "id": "roads14_motorwaytunnel", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "minzoom": 13, + "maxzoom": 20, + "filter": [ + "all", + [ + "in", + "type", + "motorway", + "motorway_link", + "trunk", + "trunk_link" + ], + [ + "==", + "tunnel", + 1 + ] + ], + "layout": { + "visibility": "visible", + "line-cap": "butt", + "line-join": "miter" + }, + "paint": { + "line-color": "rgba(186, 178, 202, 1)", + "line-width": { + "stops": [ + [ + 14, + 5 + ], + [ + 15, + 6 + ], + [ + 16, + 8 + ], + [ + 17, + 10 + ], + [ + 18, + 16 + ] + ] + } + } + }, + { + "id": "roads14_motorwaycase", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "minzoom": 13, + "maxzoom": 20, + "filter": [ + "all", + [ + "in", + "type", + "motorway", + "motorway_link", + "trunk", + "trunk_link" + ], + [ + "!=", + "tunnel", + 1 + ], + [ + "!=", + "bridge", + 1 + ] + ], + "layout": { + "visibility": "visible", + "line-cap": "butt", + "line-join": "miter" + }, + "paint": { + "line-color": "rgba(135, 127, 151, 1)", + "line-width": { + "stops": [ + [ + 14, + 5 + ], + [ + 15, + 6 + ], + [ + 16, + 8 + ], + [ + 17, + 10 + ], + [ + 18, + 16 + ] + ] + } + } + }, + { + "id": "roads14_motorwaybridge", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "minzoom": 13, + "maxzoom": 20, + "filter": [ + "all", + [ + "in", + "type", + "motorway", + "motorway_link", + "trunk", + "trunk_link" + ], + [ + "==", + "bridge", + 1 + ] + ], + "layout": { + "visibility": "visible", + "line-cap": "butt", + "line-join": "miter" + }, + "paint": { + "line-color": "rgba(110, 102, 126, 1)", + "line-width": { + "stops": [ + [ + 14, + 5 + ], + [ + 15, + 6 + ], + [ + 16, + 8 + ], + [ + 17, + 10 + ], + [ + 18, + 16 + ] + ] + } + } + }, + { + "id": "roads14_motorway", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "minzoom": 13, + "maxzoom": 20, + "filter": [ + "all", + [ + "in", + "type", + "motorway", + "motorway_link", + "trunk", + "trunk_link" + ], + [ + "!=", + "tunnel", + 1 + ] + ], + "layout": { + "visibility": "visible", + "line-cap": "butt", + "line-join": "miter" + }, + "paint": { + "line-color": "rgba(160, 152, 176, 1)", + "line-width": { + "stops": [ + [ + 14, + 2 + ], + [ + 15, + 2.5 + ], + [ + 16, + 2.5 + ], + [ + 17, + 3 + ], + [ + 18, + 4 + ] + ] + } + } + }, + { + "id": "roads13_rail", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "maxzoom": 24, + "filter": [ + "all", + [ + "==", + "type", + "rail" + ], + [ + "!in", + "service", + "yard", + "siding" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(153, 153, 153, 1)", + "line-width": { + "stops": [ + [ + 13, + 1 + ], + [ + 14, + 1.25 + ] + ] + } + } + }, + { + "id": "roads13_residentialcase", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "minzoom": 0, + "maxzoom": 24, + "filter": [ + "all", + [ + "==", + "type", + "residential" + ] + ], + "paint": { + "line-color": "rgba(237, 236, 231, 1)", + "line-width": { + "stops": [ + [ + 13, + 2.5 + ], + [ + 14, + 2 + ] + ] + } + } + }, + { + "id": "roads13_residential", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "maxzoom": 24, + "filter": [ + "all", + [ + "==", + "type", + "residential" + ] + ], + "paint": { + "line-color": "rgba(237, 236, 231, 1)" + } + }, + { + "id": "roads13_tertiarytunnel", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "minzoom": 0, + "filter": [ + "all", + [ + "==", + "type", + "tertiary" + ], + [ + "==", + "tunnel", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(245, 237, 179, 1)", + "line-width": 3.5 + } + }, + { + "id": "roads13_tertiarycase", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "filter": [ + "all", + [ + "==", + "type", + "tertiary" + ], + [ + "!=", + "tunnel", + 1 + ], + [ + "!=", + "bridge", + 1 + ] + ], + "paint": { + "line-color": "rgba(194, 186, 128, 1)", + "line-width": 3.5 + } + }, + { + "id": "roads13_tertiarybridge", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "filter": [ + "all", + [ + "==", + "type", + "tertiary" + ], + [ + "==", + "bridge", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(169, 161, 103, 1)", + "line-width": 3.5 + } + }, + { + "id": "roads13_tertiary", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "filter": [ + "all", + [ + "==", + "type", + "tertiary" + ], + [ + "!=", + "tunnel", + 1 + ] + ], + "paint": { + "line-color": "rgba(219, 211, 153, 1)" + } + }, + { + "id": "roads13_secondarytunnel", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "filter": [ + "all", + [ + "==", + "type", + "secondary" + ], + [ + "==", + "tunnel", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(255, 229, 202, 1)", + "line-width": 4.5 + } + }, + { + "id": "roads13_secondarycase", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "filter": [ + "all", + [ + "==", + "type", + "secondary" + ], + [ + "!=", + "tunnel", + 1 + ], + [ + "!=", + "bridge", + 1 + ] + ], + "paint": { + "line-color": "rgba(208, 178, 151, 1)", + "line-width": 4.5 + } + }, + { + "id": "roads13_secondarybridge", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "filter": [ + "all", + [ + "==", + "type", + "secondary" + ], + [ + "==", + "bridge", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(183, 153, 126, 1)", + "line-width": 4.5 + } + }, + { + "id": "roads13_secondary", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "filter": [ + "all", + [ + "==", + "type", + "secondary" + ], + [ + "!=", + "tunnel", + 1 + ] + ], + "paint": { + "line-color": "rgba(233, 203, 176, 1)", + "line-width": 2 + } + }, + { + "id": "roads13_primarytunnel", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "filter": [ + "all", + [ + "==", + "type", + "primary" + ], + [ + "==", + "tunnel", + 1 + ] + ], + "paint": { + "line-color": "rgba(236, 173, 168, 1)", + "line-width": 4.5 + } + }, + { + "id": "roads13_primarycase", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "maxzoom": 14, + "filter": [ + "all", + [ + "==", + "type", + "primary" + ], + [ + "!=", + "tunnel", + 1 + ], + [ + "!=", + "bridge", + 1 + ] + ], + "layout": { + "line-cap": "butt" + }, + "paint": { + "line-color": "rgba(185, 122, 117, 1)", + "line-width": 4.5 + } + }, + { + "id": "roads13_primarybridge", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "maxzoom": 14, + "filter": [ + "all", + [ + "==", + "type", + "primary" + ], + [ + "==", + "bridge", + 1 + ] + ], + "layout": { + "line-cap": "butt", + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(160, 97, 92, 1)", + "line-width": 4.5 + } + }, + { + "id": "roads13_primary", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "filter": [ + "all", + [ + "==", + "type", + "primary" + ], + [ + "!=", + "tunnel", + 1 + ] + ], + "paint": { + "line-color": "rgba(210, 147, 142, 1)", + "line-width": 2 + } + }, + { + "id": "roads13_motorwaytunnel", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "minzoom": 13, + "maxzoom": 14, + "filter": [ + "all", + [ + "in", + "type", + "motorway", + "motorway_link", + "trunk", + "trunk_link" + ], + [ + "==", + "tunnel", + 1 + ] + ], + "layout": { + "visibility": "visible", + "line-cap": "butt", + "line-join": "miter" + }, + "paint": { + "line-color": "rgba(186, 178, 202, 1)", + "line-width": 5 + } + }, + { + "id": "roads13_motorwaycase", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "minzoom": 13, + "maxzoom": 14, + "filter": [ + "all", + [ + "in", + "type", + "motorway", + "motorway_link", + "trunk", + "trunk_link" + ], + [ + "!=", + "tunnel", + 1 + ], + [ + "!=", + "bridge", + 1 + ] + ], + "layout": { + "visibility": "visible", + "line-cap": "butt", + "line-join": "miter" + }, + "paint": { + "line-color": "rgba(135, 127, 151, 1)", + "line-width": 5 + } + }, + { + "id": "roads13_motorwaybridge", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "minzoom": 13, + "maxzoom": 14, + "filter": [ + "all", + [ + "in", + "type", + "motorway", + "motorway_link", + "trunk", + "trunk_link" + ], + [ + "==", + "bridge", + 1 + ] + ], + "layout": { + "visibility": "visible", + "line-cap": "butt", + "line-join": "miter" + }, + "paint": { + "line-color": "rgba(110, 102, 126, 1)", + "line-width": 5 + } + }, + { + "id": "roads13_motorway", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_13", + "minzoom": 13, + "filter": [ + "all", + [ + "in", + "type", + "motorway", + "motorway_link", + "trunk", + "trunk_link" + ], + [ + "!=", + "tunnel", + 1 + ] + ], + "layout": { + "visibility": "visible", + "line-cap": "butt", + "line-join": "miter" + }, + "paint": { + "line-color": "rgba(160, 152, 176, 1)", + "line-width": 2 + } + }, + { + "id": "roads11_rail", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 12, + "maxzoom": 13, + "filter": [ + "all", + [ + "==", + "type", + "rail" + ], + [ + "!in", + "service", + "yard", + "siding" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(153, 153, 153, 1)", + "line-width": 1 + } + }, + { + "id": "roads11_tertiarytunnel", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 12, + "maxzoom": 13, + "filter": [ + "all", + [ + "==", + "type", + "tertiary" + ], + [ + "==", + "tunnel", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(245, 237, 179, 1)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 13, + 3.6 + ] + ] + } + } + }, + { + "id": "roads11_tertiarycase", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 12, + "maxzoom": 13, + "filter": [ + "all", + [ + "==", + "type", + "tertiary" + ], + [ + "!=", + "tunnel", + 1 + ], + [ + "!=", + "bridge", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(194, 186, 128, 1)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 13, + 3.5 + ] + ] + } + } + }, + { + "id": "roads11_tertiarybridge", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 12, + "maxzoom": 13, + "filter": [ + "all", + [ + "==", + "type", + "tertiary" + ], + [ + "==", + "bridge", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(169, 161, 103, 1)", + "line-width": { + "stops": [ + [ + 12, + 2 + ], + [ + 13, + 3.5 + ] + ] + } + } + }, + { + "id": "roads11_tertiary", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 12, + "maxzoom": 13, + "filter": [ + "all", + [ + "==", + "type", + "tertiary" + ], + [ + "!=", + "tunnel", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(219, 211, 153, 1)", + "line-width": 1 + } + }, + { + "id": "roads11_secondarytunnel", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 11, + "maxzoom": 13, + "filter": [ + "all", + [ + "==", + "type", + "secondary" + ], + [ + "==", + "tunnel", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(255, 229, 202, 1)", + "line-width": { + "stops": [ + [ + 11, + 3 + ], + [ + 13, + 4.5 + ] + ] + } + } + }, + { + "id": "roads11_secondarycase", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 11, + "maxzoom": 13, + "filter": [ + "all", + [ + "==", + "type", + "secondary" + ], + [ + "!=", + "tunnel", + 1 + ], + [ + "!=", + "bridge", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(208, 178, 151, 1)", + "line-width": { + "stops": [ + [ + 11, + 3 + ], + [ + 13, + 4.5 + ] + ] + } + } + }, + { + "id": "roads11_secondarybridge", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 11, + "maxzoom": 13, + "filter": [ + "all", + [ + "==", + "type", + "secondary" + ], + [ + "==", + "bridge", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(183, 153, 126, 1)", + "line-width": { + "stops": [ + [ + 11, + 3 + ], + [ + 13, + 4.5 + ] + ] + } + } + }, + { + "id": "roads11_secondary", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 11, + "maxzoom": 13, + "filter": [ + "all", + [ + "==", + "type", + "secondary" + ], + [ + "!=", + "tunnel", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(233, 203, 176, 1)", + "line-width": { + "stops": [ + [ + 11, + 1 + ], + [ + 13, + 2 + ] + ] + } + } + }, + { + "id": "roads11_primarytunnel", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 11, + "maxzoom": 13, + "filter": [ + "all", + [ + "==", + "type", + "primary" + ], + [ + "==", + "tunnel", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(236, 173, 168, 1)", + "line-width": { + "stops": [ + [ + 11, + 3 + ], + [ + 13, + 4.5 + ] + ] + }, + "line-offset": 0, + "line-blur": 0 + } + }, + { + "id": "roads11_primarycase", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 11, + "maxzoom": 13, + "filter": [ + "all", + [ + "==", + "type", + "primary" + ], + [ + "!=", + "tunnel", + 1 + ], + [ + "!=", + "bridge", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(185, 122, 117, 1)", + "line-width": { + "stops": [ + [ + 11, + 3 + ], + [ + 13, + 4.5 + ] + ] + } + } + }, + { + "id": "roads11_primarybridge", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 11, + "maxzoom": 13, + "filter": [ + "all", + [ + "==", + "type", + "primary" + ], + [ + "==", + "bridge", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(160, 97, 92, 1)", + "line-width": { + "stops": [ + [ + 11, + 3 + ], + [ + 13, + 4.5 + ] + ] + } + } + }, + { + "id": "roads11_primary", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 11, + "maxzoom": 13, + "filter": [ + "all", + [ + "==", + "type", + "primary" + ], + [ + "!=", + "tunnel", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(210, 147, 142, 1)", + "line-width": { + "stops": [ + [ + 11, + 1 + ], + [ + 13, + 2 + ] + ] + } + } + }, + { + "id": "roads11_motorwaytunnel", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 11, + "maxzoom": 13, + "filter": [ + "all", + [ + "in", + "type", + "motorway", + "motorway_link", + "trunk", + "trunk_link" + ], + [ + "==", + "tunnel", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(186, 178, 202, 1)", + "line-width": { + "stops": [ + [ + 11, + 3 + ], + [ + 13, + 5 + ] + ] + } + } + }, + { + "id": "roads11_motorwaycase", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 11, + "maxzoom": 13, + "filter": [ + "all", + [ + "in", + "type", + "motorway", + "motorway_link", + "trunk", + "trunk_link" + ], + [ + "!=", + "tunnel", + 1 + ], + [ + "!=", + "bridge", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(135, 127, 151, 1)", + "line-width": { + "stops": [ + [ + 11, + 3 + ], + [ + 13, + 5 + ] + ] + } + } + }, + { + "id": "roads11_motorwaybridge-copy", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 11, + "maxzoom": 13, + "filter": [ + "all", + [ + "in", + "type", + "motorway", + "motorway_link", + "trunk", + "trunk_link" + ], + [ + "==", + "bridge", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(110, 102, 126, 1)", + "line-width": { + "stops": [ + [ + 11, + 3 + ], + [ + 13, + 5 + ] + ] + } + } + }, + { + "id": "roads11_motorway", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "minzoom": 11, + "maxzoom": 13, + "filter": [ + "all", + [ + "in", + "type", + "motorway", + "motorway_link", + "trunk", + "trunk_link" + ], + [ + "!=", + "tunnel", + 1 + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(160, 152, 176, 1)", + "line-width": { + "stops": [ + [ + 11, + 1 + ], + [ + 13, + 2 + ] + ] + } + } + }, + { + "id": "roadsgen1_secondary", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_gen1", + "minzoom": 9, + "maxzoom": 11, + "filter": [ + "all", + [ + "==", + "type", + "secondary" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(233, 203, 176, 1)", + "line-width": { + "stops": [ + [ + 9, + 0.6 + ], + [ + 11, + 0.8 + ] + ] + } + } + }, + { + "id": "roadsgen1_primary", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_gen1", + "minzoom": 9, + "maxzoom": 11, + "filter": [ + "all", + [ + "==", + "type", + "primary" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(210, 147, 142, 1)", + "line-width": { + "stops": [ + [ + 9, + 0.6 + ], + [ + 11, + 0.8 + ] + ] + } + } + }, + { + "id": "roadsgen1_links", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_gen1", + "minzoom": 9, + "maxzoom": 11, + "filter": [ + "all", + [ + "in", + "type", + "motorway_link" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(160, 152, 176, 1)", + "line-width": { + "stops": [ + [ + 9, + 0.6 + ], + [ + 11, + 0.8 + ] + ] + } + } + }, + { + "id": "roadsgen1_motorwaytrunk", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_gen1", + "minzoom": 9, + "maxzoom": 11, + "filter": [ + "all", + [ + "in", + "type", + "motorway", + "link" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(160, 152, 176, 1)", + "line-width": { + "stops": [ + [ + 9, + 1.4 + ], + [ + 11, + 1.8 + ] + ] + } + } + }, + { + "id": "roadsgen0_trunk", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_gen0", + "minzoom": 4, + "maxzoom": 9, + "filter": [ + "all", + [ + "==", + "type", + "trunk" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(160, 152, 176, 1)", + "line-width": { + "stops": [ + [ + 5, + 0.2 + ], + [ + 7, + 0.3 + ], + [ + 8, + 0.5 + ] + ] + } + } + }, + { + "id": "roadsgen0_motorway", + "type": "line", + "source": "tegola-osm", + "source-layer": "roads_gen0", + "minzoom": 4, + "maxzoom": 9, + "filter": [ + "all", + [ + "==", + "type", + "motorway" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(160, 152, 176, 1)", + "line-width": { + "stops": [ + [ + 5, + 0.4 + ], + [ + 7, + 0.6 + ], + [ + 8, + 1 + ] + ] + } + } + }, + { + "id": "admin_statelines4", + "type": "line", + "source": "tegola-osm", + "source-layer": "admin_states_provinces_lines_3-4", + "minzoom": 3, + "maxzoom": 5, + "paint": { + "line-width": 1, + "line-color": "#A59C9B", + "line-dasharray": [ + 10, + 5 + ] + } + }, + { + "id": "admin_boundaries6", + "type": "line", + "source": "tegola-osm", + "source-layer": "admin_boundaries_5-6", + "minzoom": 5, + "maxzoom": 7, + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(83, 112, 118, 1)" + } + }, + { + "id": "admin_boundariesdisputed4", + "type": "line", + "source": "tegola-osm", + "source-layer": "admin_boundaries_disputed_3-4", + "minzoom": 3, + "maxzoom": 5, + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(83, 112, 118, 1)", + "line-dasharray": [ + 4, + 1 + ], + "line-width": 1 + } + }, + { + "id": "admin_boundaries4", + "type": "line", + "source": "tegola-osm", + "source-layer": "admin_boundaries_3-4", + "minzoom": 3, + "maxzoom": 5, + "layout": { + "visibility": "visible" + }, + "paint": { + "line-color": "rgba(83, 112, 118, 1)" + } + }, + { + "id": "admin_boundaries2", + "type": "line", + "source": "tegola-osm", + "source-layer": "admin_boundaries_0-2", + "minzoom": 0, + "maxzoom": 3, + "paint": { + "line-color": "rgba(83, 112, 118, 1)" + } + }, + { + "id": "roadlabels_most", + "type": "symbol", + "source": "tegola-osm", + "source-layer": "roads_14-20", + "minzoom": 0, + "filter": [ + "all" + ], + "layout": { + "text-field": "{name}", + "symbol-placement": "line", + "symbol-spacing": 250, + "symbol-avoid-edges": false, + "text-size": { + "stops": [ + [ + 13, + 10 + ], + [ + 20, + 18 + ] + ] + }, + "text-padding": 2, + "text-allow-overlap": false, + "text-pitch-alignment": "auto", + "text-rotation-alignment": "auto" + }, + "paint": { + "text-color": "rgba(82, 82, 82, 1)", + "text-halo-width": 1, + "text-halo-color": "rgba(255, 255, 255, 0.8)" + } + }, + { + "id": "roadlabels_some2", + "type": "symbol", + "source": "tegola-osm", + "source-layer": "roads_13", + "filter": [ + "all", + [ + "in", + "type", + "motorway", + "trunk" + ] + ], + "layout": { + "text-field": "{name}", + "symbol-placement": "line", + "symbol-spacing": 250, + "symbol-avoid-edges": false, + "text-size": 10, + "text-padding": 2, + "text-allow-overlap": false, + "text-pitch-alignment": "auto", + "text-rotation-alignment": "auto" + }, + "paint": { + "text-color": "rgba(82, 82, 82, 1)", + "text-halo-width": 1, + "text-halo-color": "rgba(255, 255, 255, 0.8)" + } + }, + { + "id": "roadlabels_some", + "type": "symbol", + "source": "tegola-osm", + "source-layer": "roads_11-12", + "filter": [ + "all", + [ + "in", + "type", + "motorway", + "trunk" + ] + ], + "layout": { + "text-field": "{name}", + "symbol-placement": "line", + "symbol-spacing": 250, + "symbol-avoid-edges": false, + "text-size": 10, + "text-padding": 2, + "text-allow-overlap": false, + "text-pitch-alignment": "auto", + "text-rotation-alignment": "auto" + }, + "paint": { + "text-color": "rgba(82, 82, 82, 1)", + "text-halo-width": 1, + "text-halo-color": "rgba(255, 255, 255, 0.8)" + } + }, + { + "id": "waterareaslabels_bigest", + "type": "symbol", + "source": "tegola-osm", + "source-layer": "waterareas_gen1", + "minzoom": 8, + "maxzoom": 24, + "filter": [ + "all", + [ + ">", + "area", + 10000000 + ] + ], + "layout": { + "text-field": "{name}", + "text-font": [ + "Open Sans Italic", + "Arial Unicode MS Regular" + ], + "text-padding": 2, + "text-allow-overlap": false, + "text-size": { + "stops": [ + [ + 15, + 11 + ], + [ + 20, + 20 + ] + ] + } + }, + "paint": { + "text-color": "rgba(68, 136, 136, 1)", + "text-halo-width": 1, + "text-halo-color": "rgba(178, 220, 220, 1)" + } + }, + { + "id": "waterareaslabels_big", + "type": "symbol", + "source": "tegola-osm", + "source-layer": "waterareas", + "minzoom": 12, + "maxzoom": 24, + "filter": [ + "all", + [ + ">", + "area", + 100000000 + ] + ], + "layout": { + "text-field": "{name}", + "text-font": [ + "Open Sans Italic", + "Arial Unicode MS Regular" + ], + "text-padding": 2, + "text-allow-overlap": false, + "text-size": { + "stops": [ + [ + 15, + 11 + ], + [ + 20, + 20 + ] + ] + } + }, + "paint": { + "text-color": "rgba(68, 136, 136, 1)", + "text-halo-width": 1, + "text-halo-color": "rgba(178, 220, 220, 1)" + } + }, + { + "id": "waterareaslabels_small", + "type": "symbol", + "source": "tegola-osm", + "source-layer": "waterareas", + "minzoom": 15, + "maxzoom": 24, + "filter": [ + "all", + [ + ">", + "area", + 100000 + ] + ], + "layout": { + "text-field": "{name}", + "text-font": [ + "Open Sans Italic", + "Arial Unicode MS Regular" + ], + "text-padding": 2, + "text-allow-overlap": false, + "text-size": { + "stops": [ + [ + 15, + 11 + ], + [ + 20, + 20 + ] + ] + } + }, + "paint": { + "text-color": "rgba(68, 136, 136, 1)", + "text-halo-width": 1, + "text-halo-color": "rgba(178, 220, 220, 1)" + } + }, + { + "id": "waterwaysabels_gen1", + "type": "symbol", + "source": "tegola-osm", + "source-layer": "waterways_gen1", + "layout": { + "text-field": "{name}", + "text-font": [ + "Open Sans Italic", + "Arial Unicode MS Regular" + ], + "symbol-placement": "line", + "text-pitch-alignment": "auto", + "text-rotation-alignment": "auto", + "text-size": 11, + "symbol-spacing": 500, + "text-anchor": "bottom" + }, + "paint": { + "text-color": "rgba(68, 136, 136, 1)", + "text-halo-color": "rgba(178, 220, 220, 1)", + "text-halo-width": 1 + } + }, + { + "id": "waterwayslabels", + "type": "symbol", + "source": "tegola-osm", + "source-layer": "waterways", + "layout": { + "text-field": "{name}", + "text-font": [ + "Open Sans Italic", + "Arial Unicode MS Regular" + ], + "symbol-placement": "line", + "text-pitch-alignment": "auto", + "text-rotation-alignment": "auto", + "text-anchor": "bottom", + "text-size": 13, + "symbol-spacing": 500 + }, + "paint": { + "text-color": "rgba(68, 136, 136, 1)", + "text-halo-color": "rgba(178, 220, 220, 1)", + "text-halo-width": 1 + } + }, + { + "id": "buildings_tilt_na", + "type": "fill-extrusion", + "source": "tegola-osm", + "source-layer": "buildings", + "filter": [ + "all", + [ + "!has", + "height" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "fill-extrusion-color": { + "property": "type", + "type": "categorical", + "stops": [ + [ + "", + "rgba(220, 215, 215, 1)" + ], + [ + "school", + "rgba(249, 233, 222, 1)" + ], + [ + "university", + "rgba(249, 233, 222, 1)" + ], + [ + "college", + "rgba(249, 233, 222, 1)" + ], + [ + "hospital", + "rgba(229, 198, 195, 1)" + ] + ] + }, + "fill-extrusion-height": 5, + "fill-extrusion-base": 0 + } + }, + { + "id": "buildings_tilt", + "type": "fill-extrusion", + "source": "tegola-osm", + "source-layer": "buildings", + "filter": [ + "all", + [ + "has", + "height" + ] + ], + "layout": { + "visibility": "visible" + }, + "paint": { + "fill-extrusion-color": { + "property": "type", + "type": "categorical", + "stops": [ + [ + "", + "rgba(220, 215, 215, 1)" + ], + [ + "school", + "rgba(249, 233, 222, 1)" + ], + [ + "university", + "rgba(249, 233, 222, 1)" + ], + [ + "college", + "rgba(249, 233, 222, 1)" + ], + [ + "hospital", + "rgba(229, 198, 195, 1)" + ] + ] + }, + "fill-extrusion-height": { + "property": "height", + "type": "identity" + }, + "fill-extrusion-base": 0 + } + }, + { + "id": "landusageslabels_park", + "type": "symbol", + "source": "tegola-osm", + "source-layer": "landusages", + "minzoom": 14, + "maxzoom": 24, + "filter": [ + "all", + [ + "in", + "type", + "park", + "sports_centre", + "stadium", + "grass", + "grassland", + "garden", + "village_green", + "recreation_ground", + "picnic_site", + "camp_site", + "playground" + ], + [ + ">", + "area", + 12000 + ] + ], + "layout": { + "text-field": "{name}", + "text-size": 11 + }, + "paint": { + "text-color": "rgba(122, 143, 61, 1)", + "text-halo-color": "rgba(228, 235, 209, 1)", + "text-halo-width": 1 + } + }, + { + "id": "landusageslabels_forest", + "type": "symbol", + "source": "tegola-osm", + "source-layer": "landusages", + "minzoom": 14, + "maxzoom": 24, + "filter": [ + "all", + [ + "in", + "type", + "forest", + "wood", + "nature_reserve" + ] + ], + "layout": { + "text-field": "{name}", + "text-size": 11 + }, + "paint": { + "text-color": "rgba(95, 107, 71, 1)", + "text-halo-color": "rgba(201, 213, 190, 1)", + "text-halo-width": 1 + } + }, + { + "id": "landusageslabels_school", + "type": "symbol", + "source": "tegola-osm", + "source-layer": "landusages", + "minzoom": 14, + "maxzoom": 24, + "filter": [ + "all", + [ + "in", + "type", + "college", + "school", + "education", + "university", + "" + ] + ], + "layout": { + "text-field": "{name}", + "text-size": 11 + }, + "paint": { + "text-color": "rgba(176, 130, 130, 1)", + "text-halo-color": "rgba(245, 239, 239, 1)", + "text-halo-width": 1 + } + } + ], + "id": "ciwf4zbsv007y2pmt2rspc1dc", + "owner": "" +} \ No newline at end of file diff --git a/cmd/tegola/static/bonn/index.html b/cmd/tegola/static/bonn/ol/index.html similarity index 89% rename from cmd/tegola/static/bonn/index.html rename to cmd/tegola/static/bonn/ol/index.html index 663a4c26d..adf32c9b8 100644 --- a/cmd/tegola/static/bonn/index.html +++ b/cmd/tegola/static/bonn/ol/index.html @@ -38,9 +38,6 @@ zoom: 14 }) }); - - // ol.style.Fill, ol.style.Icon, ol.style.Stroke, ol.style.Style and - // ol.style.Text are required for createMapboxStreetsV6Style() diff --git a/cmd/tegola/static/bonn/js/style.js b/cmd/tegola/static/bonn/ol/js/style.js similarity index 100% rename from cmd/tegola/static/bonn/js/style.js rename to cmd/tegola/static/bonn/ol/js/style.js diff --git a/provider/postgis/postgis.go b/provider/postgis/postgis.go index 8ff11ff85..e7c691fa0 100644 --- a/provider/postgis/postgis.go +++ b/provider/postgis/postgis.go @@ -367,9 +367,10 @@ func (p Provider) MVTLayer(ctx context.Context, layerName string, tile tegola.Ti return nil, fmt.Errorf("Don't know of the layer %v", layerName) } + // replace the various tokens we support (i.e. !BBOX!, !ZOOM!) with balues sql, err := replaceTokens(&plyr, tile) if err != nil { - return nil, fmt.Errorf("Got the following error (%v) running this sql (%v)", err, sql) + return nil, err } // do a quick context check: @@ -414,6 +415,7 @@ func (p Provider) MVTLayer(ctx context.Context, layerName string, tile tegola.Ti if ctx.Err() != nil { return nil, mvt.ErrCanceled } + switch fdescs[i].Name { case plyr.GeomFieldName: if geobytes, ok = v.([]byte); !ok { diff --git a/server/handle_map_layer_zxy.go b/server/handle_map_layer_zxy.go index fa0bdfb94..b2f53e8ac 100644 --- a/server/handle_map_layer_zxy.go +++ b/server/handle_map_layer_zxy.go @@ -8,8 +8,6 @@ import ( "strings" "sync" - "context" - "github.com/dimfeld/httptreemux" "github.com/golang/protobuf/proto" "github.com/terranodo/tegola" @@ -146,6 +144,7 @@ func (req HandleMapLayerZXY) ServeHTTP(w http.ResponseWriter, r *http.Request) { errMsg := fmt.Sprintf("layer (%v) not configured for map (%v)", req.layerName, req.mapName) log.Println(errMsg) http.Error(w, errMsg, http.StatusBadRequest) + return } } @@ -163,13 +162,16 @@ func (req HandleMapLayerZXY) ServeHTTP(w http.ResponseWriter, r *http.Request) { defer wg.Done() // fetch layer from data provider - mvtLayer, err := l.Provider.MVTLayer(context.Background(), l.Name, tile, l.DefaultTags) + mvtLayer, err := l.Provider.MVTLayer(r.Context(), l.Name, tile, l.DefaultTags) + if err == mvt.ErrCanceled { + return + } if err != nil { - errMsg := fmt.Sprintf("Error Getting MVTLayer: %v", err) - log.Println(errMsg) - http.Error(w, errMsg, http.StatusBadRequest) + log.Printf("Error Getting MVTLayer: %v", err) + http.Error(w, fmt.Sprintf("Error Getting MVTLayer: %v", err.Error()), http.StatusInternalServerError) return } + // add the layer to the slice position mvtLayers[i] = mvtLayer }(i, l) @@ -178,6 +180,13 @@ func (req HandleMapLayerZXY) ServeHTTP(w http.ResponseWriter, r *http.Request) { // wait for the waitgroup to finish wg.Wait() + // stop processing if the context has an error. this check is necessary + // otherwise the server continues processing even if the request was canceled + // as the waitgroup was not notified of the cancel + if r.Context().Err() != nil { + return + } + // add layers to our tile mvtTile.AddLayers(mvtLayers...) } @@ -190,7 +199,7 @@ func (req HandleMapLayerZXY) ServeHTTP(w http.ResponseWriter, r *http.Request) { } // generate our vector tile - vtile, err := mvtTile.VTile(context.Background(), tile.BoundingBox()) + vtile, err := mvtTile.VTile(r.Context(), tile.BoundingBox()) if err != nil { errMsg := fmt.Sprintf("Error Getting VTile: %v", err.Error()) log.Println(errMsg) diff --git a/server/handle_map_zxy.go b/server/handle_map_zxy.go index d501f6389..7eb00b4d8 100644 --- a/server/handle_map_zxy.go +++ b/server/handle_map_zxy.go @@ -1,7 +1,6 @@ package server import ( - "context" "fmt" "log" "net/http" @@ -115,23 +114,6 @@ func (req HandleMapZXY) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - // decorate our request context to make it cancelable - ctx, cancel := context.WithCancel(r.Context()) - - // shallow copy of the request with the cancel context - rCtx := r.WithContext(ctx) - - // listen for the cancel event - notifyCancel := w.(http.CloseNotifier).CloseNotify() - go func() { - select { - case <-notifyCancel: - cancel() - case <-ctx.Done(): - // work complete - } - }() - // new tile tile := tegola.Tile{ Z: req.z, @@ -157,27 +139,37 @@ func (req HandleMapZXY) ServeHTTP(w http.ResponseWriter, r *http.Request) { wg.Add(len(ls)) // iterate our layers - for i, l := range ls { - // go routine for rendering the layer + for i, layer := range ls { + // go routine for fetching the layer concurrently go func(i int, l Layer) { // on completion let the wait group know defer wg.Done() // fetch layer from data provider - mvtLayer, err := l.Provider.MVTLayer(rCtx.Context(), l.Name, tile, l.DefaultTags) + mvtLayer, err := l.Provider.MVTLayer(r.Context(), l.Name, tile, l.DefaultTags) + if err == mvt.ErrCanceled { + return + } if err != nil { log.Printf("Error Getting MVTLayer: %v", err) - http.Error(w, fmt.Sprintf("Error Getting MVTLayer: %v", err.Error()), http.StatusBadRequest) + http.Error(w, fmt.Sprintf("Error Getting MVTLayer: %v", err.Error()), http.StatusInternalServerError) return } // add the layer to the slice position mvtLayers[i] = mvtLayer - }(i, l) + }(i, layer) } // wait for the waitgroup to finish wg.Wait() + // stop processing if the context has an error. this check is necessary + // otherwise the server continues processing even if the request was canceled + // as the waitgroup was not notified of the cancel + if r.Context().Err() != nil { + return + } + // add layers to our tile mvtTile.AddLayers(mvtLayers...) } @@ -190,7 +182,7 @@ func (req HandleMapZXY) ServeHTTP(w http.ResponseWriter, r *http.Request) { } // generate our vector tile - vtile, err := mvtTile.VTile(rCtx.Context(), tile.BoundingBox()) + vtile, err := mvtTile.VTile(r.Context(), tile.BoundingBox()) if err != nil { // log.Printf("Error Getting VTile: %v", err) http.Error(w, fmt.Sprintf("Error Getting VTile: %v", err.Error()), http.StatusBadRequest)