From 2d73eb0886ea728a0425ec6e67de74e0c32ad1e8 Mon Sep 17 00:00:00 2001 From: evlist Date: Sat, 28 Jan 2023 19:05:39 +0100 Subject: [PATCH] Minor enhancements --- src/components/gpx/styles.ts | 13 ++++++++- src/components/overlays/Overlays.tsx | 27 +++---------------- .../overlays/overlay-definitions.ts | 5 +++- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/src/components/gpx/styles.ts b/src/components/gpx/styles.ts index e57e548..3600b1c 100644 --- a/src/components/gpx/styles.ts +++ b/src/components/gpx/styles.ts @@ -320,7 +320,18 @@ const styles = { }), }, getParameters: (feature: Feature) => { - const tags = JSON.parse(feature.get('tags')); + let tags = {}; + try { + tags = JSON.parse(feature.get('tags')); + } catch (error) { + tags = { error }; + console.error({ + caller: 'style / JSON.parse', + tags: feature.get('tags'), + error, + feature, + }); + } if (getZoomInteger() < 12 && !['iwn', 'nwn'].includes(tags.network)) { return null; } diff --git a/src/components/overlays/Overlays.tsx b/src/components/overlays/Overlays.tsx index 5090ab8..883b0b4 100644 --- a/src/components/overlays/Overlays.tsx +++ b/src/components/overlays/Overlays.tsx @@ -47,22 +47,6 @@ export const Overlays: Component = ({ map }) => { 'EPSG:900913:12', 'EPSG:900913:13', 'EPSG:900913:14', - 'EPSG:900913:15', - 'EPSG:900913:16', - 'EPSG:900913:17', - 'EPSG:900913:18', - 'EPSG:900913:19', - 'EPSG:900913:20', - 'EPSG:900913:21', - 'EPSG:900913:22', - 'EPSG:900913:23', - 'EPSG:900913:24', - 'EPSG:900913:25', - 'EPSG:900913:26', - 'EPSG:900913:27', - 'EPSG:900913:28', - 'EPSG:900913:29', - 'EPSG:900913:30', ]; const baseUrl = 'https://geo.dyomedea.com/geoserver/gwc/service/wmts'; const geoServerStyle = ''; @@ -79,12 +63,7 @@ export const Overlays: Component = ({ map }) => { 9783.939619140625, 4891.9698095703125, 2445.9849047851562, 1222.9924523925781, 611.4962261962891, 305.74811309814453, 152.87405654907226, 76.43702827453613, 38.218514137268066, - 19.109257068634033, 9.554628534317017, 4.777314267158508, - 2.388657133579254, 1.194328566789627, 0.5971642833948135, - 0.29858214169740677, 0.14929107084870338, 0.07464553542435169, - 0.037322767712175846, 0.018661383856087923, 0.009330691928043961, - 0.004665345964021981, 0.0023326729820109904, 0.0011663364910054952, - 5.831682455027476e-4, 2.915841227513738e-4, 1.457920613756869e-4, + 19.109257068634033, 9.554628534317017, ]; const params = { @@ -111,14 +90,16 @@ export const Overlays: Component = ({ map }) => { url: url, format: new MVT({ featureClass: Feature }), projection: projection, + // minZoom: 8, + // maxZoom: 14, tileGrid: new WMTSTileGrid({ tileSize: [256, 256], origin: [-2.003750834e7, 2.003750834e7], resolutions: resolutions, matrixIds: gridNames, + minZoom: 10, }), wrapX: true, - maxZoom: 14, }); return source; } diff --git a/src/components/overlays/overlay-definitions.ts b/src/components/overlays/overlay-definitions.ts index ed45100..b0d18cb 100644 --- a/src/components/overlays/overlay-definitions.ts +++ b/src/components/overlays/overlay-definitions.ts @@ -101,7 +101,10 @@ _flat.forEach((obj: any) => { }); export const getVectorTileFeatureType = (feature: Feature) => { - if (!!feature.get('route') || feature.get('highway') === 'path') { + if ( + ['hiking'].includes(feature.get('route')) || + ['path', 'track', 'footway', 'steps'].includes(feature.get('highway')) + ) { return 'way'; } if (