Skip to content

Commit 7c13330

Browse files
authored
Add remote tile collections (#35)
* Migrate tiles to remote host * Update mvt tile layer styling
1 parent 7cf0586 commit 7c13330

File tree

4 files changed

+25
-22
lines changed

4 files changed

+25
-22
lines changed

Dockerfile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,3 @@ RUN pip3 install --no-cache-dir --no-deps https://github.com/cgs-earth/pygeoapi-
1010

1111
COPY ./sitemap /sitemap
1212
RUN mv /sitemap/_sitemap.xml /sitemap/sitemap.xml
13-
14-
COPY ./tiles /tmp/tiles/
15-
RUN apt-get update \
16-
&& apt-get install -y unzip \
17-
&& mkdir -p /data/tiles \
18-
&& unzip /tmp/tiles/* -d /data/tiles/

pygeoapi-skin-dashboard/templates/collections/tiles/index.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,14 @@ <h3>Tiles</h3>
107107
maxZoom: {{ data['maxzoom'] }},
108108
indexMaxZoom: 5,
109109
getFeatureId: function(feat) {
110-
return feat.properties["id"]
110+
return feat.properties.id || feat.properties.fid;
111111
},
112112
vectorTileLayerStyles: {
113113
{{ data["id"] }}: function(properties, zoom) {
114114

115115
return {
116-
weight: 1,
116+
color: '#1B335F',
117+
weight: 0.25 + (zoom / 4),
117118
}
118119
}
119120
}
@@ -136,12 +137,13 @@ <h3>Tiles</h3>
136137
.openOn(map);
137138

138139
clearHighlight();
139-
highlight = e.layer.properties.id;
140+
console.log(e)
141+
highlight = e.layer.properties.id || e.layer.properties.fid;
140142
tilesPbfLayer.setFeatureStyle(highlight, {
141-
weight: 2,
142-
color: 'red',
143+
weight: e.layer.options.weight + 3,
144+
color: '#E6000B',
143145
opacity: 1,
144-
fillColor: 'red',
146+
fillColor: '#E6000B',
145147
fill: false,
146148
radius: 6,
147149
fillOpacity: 1

pygeoapi.config.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,17 @@ resources:
266266
object: '?huc'
267267
filter:
268268
- 'BIND(REPLACE(STR(?containedCatchment), "^.*ref/(hu[0-9]+)/.*$", "$1") AS ?hucLevel)'
269+
- &tile_defaults
270+
type: tile
271+
name: MVT-tippecanoe
272+
data: https://storage.googleapis.com/reference-tiles/hu08/{z}/{x}/{y}.pbf
273+
options:
274+
zoom:
275+
min: 0
276+
max: 10
277+
format:
278+
name: pbf
279+
mimetype: application/vnd.mapbox-vector-tile
269280
hu10:
270281
type: collection
271282
title: HU10
@@ -291,6 +302,8 @@ resources:
291302
table: hu10
292303
uri_field: uri
293304
geom_field: geom
305+
- <<: *tile_defaults
306+
data: https://storage.googleapis.com/reference-tiles/hu10/{z}/{x}/{y}.pbf
294307
nat_aq:
295308
type: collection
296309
title: USGS National Aquifers
@@ -525,16 +538,8 @@ resources:
525538
- subject: '?distribution'
526539
predicate: 'schema:encodingFormat'
527540
object: '?distributionFormat'
528-
- type: tile
529-
name: MVT-tippecanoe
530-
data: /data/tiles/mainstems/
531-
options:
532-
zoom:
533-
min: 0
534-
max: 10
535-
format:
536-
name: pbf
537-
mimetype: application/vnd.mapbox-vector-tile
541+
- <<: *tile_defaults
542+
data: https://storage.googleapis.com/reference-tiles/mainstems/{z}/{x}/{y}.pbf
538543

539544
dams: # updated 2024-04-23
540545
type: collection
@@ -689,6 +694,8 @@ resources:
689694
table: counties
690695
uri_field: uri
691696
geom_field: geom
697+
- <<: *tile_defaults
698+
data: https://storage.googleapis.com/reference-tiles/counties/{z}/{x}/{y}.pbf
692699
aiannh:
693700
type: collection
694701
title: American Indian/Alaska Native Areas/Hawaiian Home Lands (AIANNH)

tiles/mainstems.zip

-76.6 MB
Binary file not shown.

0 commit comments

Comments
 (0)