Network is now a feature's attribute (no longer in tags' hstore)

This commit is contained in:
Eric van der Vlist 2023-01-31 10:54:31 +01:00
parent e7c9d0e7cb
commit c08cf8bc3f
2 changed files with 11 additions and 13 deletions

View File

@ -320,7 +320,7 @@ const styles = {
}), }),
}, },
getParameters: (feature: Feature) => { getParameters: (feature: Feature) => {
let tags = feature.get('tags'); // let tags = feature.get('tags');
// try { // try {
// tags = JSON.parse(feature.get('tags')); // tags = JSON.parse(feature.get('tags'));
// } catch (error) { // } catch (error) {
@ -332,19 +332,17 @@ const styles = {
// feature, // feature,
// }); // });
// } // }
if (getZoomInteger() < 12 && !['iwn', 'nwn'].includes(tags.network)) { const network = feature.get('network');
if (getZoomInteger() < 12 && !['iwn', 'nwn'].includes(network)) {
return null; return null;
} }
if ( if (getZoomInteger() < 14 && !['iwn', 'nwn', 'lwn'].includes(network)) {
getZoomInteger() < 14 &&
!['iwn', 'nwn', 'lwn'].includes(tags.network)
) {
return null; return null;
} }
return { return {
isSelected: feature.get('isSelected') ?? false, // isSelected: feature.get('isSelected') ?? false,
name: feature.get('name'), name: feature.get('name'),
network: tags.network, network,
}; };
}, },
getStyle: memoize((params: any) => { getStyle: memoize((params: any) => {
@ -464,7 +462,7 @@ const styles = {
}; };
export const style = (feature: Feature, resolution: number) => { export const style = (feature: Feature, resolution: number) => {
// console.log({ caller: 'style', feature, values: feature.values_ }); // console.log({ caller: 'style', feature, values: feature.values_ });
const type = ( const type = (
feature.get('type') !== undefined feature.get('type') !== undefined
? feature.get('type') ? feature.get('type')

View File

@ -112,12 +112,12 @@ export const Overlays: Component<Props> = ({ map }) => {
// const vectorTileSource = constructSource(); // const vectorTileSource = constructSource();
const vectorTileSource = new VectorTileSource({ const vectorTileSource = new VectorTileSource({
url: 'https://geo.dyomedea.com/geoserver/gwc/service/wmts/rest/hiking/EPSG:900913/EPSG:900913:{z}/{y}/{x}?format=application/json;type=geojson', // url: 'https://geo.dyomedea.com/geoserver/gwc/service/wmts/rest/hiking/EPSG:900913/EPSG:900913:{z}/{y}/{x}?format=application/json;type=geojson',
// url: 'https://geo.dyomedea.com/geoserver/gwc/service/wmts/rest/hiking/EPSG:900913/EPSG:900913:{z}/{y}/{x}?format=application/vnd.mapbox-vector-tile', url: 'https://geo.dyomedea.com/geoserver/gwc/service/wmts/rest/hiking/EPSG:900913/EPSG:900913:{z}/{y}/{x}?format=application/vnd.mapbox-vector-tile',
// url: 'http://localhost:8080/geoserver/gwc/service/tms/1.0.0/test%3Atransportation@EPSG%3A900913@pbf/{z}/{x}/{-y}.pbf', // url: 'http://localhost:8080/geoserver/gwc/service/tms/1.0.0/test%3Atransportation@EPSG%3A900913@pbf/{z}/{x}/{-y}.pbf',
// url: 'https://geo.dyomedea.com/services/spain/tiles/{z}/{x}/{y}.pbf', // url: 'https://geo.dyomedea.com/services/spain/tiles/{z}/{x}/{y}.pbf',
format: new GeoJSON({ dataProjection: 'EPSG:900913' }), // format: new GeoJSON({ dataProjection: 'EPSG:900913' }),
// format: new MVT({ featureClass: Feature }), format: new MVT({ featureClass: Feature }),
maxZoom: 15, maxZoom: 15,
tileSize: 256, tileSize: 256,
}); });