@basemaps/landing 7.9.0 → 7.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/attribution.d.ts +9 -10
- package/build/attribution.js +38 -50
- package/build/attribution.js.map +1 -1
- package/build/components/layer.switcher.dropdown.d.ts +8 -1
- package/build/components/layer.switcher.dropdown.js +75 -9
- package/build/components/layer.switcher.dropdown.js.map +1 -1
- package/build/components/map.label.d.ts +2 -0
- package/build/components/map.label.js +11 -1
- package/build/components/map.label.js.map +1 -1
- package/build/config.map.d.ts +6 -2
- package/build/config.map.js +37 -9
- package/build/config.map.js.map +1 -1
- package/build/tile.matrix.d.ts +5 -0
- package/build/tile.matrix.js +18 -0
- package/build/tile.matrix.js.map +1 -1
- package/build/url.d.ts +26 -0
- package/build/url.js.map +1 -1
- package/dist/docs/404.html +211 -0
- package/dist/docs/configuration/index.html +72 -0
- package/dist/docs/deployment/index.html +72 -0
- package/dist/docs/developer-guide/cli-methods/bundle-the-basemaps-config-file/index.html +669 -0
- package/dist/docs/developer-guide/index.html +74 -2
- package/dist/docs/developer-guide/run-basemaps-locally/index.html +678 -0
- package/dist/docs/developer-guide/server-methods/serve-basemaps-with-bundled-config-file/index.html +630 -0
- package/dist/docs/developer-guide/server-methods/serve-basemaps-with-collection-of-geotiff-files/index.html +584 -0
- package/dist/docs/examples/_overview/index.html +73 -1
- package/dist/docs/examples/leaflet.xyz.3857/index.html +72 -0
- package/dist/docs/examples/maplibre.opacity.3857/index.html +72 -0
- package/dist/docs/examples/maplibre.vector.3857/index.html +72 -0
- package/dist/docs/index.html +73 -1
- package/dist/docs/operator-guide/cog-quality/index.html +72 -0
- package/dist/docs/operator-guide/empty-tiles/index.html +72 -0
- package/dist/docs/operator-guide/gebco/index.html +72 -0
- package/dist/docs/operator-guide/index.html +72 -0
- package/dist/docs/operator-guide/quick-start/index.html +72 -0
- package/dist/docs/operator-guide/relief-shade/index.html +72 -0
- package/dist/docs/operator-guide/static/projection_beehive_fakenztm2000.webp +0 -0
- package/dist/docs/operator-guide/static/projection_beehive_nztm2000quad.webp +0 -0
- package/dist/docs/operator-guide/static/projection_nztm2000quad_0_0_0.webp +0 -0
- package/dist/docs/operator-guide/texture-shade/index.html +73 -1
- package/dist/docs/operator-guide/xyz-projection/index.html +598 -0
- package/dist/docs/quick-start/index.html +73 -1
- package/dist/docs/sitemap.xml +44 -19
- package/dist/docs/sitemap.xml.gz +0 -0
- package/dist/docs/user-guide/_get-started/index.html +73 -1
- package/dist/docs/user-guide/api-documentation/index.html +73 -1
- package/dist/docs/user-guide/api-documentation/{swagger-654fffa1.html → swagger-1c4e7946.html} +1 -1
- package/dist/docs/user-guide/technical-documentation/index.html +72 -0
- package/package.json +7 -7
package/build/attribution.d.ts
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { Attribution } from '@basemaps/attribution';
|
|
2
2
|
import { AttributionBounds } from '@basemaps/attribution/build/attribution.js';
|
|
3
|
-
import { TileMatrixSet } from '@basemaps/geo';
|
|
4
|
-
import { BBox } from '@linzjs/geojson';
|
|
5
3
|
import * as maplibre from 'maplibre-gl';
|
|
6
4
|
export declare class MapAttributionState {
|
|
7
5
|
/** Cache the loading of attribution */
|
|
8
|
-
|
|
9
|
-
/** Rendering process needs
|
|
10
|
-
|
|
6
|
+
attrs: Map<string, Promise<Attribution | null>>;
|
|
7
|
+
/** Rendering process needs sync access */
|
|
8
|
+
attrsSync: Map<string, Attribution>;
|
|
9
|
+
private getLayer;
|
|
10
|
+
/**
|
|
11
|
+
* Load the attribution fo all layers
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
getAll(): Promise<Attribution | null>;
|
|
11
15
|
/** Load a attribution from a url, return a cached copy if we have one */
|
|
12
16
|
getCurrentAttribution(): Promise<Attribution | null>;
|
|
13
17
|
/** Filter the attribution to the map bounding box */
|
|
14
18
|
filterAttributionToMap(attr: Attribution, map: maplibregl.Map): AttributionBounds[];
|
|
15
|
-
getAttributionByYear(attribution: AttributionBounds[]): Map<number, AttributionBounds[]>;
|
|
16
|
-
/**
|
|
17
|
-
* Covert Mapbox Bounds to tileMatrix BBox
|
|
18
|
-
*/
|
|
19
|
-
static mapboxBoundToBbox(bounds: maplibre.LngLatBounds, zoom: number, tileMatrix: TileMatrixSet): BBox;
|
|
20
19
|
isIgnored: (attr: AttributionBounds) => boolean;
|
|
21
20
|
}
|
|
22
21
|
export declare const MapAttrState: MapAttributionState;
|
package/build/attribution.js
CHANGED
|
@@ -3,19 +3,19 @@ import { GoogleTms, Stac } from '@basemaps/geo';
|
|
|
3
3
|
import * as maplibre from 'maplibre-gl';
|
|
4
4
|
import { onMapLoaded } from './components/map.js';
|
|
5
5
|
import { Config } from './config.js';
|
|
6
|
-
import {
|
|
6
|
+
import { mapToBoundingBox } from './tile.matrix.js';
|
|
7
7
|
const Copyright = `© ${Stac.License} LINZ`;
|
|
8
8
|
export class MapAttributionState {
|
|
9
9
|
constructor() {
|
|
10
10
|
/** Cache the loading of attribution */
|
|
11
|
-
Object.defineProperty(this, "
|
|
11
|
+
Object.defineProperty(this, "attrs", {
|
|
12
12
|
enumerable: true,
|
|
13
13
|
configurable: true,
|
|
14
14
|
writable: true,
|
|
15
15
|
value: new Map()
|
|
16
16
|
});
|
|
17
|
-
/** Rendering process needs
|
|
18
|
-
Object.defineProperty(this, "
|
|
17
|
+
/** Rendering process needs sync access */
|
|
18
|
+
Object.defineProperty(this, "attrsSync", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
configurable: true,
|
|
21
21
|
writable: true,
|
|
@@ -32,21 +32,39 @@ export class MapAttributionState {
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
+
getLayer(layerKey, url) {
|
|
36
|
+
const layer = this.attrs.get(layerKey);
|
|
37
|
+
if (layer != null)
|
|
38
|
+
return layer;
|
|
39
|
+
const loader = Attribution.load(url)
|
|
40
|
+
.catch(() => null)
|
|
41
|
+
.then((ret) => {
|
|
42
|
+
if (ret == null) {
|
|
43
|
+
this.attrs.delete(layerKey);
|
|
44
|
+
this.attrsSync.delete(layerKey);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.attrsSync.set(layerKey, ret);
|
|
48
|
+
}
|
|
49
|
+
return ret;
|
|
50
|
+
});
|
|
51
|
+
this.attrs.set(layerKey, loader);
|
|
52
|
+
return loader;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Load the attribution fo all layers
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
getAll() {
|
|
59
|
+
return this.getLayer('all', Config.map.toTileUrl("attribution" /* MapOptionType.Attribution */, GoogleTms, 'all', null));
|
|
60
|
+
}
|
|
35
61
|
/** Load a attribution from a url, return a cached copy if we have one */
|
|
36
62
|
getCurrentAttribution() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
void attrs.then((a) => {
|
|
43
|
-
if (a == null)
|
|
44
|
-
return;
|
|
45
|
-
a.isIgnored = this.isIgnored;
|
|
46
|
-
this._attrsSync.set(Config.map.layerKeyTms, a);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return attrs;
|
|
63
|
+
return this.getLayer(Config.map.layerKeyTms, Config.map.toTileUrl("attribution" /* MapOptionType.Attribution */)).then((ret) => {
|
|
64
|
+
if (ret != null)
|
|
65
|
+
ret.isIgnored = this.isIgnored;
|
|
66
|
+
return ret;
|
|
67
|
+
});
|
|
50
68
|
}
|
|
51
69
|
/** Filter the attribution to the map bounding box */
|
|
52
70
|
filterAttributionToMap(attr, map) {
|
|
@@ -54,38 +72,8 @@ export class MapAttributionState {
|
|
|
54
72
|
// Note that Mapbox rendering 512×512 image tiles are offset by one zoom level compared to 256×256 tiles.
|
|
55
73
|
// For example, 512×512 tiles at zoom level 4 are equivalent to 256×256 tiles at zoom level 5.
|
|
56
74
|
zoom += 1;
|
|
57
|
-
const extent =
|
|
58
|
-
return attr.filter({
|
|
59
|
-
extent,
|
|
60
|
-
zoom: zoom,
|
|
61
|
-
dateBefore: Config.map.filter.date.before,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
getAttributionByYear(attribution) {
|
|
65
|
-
const attrsByYear = new Map();
|
|
66
|
-
for (const a of attribution) {
|
|
67
|
-
if (!a.startDate || !a.endDate)
|
|
68
|
-
continue;
|
|
69
|
-
const startYear = Number(a.startDate.slice(0, 4));
|
|
70
|
-
const endYear = Number(a.endDate.slice(0, 4));
|
|
71
|
-
for (let year = startYear; year <= endYear; year++) {
|
|
72
|
-
const attrs = attrsByYear.get(year) ?? [];
|
|
73
|
-
attrs.push(a);
|
|
74
|
-
attrsByYear.set(year, attrs);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return attrsByYear;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Covert Mapbox Bounds to tileMatrix BBox
|
|
81
|
-
*/
|
|
82
|
-
static mapboxBoundToBbox(bounds, zoom, tileMatrix) {
|
|
83
|
-
const swLocation = { lon: bounds.getWest(), lat: bounds.getSouth(), zoom: zoom };
|
|
84
|
-
const neLocation = { lon: bounds.getEast(), lat: bounds.getNorth(), zoom: zoom };
|
|
85
|
-
const swCoord = locationTransform(swLocation, GoogleTms, tileMatrix);
|
|
86
|
-
const neCoord = locationTransform(neLocation, GoogleTms, tileMatrix);
|
|
87
|
-
const bbox = [swCoord.lon, swCoord.lat, neCoord.lon, neCoord.lat];
|
|
88
|
-
return bbox;
|
|
75
|
+
const extent = mapToBoundingBox(map, zoom, Config.map.tileMatrix);
|
|
76
|
+
return attr.filter({ extent, zoom });
|
|
89
77
|
}
|
|
90
78
|
}
|
|
91
79
|
export const MapAttrState = new MapAttributionState();
|
|
@@ -189,7 +177,7 @@ export class MapAttribution {
|
|
|
189
177
|
if (this.map == null)
|
|
190
178
|
return;
|
|
191
179
|
this._raf = 0;
|
|
192
|
-
const attr = MapAttrState.
|
|
180
|
+
const attr = MapAttrState.attrsSync.get(Config.map.layerKeyTms);
|
|
193
181
|
if (attr == null)
|
|
194
182
|
return this.setAttribution('');
|
|
195
183
|
const filtered = MapAttrState.filterAttributionToMap(attr, this.map);
|
package/build/attribution.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attribution.js","sourceRoot":"","sources":["../src/attribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"attribution.js","sourceRoot":"","sources":["../src/attribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,MAAM,SAAS,GAAG,KAAK,IAAI,CAAC,OAAO,OAAO,CAAC;AAE3C,MAAM,OAAO,mBAAmB;IAAhC;QACE,uCAAuC;QACvC;;;;mBAAkD,IAAI,GAAG,EAAE;WAAC;QAC5D,0CAA0C;QAC1C;;;;mBAAsC,IAAI,GAAG,EAAE;WAAC;QA8ChD,wCAAwC;QACxC;;;;mBAAY,CAAC,IAAuB,EAAW,EAAE;gBAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;gBAClD,OAAO,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAClE,CAAC;WAAC;IACJ,CAAC;IAjDS,QAAQ,CAAC,QAAgB,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CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC1C,CAAC;IA4BD;;OAEG;IACK,cAAc;QACpB,IAAI,IAAI,CAAC,GAAG,IAAI,IAAI;YAAE,OAAO;QAC7B,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC;YAAE,OAAO;QACvD,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;YACrC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;YACpC,IAAI,MAAM,KAAK,IAAI,CAAC,MAAM;gBAAE,OAAO;QACrC,CAAC;QACD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,GAAG,EAAE;YAChC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;YAC5B,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC5D,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,CAAC;IAwBD,cAAc,CAAC,IAAY;QACzB,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -10,7 +10,10 @@ export interface Option {
|
|
|
10
10
|
}
|
|
11
11
|
export interface LayerSwitcherDropdownState {
|
|
12
12
|
layers?: Map<string, LayerInfo>;
|
|
13
|
+
/** Should the map be zoomed to the extent of the layer when the layer is changed */
|
|
13
14
|
zoomToExtent: boolean;
|
|
15
|
+
/** Should the drop down be limited to the approximate extent of the map */
|
|
16
|
+
filterToExtent: boolean;
|
|
14
17
|
currentLayer: string;
|
|
15
18
|
}
|
|
16
19
|
export declare class LayerSwitcherDropdown extends Component<unknown, LayerSwitcherDropdownState> {
|
|
@@ -30,10 +33,14 @@ export declare class LayerSwitcherDropdown extends Component<unknown, LayerSwitc
|
|
|
30
33
|
*/
|
|
31
34
|
getLayer(layerId: string): LayerInfo | null;
|
|
32
35
|
onLayerChange: (opt: Option | null) => void;
|
|
33
|
-
onZoomExtentChange: ChangeEventHandler<
|
|
36
|
+
onZoomExtentChange: ChangeEventHandler<HTMLInputElement>;
|
|
37
|
+
onFilterExtentChange: ChangeEventHandler<HTMLInputElement>;
|
|
38
|
+
renderTotal(total: number, hidden: number): ReactNode | null;
|
|
34
39
|
render(): ReactNode;
|
|
35
40
|
makeOptions(): {
|
|
36
41
|
options: GroupedOptions[];
|
|
37
42
|
current: Option | null;
|
|
43
|
+
hidden: number;
|
|
44
|
+
total: number;
|
|
38
45
|
};
|
|
39
46
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { intersection, Wgs84 } from '@linzjs/geojson';
|
|
2
3
|
import { Component } from 'react';
|
|
3
4
|
import Select from 'react-select';
|
|
5
|
+
import { MapAttrState } from '../attribution.js';
|
|
4
6
|
import { Config, gaEvent } from '../config.js';
|
|
5
7
|
import { MapConfig } from '../config.map.js';
|
|
6
8
|
const Categories = [
|
|
7
9
|
'Basemaps',
|
|
10
|
+
'Scanned Aerial Imagery Basemaps',
|
|
8
11
|
'Satellite Imagery',
|
|
9
12
|
'Urban Aerial Photos',
|
|
10
13
|
'Rural Aerial Photos',
|
|
11
|
-
'Scanned Aerial Imagery Basemaps',
|
|
12
14
|
'Scanned Aerial Imagery',
|
|
13
15
|
'Event',
|
|
14
16
|
'Bathymetry',
|
|
@@ -54,14 +56,24 @@ export class LayerSwitcherDropdown extends Component {
|
|
|
54
56
|
configurable: true,
|
|
55
57
|
writable: true,
|
|
56
58
|
value: (e) => {
|
|
57
|
-
|
|
58
|
-
this.setState({ zoomToExtent: target.checked });
|
|
59
|
+
gaEvent("Ui" /* GaEvent.Ui */, 'layer-list:zoomToExtent:' + e.target.checked);
|
|
60
|
+
this.setState({ zoomToExtent: e.target.checked });
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(this, "onFilterExtentChange", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
configurable: true,
|
|
66
|
+
writable: true,
|
|
67
|
+
value: (e) => {
|
|
68
|
+
gaEvent("Ui" /* GaEvent.Ui */, 'layer-list:filterToExtent:' + e.target.checked);
|
|
69
|
+
this.setState({ filterToExtent: e.target.checked });
|
|
59
70
|
}
|
|
60
71
|
});
|
|
61
|
-
this.state = { zoomToExtent: true, currentLayer: 'unknown' };
|
|
72
|
+
this.state = { zoomToExtent: true, currentLayer: 'unknown', filterToExtent: false };
|
|
62
73
|
}
|
|
63
74
|
componentDidMount() {
|
|
64
75
|
this.setState({ zoomToExtent: true, currentLayer: Config.map.layerKey });
|
|
76
|
+
void MapAttrState.getAll().then(() => this.forceUpdate());
|
|
65
77
|
void Config.map.layers.then((layers) => {
|
|
66
78
|
this.setState({ layers });
|
|
67
79
|
// This needs to run on next tick or the sate will not have updated
|
|
@@ -106,24 +118,48 @@ export class LayerSwitcherDropdown extends Component {
|
|
|
106
118
|
}
|
|
107
119
|
return null;
|
|
108
120
|
}
|
|
121
|
+
renderTotal(total, hidden) {
|
|
122
|
+
if (total === 0)
|
|
123
|
+
return null;
|
|
124
|
+
if (hidden > 0) {
|
|
125
|
+
return (_jsxs("p", { title: `${hidden} layers hidden by filter`, children: [total - hidden, " / ", total] }));
|
|
126
|
+
}
|
|
127
|
+
return _jsx("p", { title: `${total} layers`, children: total });
|
|
128
|
+
}
|
|
109
129
|
render() {
|
|
110
130
|
const ret = this.makeOptions();
|
|
111
|
-
return (_jsxs("div", { className: "LuiDeprecatedForms", children: [
|
|
131
|
+
return (_jsxs("div", { className: "LuiDeprecatedForms", children: [_jsxs("h6", { className: "layers-title", children: ["Layers ", this.renderTotal(ret.total, ret.hidden)] }), _jsx(Select, { options: ret.options, onChange: this.onLayerChange, value: ret.current, classNamePrefix: "layer-selector", id: "layer-selector" }), _jsxs("div", { className: "lui-input-group-wrapper", style: { display: 'flex', justifyContent: 'space-around', height: 48 }, children: [_jsxs("div", { className: "lui-checkbox-container", children: [_jsx("input", { type: "checkbox", onChange: this.onFilterExtentChange, checked: this.state.filterToExtent }), _jsxs("label", { title: "Filter the layer list to approximately the current map extent", children: ["Filter by map view", ret.hidden > 0 ? (_jsxs("p", { children: [_jsx("b", { children: ret.hidden }), " layers hidden"] })) : null] })] }), _jsxs("div", { className: "lui-checkbox-container", children: [_jsx("input", { type: "checkbox", onChange: this.onZoomExtentChange, checked: this.state.zoomToExtent }), _jsx("label", { title: "On layer change zoom to the extent of the layer", children: "Zoom to layer" })] })] })] }));
|
|
112
132
|
}
|
|
113
133
|
makeOptions() {
|
|
134
|
+
let hidden = 0;
|
|
135
|
+
let total = 0;
|
|
114
136
|
if (this.state.layers == null || this.state.layers.size === 0)
|
|
115
|
-
return { options: [], current: null };
|
|
137
|
+
return { options: [], current: null, hidden, total };
|
|
116
138
|
const categories = new Map();
|
|
117
139
|
const currentLayer = this.state.currentLayer;
|
|
140
|
+
const filterToExtent = this.state.filterToExtent;
|
|
141
|
+
const location = Config.map.location;
|
|
142
|
+
if (location == null || location.extent == null)
|
|
143
|
+
return { options: [], current: null, hidden, total };
|
|
144
|
+
const mapExtent = Wgs84.bboxToMultiPolygon(location.extent);
|
|
118
145
|
let current = null;
|
|
119
146
|
for (const layer of this.state.layers.values()) {
|
|
120
147
|
if (ignoredLayers.has(layer.id))
|
|
121
148
|
continue;
|
|
122
149
|
if (!layer.projections.has(Config.map.tileMatrix.projection.code))
|
|
123
150
|
continue;
|
|
151
|
+
total++;
|
|
152
|
+
// Always show the current layer
|
|
153
|
+
if (layer.id !== currentLayer) {
|
|
154
|
+
// Limit all other layers to the extent if requested
|
|
155
|
+
if (filterToExtent && !doesLayerIntersect(mapExtent, layer)) {
|
|
156
|
+
hidden++;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
124
160
|
const layerId = layer.category ?? 'Unknown';
|
|
125
161
|
const layerCategory = categories.get(layerId) ?? { label: layerId, options: [] };
|
|
126
|
-
const opt = { value: layer.id, label: layer.
|
|
162
|
+
const opt = { value: layer.id, label: layer.title.replace(` ${layer.category}`, '') };
|
|
127
163
|
layerCategory.options.push(opt);
|
|
128
164
|
categories.set(layerId, layerCategory);
|
|
129
165
|
if (layer.id === currentLayer)
|
|
@@ -138,7 +174,37 @@ export class LayerSwitcherDropdown extends Component {
|
|
|
138
174
|
return -1;
|
|
139
175
|
return 1;
|
|
140
176
|
}));
|
|
141
|
-
return { options: [...orderedCategories.values()], current
|
|
177
|
+
return { options: [...orderedCategories.values()], current, hidden, total };
|
|
142
178
|
}
|
|
143
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Determine if the polygon intersects the provided layer
|
|
182
|
+
*
|
|
183
|
+
* @param bounds polygon to check
|
|
184
|
+
* @param layer layer to check
|
|
185
|
+
* @returns true if it intersects, false otherwise
|
|
186
|
+
*/
|
|
187
|
+
function doesLayerIntersect(bounds, layer) {
|
|
188
|
+
// No layer information assume it intersects
|
|
189
|
+
if (layer.lowerRight == null || layer.upperLeft == null)
|
|
190
|
+
return true;
|
|
191
|
+
const poly = Wgs84.bboxToMultiPolygon([
|
|
192
|
+
layer.lowerRight[0],
|
|
193
|
+
layer.upperLeft[1],
|
|
194
|
+
layer.upperLeft[0],
|
|
195
|
+
layer.lowerRight[1],
|
|
196
|
+
]);
|
|
197
|
+
const inter = intersection(bounds, poly);
|
|
198
|
+
if (inter == null || inter.length === 0)
|
|
199
|
+
return false;
|
|
200
|
+
// No attribution state loaded, assume it intersects
|
|
201
|
+
const attrs = MapAttrState.attrsSync.get('all');
|
|
202
|
+
if (attrs == null)
|
|
203
|
+
return true;
|
|
204
|
+
const attrLayer = attrs.attributions.filter((f) => f.collection.title === layer.title);
|
|
205
|
+
// Could not find a exact layer match in the attribution
|
|
206
|
+
if (attrLayer.length !== 1)
|
|
207
|
+
return true;
|
|
208
|
+
return attrLayer[0].intersection(bounds);
|
|
209
|
+
}
|
|
144
210
|
//# sourceMappingURL=layer.switcher.dropdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layer.switcher.dropdown.js","sourceRoot":"","sources":["../../src/components/layer.switcher.dropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAsB,SAAS,EAAa,MAAM,OAAO,CAAC;AACjE,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,MAAM,EAAW,OAAO,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAa,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAIxD,MAAM,UAAU,GAAG;IACjB,UAAU;IACV,mBAAmB;IACnB,qBAAqB;IACrB,qBAAqB;IACrB,
|
|
1
|
+
{"version":3,"file":"layer.switcher.dropdown.js","sourceRoot":"","sources":["../../src/components/layer.switcher.dropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAgB,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAsB,SAAS,EAAa,MAAM,OAAO,CAAC;AACjE,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAW,OAAO,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAa,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAIxD,MAAM,UAAU,GAAG;IACjB,UAAU;IACV,iCAAiC;IACjC,mBAAmB;IACnB,qBAAqB;IACrB,qBAAqB;IACrB,wBAAwB;IACxB,OAAO;IACP,YAAY;IACZ,WAA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ChD,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IAE/B,MAAM,SAAS,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC;IACvF,wDAAwD;IACxD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAExC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -51,7 +51,7 @@ export class MapLabelControl {
|
|
|
51
51
|
return;
|
|
52
52
|
this.button.classList.remove('maplibregl-ctrl-labels-enabled');
|
|
53
53
|
// Topographic style disables the button
|
|
54
|
-
if (
|
|
54
|
+
if (this.isDisabled()) {
|
|
55
55
|
this.button.classList.add('display-none');
|
|
56
56
|
this.button.title = 'Topographic style does not support layers';
|
|
57
57
|
return;
|
|
@@ -92,5 +92,15 @@ export class MapLabelControl {
|
|
|
92
92
|
this.events = [];
|
|
93
93
|
this.map = undefined;
|
|
94
94
|
}
|
|
95
|
+
/** Is the label button hidden from view */
|
|
96
|
+
isDisabled() {
|
|
97
|
+
// Most vector styles have overlaps with the labels and make them useless
|
|
98
|
+
if (Config.map.style && LabelsDisabledLayers.has(Config.map.style))
|
|
99
|
+
return true;
|
|
100
|
+
// Labels use the merge style feature and need the production configuration to work
|
|
101
|
+
if (Config.map.isDebug && Config.map.config)
|
|
102
|
+
return true;
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
95
105
|
}
|
|
96
106
|
//# sourceMappingURL=map.label.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.label.js","sourceRoot":"","sources":["../../src/components/map.label.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAW,OAAO,EAAE,MAAM,cAAc,CAAC;AAExD,MAAM,CAAC,M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GAAG,MAAM,CAAC;QACnC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAExC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;QAChE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;QAE/D,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM;YAAE,GAAG,EAAE,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC;IACvB,CAAC;IAQD,2CAA2C;IAC3C,UAAU;QACR,yEAAyE;QACzE,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,IAAI,oBAAoB,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAChF,mFAAmF;QACnF,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAEzD,OAAO,KAAK,CAAC;IACf,CAAC;CAqBF"}
|
package/build/config.map.d.ts
CHANGED
|
@@ -68,8 +68,12 @@ export declare class MapConfig extends Emitter<MapConfigEvents> {
|
|
|
68
68
|
export interface LayerInfo {
|
|
69
69
|
/** Layer id to use when fetching tiles */
|
|
70
70
|
id: string;
|
|
71
|
-
/**
|
|
72
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Human friendly layer namer
|
|
73
|
+
*
|
|
74
|
+
* @example "Kapiti Coast 0.10m Urban Aerial Photos (2017)"
|
|
75
|
+
*/
|
|
76
|
+
title: string;
|
|
73
77
|
/** Layer category */
|
|
74
78
|
category?: string;
|
|
75
79
|
upperLeft?: [number, number];
|
package/build/config.map.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Epsg, EpsgCode, GoogleTms, LocationUrl, Nztm2000QuadTms, Nztm2000Tms, T
|
|
|
2
2
|
import { Emitter } from '@servie/events';
|
|
3
3
|
import { ConfigDebug, DebugDefaults } from './config.debug.js';
|
|
4
4
|
import { Config } from './config.js';
|
|
5
|
-
import { locationTransform } from './tile.matrix.js';
|
|
5
|
+
import { locationTransform, mapToBoundingBox } from './tile.matrix.js';
|
|
6
6
|
import { ensureBase58, WindowUrl } from './url.js';
|
|
7
7
|
/** Default center point if none provided */
|
|
8
8
|
const DefaultCenter = {
|
|
@@ -208,6 +208,8 @@ export class MapConfig extends Emitter {
|
|
|
208
208
|
location.bearing = bearing;
|
|
209
209
|
if (pitch !== 0)
|
|
210
210
|
location.pitch = pitch;
|
|
211
|
+
const bounds = mapToBoundingBox(map, zoom, Config.map.tileMatrix);
|
|
212
|
+
location.extent = bounds;
|
|
211
213
|
return location;
|
|
212
214
|
}
|
|
213
215
|
transformLocation(lat, lon, zoom) {
|
|
@@ -218,7 +220,8 @@ export class MapConfig extends Emitter {
|
|
|
218
220
|
l.lon === this.location.lon &&
|
|
219
221
|
l.zoom === this.location.zoom &&
|
|
220
222
|
l.bearing === this.location.bearing &&
|
|
221
|
-
l.pitch === this.location.pitch
|
|
223
|
+
l.pitch === this.location.pitch &&
|
|
224
|
+
sameExtent(l, this.location)) {
|
|
222
225
|
return;
|
|
223
226
|
}
|
|
224
227
|
this.location.lat = l.lat;
|
|
@@ -226,6 +229,7 @@ export class MapConfig extends Emitter {
|
|
|
226
229
|
this.location.zoom = l.zoom;
|
|
227
230
|
this.location.bearing = l.bearing;
|
|
228
231
|
this.location.pitch = l.pitch;
|
|
232
|
+
this.location.extent = l.extent;
|
|
229
233
|
this.emit('location', this.location);
|
|
230
234
|
this.emit('change');
|
|
231
235
|
}
|
|
@@ -278,6 +282,24 @@ export class MapConfig extends Emitter {
|
|
|
278
282
|
this.emit('change');
|
|
279
283
|
}
|
|
280
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* Are two location's extents the same
|
|
287
|
+
* @param a location A
|
|
288
|
+
* @param b location B/
|
|
289
|
+
* @returns true if the extents are exactly the same false otherwise
|
|
290
|
+
*/
|
|
291
|
+
function sameExtent(a, b) {
|
|
292
|
+
if (a.extent == null && b.extent == null)
|
|
293
|
+
return true;
|
|
294
|
+
if (Array.isArray(a) && Array.isArray(b) && a.length === b.length) {
|
|
295
|
+
for (let i = 0; i < a.length; i++) {
|
|
296
|
+
if (a[i] !== b[i])
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
281
303
|
async function loadAllLayers() {
|
|
282
304
|
const output = new Map();
|
|
283
305
|
const res = await fetch(WindowUrl.toBaseWmts());
|
|
@@ -313,14 +335,14 @@ async function loadAllLayers() {
|
|
|
313
335
|
continue;
|
|
314
336
|
allLayers.push({
|
|
315
337
|
id,
|
|
316
|
-
|
|
338
|
+
title: title.replace('aerial ', ''),
|
|
317
339
|
upperLeft,
|
|
318
340
|
lowerRight,
|
|
319
341
|
projections,
|
|
320
342
|
category,
|
|
321
343
|
});
|
|
322
344
|
}
|
|
323
|
-
allLayers.sort((a, b) => a.
|
|
345
|
+
allLayers.sort((a, b) => a.title.localeCompare(b.title));
|
|
324
346
|
addDefaultLayers(output);
|
|
325
347
|
for (const l of allLayers)
|
|
326
348
|
output.set(l.id, l);
|
|
@@ -336,19 +358,25 @@ function addDefaultLayers(output) {
|
|
|
336
358
|
const layers = [
|
|
337
359
|
{
|
|
338
360
|
id: 'aerial',
|
|
339
|
-
|
|
361
|
+
title: 'Aerial Imagery',
|
|
340
362
|
projections: new Set([EpsgCode.Nztm2000, EpsgCode.Google]),
|
|
341
363
|
category: 'Basemaps',
|
|
342
364
|
},
|
|
343
365
|
{
|
|
344
366
|
id: 'topographic::topographic',
|
|
345
|
-
|
|
367
|
+
title: 'Topographic',
|
|
368
|
+
projections: new Set([EpsgCode.Google]),
|
|
369
|
+
category: 'Basemaps',
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
id: 'topographic::topolite',
|
|
373
|
+
title: 'Topolite',
|
|
346
374
|
projections: new Set([EpsgCode.Google]),
|
|
347
375
|
category: 'Basemaps',
|
|
348
376
|
},
|
|
349
377
|
{
|
|
350
378
|
id: 'elevation',
|
|
351
|
-
|
|
379
|
+
title: 'Elevation',
|
|
352
380
|
projections: new Set([EpsgCode.Google]),
|
|
353
381
|
category: 'Basemaps',
|
|
354
382
|
pipeline: 'terrain-rgb',
|
|
@@ -356,13 +384,13 @@ function addDefaultLayers(output) {
|
|
|
356
384
|
},
|
|
357
385
|
{
|
|
358
386
|
id: 'scanned-aerial-imagery-pre-1990-01-01',
|
|
359
|
-
|
|
387
|
+
title: 'Scanned Aerial Imagery pre 1 January 1990',
|
|
360
388
|
projections: new Set([EpsgCode.Nztm2000, EpsgCode.Google]),
|
|
361
389
|
category: 'Scanned Aerial Imagery Basemaps',
|
|
362
390
|
},
|
|
363
391
|
{
|
|
364
392
|
id: 'scanned-aerial-imagery-post-1989-12-31',
|
|
365
|
-
|
|
393
|
+
title: 'Scanned Aerial Imagery post 31 December 1989',
|
|
366
394
|
projections: new Set([EpsgCode.Nztm2000, EpsgCode.Google]),
|
|
367
395
|
category: 'Scanned Aerial Imagery Basemaps',
|
|
368
396
|
},
|