From a464fc6aabb999894605f783cae022afc258175b Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Thu, 15 Aug 2024 21:09:51 +0200 Subject: [PATCH 01/37] Add first update to documentation regarding mpapi parameters This includes the introduction of resolutions as a parameter to deprecate the parameter options. This parameter still needs to be implemented. --- packages/core/README.md | 115 ++++++++++++++++++++++------------------ 1 file changed, 64 insertions(+), 51 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index f5ad7f68..09d81203 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -7,7 +7,7 @@ The client's core is the base package to create clients in the POLAR environment It offers this functionality: - Plugin mechanism -- @masterportal/masterportalapi functionality +- @masterportal/masterportalApi functionality - Localization mechanism ## Interaction @@ -21,7 +21,7 @@ It is important to note that the behaviour will be desktop-like on larger touchs It depends on the client how exactly the initialization will take place for the embedding programmer. However, the core mechanism remains the same. -The exported default object is an extended masterportalAPI, adding the `addPlugins` and extending the `createMap` functions. For masterportalAPI details, [see their repository](https://bitbucket.org/geowerkstatt-hamburg/masterportalapi/src/master/). +The exported default object is an extended masterportalApi, adding the `addPlugins` and extending the `createMap` functions. For masterportalApi details, [see their repository](https://bitbucket.org/geowerkstatt-hamburg/masterportalapi/src/master/). To be able to see the map in production mode, the imported stylesheet has to have the property `data-polar`. The value can be chosen arbitrarily. ⚠️ Deprecated. The new field 'stylePath' should be used instead. @@ -71,15 +71,14 @@ The mapConfiguration allows controlling many client instance details. | fieldName | type | description | | - | - | - | -| layerConf | LayerConf | Layer configuration as required by masterportalAPI. | -| language | enum["de", "en"] | Initial language. | -| <...masterportalAPI.fields> | various | The object is also used to initialize the masterportalAPI. Please refer to their documentation for options. | +| <...masterportalApi.fields> | various | Multiple different parameters are required by the masterportalApi to be able to create the map. Also, some fields are optional but relevant and thus described here as well. For all additional options, refer to the documentation of the masterportalApi itself. | | | various? | Fields for configuring plugins added with `addPlugins`. Refer to each plugin's documentation for specific fields and options. Global plugin parameters are described [below](#global-plugin-parameters). | +| stylePath | string? | If no link tag with `data-polar="true"` is found in the document, this path will be used to create the link node in the client itself. It defaults to `'./style.css'`. Please mind that `data-polar="true"` is deprecated since it potentially led to flashes of misstyled content. stylePath will replace that solution in the next major release. | +| language | enum["de", "en"]? | Initial language. | | locales | LanguageOption[]? | All locales in POLAR's plugins can be overridden to fit your needs.| -| vuetify | object? | You may add vuetify configuration here. | | extendedMasterportalapiMarkers | extendedMasterportalapiMarkers? | Optional. If set, all configured visible vector layers' features can be hovered and selected by mouseover and click respectively. They are available as features in the store. Layers with `clusterDistance` will be clustered to a multi-marker that supports the same features. Please mind that this only works properly if you configure nothing but point marker vector layers styled by the masterportalAPI. | -| stylePath | string? | If no link tag with `data-polar="true"` is found in the document, this path will be used to create the link node in the client itself. It defaults to `'./style.css'`. Please mind that `data-polar="true"` is deprecated since it potentially led to flashes of misstyled content. stylePath will replace that solution in the next major release. | | renderFaToLightDom | boolean? | POLAR requires FontAwesome in the Light/Root DOM due to an [unfixed bug in many browsers](https://bugs.chromium.org/p/chromium/issues/detail?id=336876). This value defaults to `true`. POLAR will, by default, just add the required CSS by itself. Should you have a version of Fontawesome already included, you can try to set this to `false` to check whether the versions are interoperable. | +| vuetify | object? | You may add vuetify configuration here. | | checkServiceAvailability | boolean? | If set to `true`, all services' availability will be checked with head requests. |
@@ -221,11 +220,65 @@ A full documentation of the masterportalapiPolygonFillHatch is available at the >|backgroundColor|no|Number[]|`[0, 0, 0, 1]`|Background color of polygon.| >|patternColor|no|Number[]|`[255, 255, 255, 1]`|Fill color of pattern drawn on polygon.| -##### mapConfiguration.LayerConf +##### <...masterportalApi.fields> + +The `<...masterportalAPI.fields>` means that any masterportalAPI field may also be used here _directly_ in the mapConfiguration. The most common fields are the following ones; for more, see masterportalApi. + +Note, that some parameters may be optional while others are required. + +| fieldName | type | description | +| - | - | - | +| layerConf | layerConf \| string | Layer configuration of all available layers as a service register. May either be a self defined register or a link to an external register. Refer to `mapConfiguration.layers` regarding the configuration for a client itself. | +| startResolution | number | Initial resolution; must be described in `mapConfiguration.options`. | +| startCenter | number[] | Initial center coordinate. | +| extent | number[] | Map movement will be restricted to the rectangle described by the given coordinates. | +| epsg | string | Leading coordinate system, e.g. `"EPSG:25832"`. The coordinate system should be defined in `namedProjections` as well. | +| options | Array | Defines all available zoom levels mapped to the respective resolution and related scale. Deprecated in an upcoming release, please use the parameter `resolutions` instead. | +| resolutions | number[] | Resolutions that determine the zoom levels. The index in the array corresponds to the zoom level, therefore the resolution values have to be in descending order. A resolution is the size of 1 pixel on the screen converted to map units (e.g. meters) depending on the used projection (`epsg`). For more information, see the [OpenLayers documentation](https://openlayers.org/en/v9.2.4/apidoc/module-ol_View-View.html) of the parameter `resolutions`. | +| namedProjections | Array<[string,string]> | Array of usable coordinated systems mapped to a projection as a proj4 string. | + +
+Example configuration + +```js +{ + startResolution: 264.583190458, + startCenter: [553655.72, 6004479.25], + extent: [426205.6233, 5913461.9593, 650128.6567, 6101486.8776], + epsg: 'EPSG:25832', + resolutions: [ + 2116.66552366, + 1058.33276183, + 529.166380916, + 264.583190458, + 132.291595229, + 66.14579761460263, + 26.458319045841044, + 15.874991427504629, + 10.583327618336419, + 5.2916638091682096, + 2.6458319045841048, + 1.3229159522920524, + 0.6614579761460262, + 0.2645831904584105, + 0.1322915952292052 + ], + namedProjections: [ + [ + 'EPSG:25832', + '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', + ], + ], +} +``` -The layer configuration (or: service register) is read by the masterportalAPI. The full definition can be read [here](https://bitbucket.org/geowerkstatt-hamburg/masterportal/src/dev/doc/services.json.md). +
-However, not all listed services have been implemented in the masterportalAPI yet, and no documentation regarding implemented properties exists there yet. +##### mapConfiguration.layerConf + +The layer configuration (or: service register) is read by the masterportalApi. The full definition can be read [here](https://bitbucket.org/geowerkstatt-hamburg/masterportal/src/dev/doc/services.json.md). + +However, not all listed services have been implemented in the masterportalApi yet, and no documentation regarding implemented properties exists there yet. Whitelisted and confirmed parameters include: @@ -258,47 +311,7 @@ Whitelisted and confirmed parameters include: ] ``` -Since this is the base for many functions, the service ID set in this is used to reference map material in many places of the map client. - -##### <...masterportalAPI.fields> - -The `<...masterportalAPI.fields>` means that any masterportalAPI field may also be used here _directly_. The most common fields are the following ones; for more, see masterportalAPI. - -| fieldName | type | description | -| - | - | - | -| startResolution | number | Initial resolution; must be in options. See below. | -| startCenter | number[] | Initial center coordinate. | -| extent | number[] | Map movement will be restricted to this rectangle. | -| epsg | string | Leading coordinate system, e.g. `"EPSG:25832"`. | -| options | Array | Defines all available zoomLevels. Entries define `resolution`, `scale`, and `zoomLevel`. See masterportalAPI for details. | -| namedProjections | Array | Array of usable projections by proj4 string. | - -
-Example configuration - -```js -{ - startResolution: 264.583190458, - startCenter: [553655.72, 6004479.25], - extent: [426205.6233, 5913461.9593, 650128.6567, 6101486.8776], - epsg: 'EPSG:25832', - options: [ - { resolution: 2.6458319045841048, scale: 10000, zoomLevel: zoomLevel++ }, - { resolution: 1.3229159522920524, scale: 5000, zoomLevel: zoomLevel++ }, - { resolution: 0.6614579761460262, scale: 2500, zoomLevel: zoomLevel++ }, - { resolution: 0.2645831904584105, scale: 1000, zoomLevel: zoomLevel++ }, - { resolution: 0.1322915952292052, scale: 500, zoomLevel: zoomLevel++ }, - ], - namedProjections: [ - [ - 'EPSG:25832', - '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', - ], - ], -} -``` - -
+Since this is the base for many functions, the service id set in this is used to reference map material in many places of the map client. ##### From da28589497c361deed2de9e8607ebb73491bc031 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Fri, 16 Aug 2024 15:11:33 +0200 Subject: [PATCH 02/37] Adjust types and documentation of mpapi --- packages/core/README.md | 51 ++++++++++++++++++----------------- packages/types/custom/core.ts | 39 +++++++++++++++------------ 2 files changed, 49 insertions(+), 41 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index 09d81203..a7aa4bff 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -228,14 +228,14 @@ Note, that some parameters may be optional while others are required. | fieldName | type | description | | - | - | - | -| layerConf | layerConf \| string | Layer configuration of all available layers as a service register. May either be a self defined register or a link to an external register. Refer to `mapConfiguration.layers` regarding the configuration for a client itself. | -| startResolution | number | Initial resolution; must be described in `mapConfiguration.options`. | -| startCenter | number[] | Initial center coordinate. | -| extent | number[] | Map movement will be restricted to the rectangle described by the given coordinates. | -| epsg | string | Leading coordinate system, e.g. `"EPSG:25832"`. The coordinate system should be defined in `namedProjections` as well. | -| options | Array | Defines all available zoom levels mapped to the respective resolution and related scale. Deprecated in an upcoming release, please use the parameter `resolutions` instead. | -| resolutions | number[] | Resolutions that determine the zoom levels. The index in the array corresponds to the zoom level, therefore the resolution values have to be in descending order. A resolution is the size of 1 pixel on the screen converted to map units (e.g. meters) depending on the used projection (`epsg`). For more information, see the [OpenLayers documentation](https://openlayers.org/en/v9.2.4/apidoc/module-ol_View-View.html) of the parameter `resolutions`. | -| namedProjections | Array<[string,string]> | Array of usable coordinated systems mapped to a projection as a proj4 string. | +| layerConf | layerConf \| string | Layer configuration of all available layers as a service register. May either be a self defined register or a link to an external register. Layers defined here are not directly shown in a client, see `mapconfiguration.layers` for that. | +| startCenter | number[] | Initial center coordinate. Needs to be defined in the chosen leading coordinate system. | +| backgroundImage | string? | Image to be displayed as a background of the map. Defaults to `''`, so no image being used. | +| epsg | `EPSG:${string}`? | Leading coordinate system. The coordinate system has to be defined in `namedProjections` as well. Defaults to `'EPSG:25832'`. | +| extent | number[]? | Map movement will be restricted to the rectangle described by the given coordinates. Unrestricted by default. | +| namedProjections | Array<[string,string]>? | Array of usable coordinated systems mapped to a projection as a proj4 string. Defines the `'EPSG:25832'`, `'EPSG:3857'` and `'EPSG:4326'` by default. | +| options | zoomOption[]? | Defines all available zoom levels mapped to the respective resolution and related scale. Defines 10 zoomLevels for `'EPSG:25832'` by default. | +| startResolution | number? | Initial resolution; must be described in `mapConfiguration.options`. Defaults to `15.874991427504629` which is zoom level to in the default of `mapConfiguration.options`. |
Example configuration @@ -246,22 +246,17 @@ Note, that some parameters may be optional while others are required. startCenter: [553655.72, 6004479.25], extent: [426205.6233, 5913461.9593, 650128.6567, 6101486.8776], epsg: 'EPSG:25832', - resolutions: [ - 2116.66552366, - 1058.33276183, - 529.166380916, - 264.583190458, - 132.291595229, - 66.14579761460263, - 26.458319045841044, - 15.874991427504629, - 10.583327618336419, - 5.2916638091682096, - 2.6458319045841048, - 1.3229159522920524, - 0.6614579761460262, - 0.2645831904584105, - 0.1322915952292052 + options: [ + { resolution: 66.14579761460263, scale: 250000, zoomLevel: 0 }, + { resolution: 26.458319045841044, scale: 100000, zoomLevel: 1 }, + { resolution: 15.874991427504629, scale: 60000, zoomLevel: 2 }, + { resolution: 10.583327618336419, scale: 40000, zoomLevel: 3 }, + { resolution: 5.2916638091682096, scale: 20000, zoomLevel: 4 }, + { resolution: 2.6458319045841048, scale: 10000, zoomLevel: 5 }, + { resolution: 1.3229159522920524, scale: 5000, zoomLevel: 6 }, + { resolution: 0.6614579761460262, scale: 2500, zoomLevel: 7 }, + { resolution: 0.2645831904584105, scale: 1000, zoomLevel: 8 }, + { resolution: 0.1322915952292052, scale: 500, zoomLevel: 9 }, ], namedProjections: [ [ @@ -313,6 +308,14 @@ Whitelisted and confirmed parameters include: Since this is the base for many functions, the service id set in this is used to reference map material in many places of the map client. +###### zoomOption + +| fieldName | type | description | +| - | - | - | +| resolution | number | Size of 1 pixel on the screen converted to map units (e.g. meters) depending on the used projection (`epsg`). | +| scale | number | Scale in meters. | +| zoomLevel | number | Zoom level. | + ##### Plugins in POLAR are modular components that extend the functionality of the map client. They can be added using the [addPlugins](#addPlugins) method and configured through the `mapConfiguration` object. Each plugin has its own set of fields and options that can be customized. diff --git a/packages/types/custom/core.ts b/packages/types/custom/core.ts index 0726f415..5431e91e 100644 --- a/packages/types/custom/core.ts +++ b/packages/types/custom/core.ts @@ -561,30 +561,35 @@ export interface ExtendedMasterportalapiMarkers { dispatchOnMapSelect?: string } -export interface MapConfig { - /** if true, all services' availability will be checked with head requests */ - checkServiceAvailability?: boolean - /** The epsg code of the projection that the map will use */ - epsg: `EPSG:${string}` - /** Configured layers */ - layers: LayerConfiguration[] +export interface MasterportalApiConfig { /** masterportalapi-type layer configuration */ - layerConf: Record[] - extendedMasterportalapiMarkers?: ExtendedMasterportalapiMarkers + layerConf: Record[] | string + /** Initial center coordinate for the mapView */ + startCenter: number[] + // Image to be displayed as a background of the map + backgroundImage?: string + /** The epsg code of the projection that the map will use */ + epsg?: `EPSG:${string}` + /** Extent in which the map can be viewed in; coordinates are written in the set projection of the map set through this config. */ + extent?: number[] /** Enabled projections for the map; 2nd dimension of the array contains the epsg code as the first parameter and the proj4 definition as the second */ - namedProjections: Array<[string, string]> + namedProjections?: Array<[string, string]> /** Mapped resolution to zoomLevel */ options?: PolarMapOptions[] - renderFaToLightDom?: boolean - /** Extent in which the map can be viewed in; coordinates are written in the set projection of the map set through this config. */ - extent?: number[] + /** Initial resolution the map should be rendered with */ + startResolution?: number +} + +export interface MapConfig extends MasterportalApiConfig { + /** Configured layers */ + layers: LayerConfiguration[] + /** if true, all services' availability will be checked with head requests */ + checkServiceAvailability?: boolean + extendedMasterportalapiMarkers?: ExtendedMasterportalapiMarkers language?: InitialLanguage locales?: LanguageOption[] - /** Initial center coordinate for the mapView */ - startCenter?: number[] + renderFaToLightDom?: boolean stylePath?: string - /** Initial resolution the map should be rendered with */ - startResolution?: number vuetify?: UserVuetifyPreset addressSearch?: AddressSearchConfiguration attributions?: AttributionsConfiguration From e4cd6222b62d21d930d022053ecda1d9877e2296 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Fri, 16 Aug 2024 19:05:56 +0200 Subject: [PATCH 03/37] Add default values for mpapi configuration parameters --- packages/core/src/utils/createMap/index.ts | 35 +++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/packages/core/src/utils/createMap/index.ts b/packages/core/src/utils/createMap/index.ts index 6a008749..98111b76 100644 --- a/packages/core/src/utils/createMap/index.ts +++ b/packages/core/src/utils/createMap/index.ts @@ -1,4 +1,5 @@ import Vue from 'vue' +import { MasterportalApiConfig } from '@polar/lib-custom-types' import { makeStore } from '../../vuePlugins/vuex' import vuetify from '../../vuePlugins/vuetify' import language from '../../language' @@ -26,13 +27,45 @@ export default async function createMap({ await language(mapConfiguration?.language) + const mpapiDefaults: Partial = { + epsg: 'EPSG:25832', + backgroundImage: '', + options: [ + { resolution: 66.14579761460263, scale: 250000, zoomLevel: 0 }, + { resolution: 26.458319045841044, scale: 100000, zoomLevel: 1 }, + { resolution: 15.874991427504629, scale: 60000, zoomLevel: 2 }, + { resolution: 10.583327618336419, scale: 40000, zoomLevel: 3 }, + { resolution: 5.2916638091682096, scale: 20000, zoomLevel: 4 }, + { resolution: 2.6458319045841048, scale: 10000, zoomLevel: 5 }, + { resolution: 1.3229159522920524, scale: 5000, zoomLevel: 6 }, + { resolution: 0.6614579761460262, scale: 2500, zoomLevel: 7 }, + { resolution: 0.2645831904584105, scale: 1000, zoomLevel: 8 }, + { resolution: 0.1322915952292052, scale: 500, zoomLevel: 9 }, + ], + namedProjections: [ + [ + 'EPSG:25832', + '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', + ], + [ + 'EPSG:3857', + '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', + ], + [ + 'EPSG:4326', + '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', + ], + ], + startResolution: 15.874991427504629, + } + const instance: MapInstance = new Vue({ vuetify: vuetify(mapConfiguration?.vuetify), el: shadowRoot.appendChild(document.createElement('div')), render: (createElement) => createElement(MapContainer, { props: { - mapConfiguration, + mapConfiguration: { ...mpapiDefaults, ...mapConfiguration }, }, }), store: makeStore(), From d1805ccda2b39cd48819629305a8cf3e5b5151b5 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Fri, 16 Aug 2024 19:08:31 +0200 Subject: [PATCH 04/37] Remove unused defaults file --- .../clients/snowbox/src/mapConfiguration.ts | 5 -- packages/core/src/utils/defaults.js | 48 ------------------- 2 files changed, 53 deletions(-) delete mode 100644 packages/core/src/utils/defaults.js diff --git a/packages/clients/snowbox/src/mapConfiguration.ts b/packages/clients/snowbox/src/mapConfiguration.ts index 8e4a1ead..4101240b 100644 --- a/packages/clients/snowbox/src/mapConfiguration.ts +++ b/packages/clients/snowbox/src/mapConfiguration.ts @@ -11,11 +11,6 @@ const uBahn = '23053' const hamburgBorder = '6074' -/** - * bitbucket.org/geowerkstatt-hamburg/masterportalapi/src/master/src/defaults.js - * implicitly using masterportalAPI HH defaults by fallback - * they can be overwritten in this object - */ export const mapConfiguration = { language: 'en', epsg: 'EPSG:25832', diff --git a/packages/core/src/utils/defaults.js b/packages/core/src/utils/defaults.js deleted file mode 100644 index 66c9b4c3..00000000 --- a/packages/core/src/utils/defaults.js +++ /dev/null @@ -1,48 +0,0 @@ -// NOTE: This is a copy of https://bitbucket.org/geowerkstatt-hamburg/masterportalapi/src/master/src/defaults.js and not currently used in the project. - -/** - * Since all functions are exported for users, all functions with defaults - * have to import this object themselves to use fallbacks. - * @type {object} - * @default - * @ignore - */ -export default { - target: 'map', - epsg: 'EPSG:25832', - backgroundImage: - 'https://geoportal-hamburg.de/lgv-config/img/backgroundCanvas.jpeg', - extent: [510000.0, 5850000.0, 625000.4, 6000000.0], - options: [ - { resolution: 66.14579761460263, scale: 250000, zoomLevel: 0 }, - { resolution: 26.458319045841044, scale: 100000, zoomLevel: 1 }, - { resolution: 15.874991427504629, scale: 60000, zoomLevel: 2 }, - { resolution: 10.583327618336419, scale: 40000, zoomLevel: 3 }, - { resolution: 5.2916638091682096, scale: 20000, zoomLevel: 4 }, - { resolution: 2.6458319045841048, scale: 10000, zoomLevel: 5 }, - { resolution: 1.3229159522920524, scale: 5000, zoomLevel: 6 }, - { resolution: 0.6614579761460262, scale: 2500, zoomLevel: 7 }, - { resolution: 0.2645831904584105, scale: 1000, zoomLevel: 8 }, - { resolution: 0.1322915952292052, scale: 500, zoomLevel: 9 }, - ], - namedProjections: [ - [ - 'EPSG:25832', - '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', - ], - [ - 'EPSG:4326', - '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', - ], - ], - startResolution: 15.874991427504629, - startCenter: [565874, 5934140], - layerConf: 'https://geoportal-hamburg.de/lgv-config/services-internet.json', - layers: [ - { - id: '453', - visibility: true, - }, - ], - gazetteerUrl: 'https://geodienste.hamburg.de/HH_WFS_GAGES', -} From 0872b8f81e6b5fa9e22e614bdc4158b17f51f288 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Fri, 16 Aug 2024 19:17:15 +0200 Subject: [PATCH 05/37] Make the type of startCenter and extent be more precise --- packages/types/custom/core.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/types/custom/core.ts b/packages/types/custom/core.ts index 5431e91e..a6cbebd8 100644 --- a/packages/types/custom/core.ts +++ b/packages/types/custom/core.ts @@ -565,13 +565,13 @@ export interface MasterportalApiConfig { /** masterportalapi-type layer configuration */ layerConf: Record[] | string /** Initial center coordinate for the mapView */ - startCenter: number[] + startCenter: [number, number] // Image to be displayed as a background of the map backgroundImage?: string /** The epsg code of the projection that the map will use */ epsg?: `EPSG:${string}` /** Extent in which the map can be viewed in; coordinates are written in the set projection of the map set through this config. */ - extent?: number[] + extent?: [number, number, number, number] /** Enabled projections for the map; 2nd dimension of the array contains the epsg code as the first parameter and the proj4 definition as the second */ namedProjections?: Array<[string, string]> /** Mapped resolution to zoomLevel */ From 534cfa2904cc955b9f3ade12567eeeca2f3e3ec9 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Fri, 16 Aug 2024 19:17:40 +0200 Subject: [PATCH 06/37] Adjust parameters in testMountParameters --- packages/lib/testMountParameters/index.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/lib/testMountParameters/index.ts b/packages/lib/testMountParameters/index.ts index f6938b55..b91a7289 100644 --- a/packages/lib/testMountParameters/index.ts +++ b/packages/lib/testMountParameters/index.ts @@ -49,11 +49,9 @@ export default (): MockParameters => { center: null, components: 1, configuration: { - epsg: 'EPSG:12345', + startCenter: [0, 0], layerConf: [], - namedProjections: [], layers: [], - options: [], }, errors: [], hasSmallDisplay: false, From 6360e4830605e9d3aed3be012fbac1d58ee1f1b3 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Fri, 16 Aug 2024 19:33:52 +0200 Subject: [PATCH 07/37] Adjust documentation for epsg to make changing it clearer --- packages/core/README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index a7aa4bff..fb047b1f 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -76,7 +76,7 @@ The mapConfiguration allows controlling many client instance details. | stylePath | string? | If no link tag with `data-polar="true"` is found in the document, this path will be used to create the link node in the client itself. It defaults to `'./style.css'`. Please mind that `data-polar="true"` is deprecated since it potentially led to flashes of misstyled content. stylePath will replace that solution in the next major release. | | language | enum["de", "en"]? | Initial language. | | locales | LanguageOption[]? | All locales in POLAR's plugins can be overridden to fit your needs.| -| extendedMasterportalapiMarkers | extendedMasterportalapiMarkers? | Optional. If set, all configured visible vector layers' features can be hovered and selected by mouseover and click respectively. They are available as features in the store. Layers with `clusterDistance` will be clustered to a multi-marker that supports the same features. Please mind that this only works properly if you configure nothing but point marker vector layers styled by the masterportalAPI. | +| extendedMasterportalapiMarkers | extendedMasterportalapiMarkers? | Optional. If set, all configured visible vector layers' features can be hovered and selected by mouseover and click respectively. They are available as features in the store. Layers with `clusterDistance` will be clustered to a multi-marker that supports the same features. Please mind that this only works properly if you configure nothing but point marker vector layers styled by the masterportalApi. | | renderFaToLightDom | boolean? | POLAR requires FontAwesome in the Light/Root DOM due to an [unfixed bug in many browsers](https://bugs.chromium.org/p/chromium/issues/detail?id=336876). This value defaults to `true`. POLAR will, by default, just add the required CSS by itself. Should you have a version of Fontawesome already included, you can try to set this to `false` to check whether the versions are interoperable. | | vuetify | object? | You may add vuetify configuration here. | | checkServiceAvailability | boolean? | If set to `true`, all services' availability will be checked with head requests. | @@ -222,16 +222,15 @@ A full documentation of the masterportalapiPolygonFillHatch is available at the ##### <...masterportalApi.fields> -The `<...masterportalAPI.fields>` means that any masterportalAPI field may also be used here _directly_ in the mapConfiguration. The most common fields are the following ones; for more, see masterportalApi. - -Note, that some parameters may be optional while others are required. +The `<...masterportalApi.fields>` means that any masterportalApi field may also be used here _directly_ in the mapConfiguration. The fields described here are fields that are interesting for the usage of POLAR. +Fields that are not set as required have default values. | fieldName | type | description | | - | - | - | | layerConf | layerConf \| string | Layer configuration of all available layers as a service register. May either be a self defined register or a link to an external register. Layers defined here are not directly shown in a client, see `mapconfiguration.layers` for that. | | startCenter | number[] | Initial center coordinate. Needs to be defined in the chosen leading coordinate system. | | backgroundImage | string? | Image to be displayed as a background of the map. Defaults to `''`, so no image being used. | -| epsg | `EPSG:${string}`? | Leading coordinate system. The coordinate system has to be defined in `namedProjections` as well. Defaults to `'EPSG:25832'`. | +| epsg | `EPSG:${string}`? | Leading coordinate system. The coordinate system has to be defined in `mapConfiguration.namedProjections` as well. Changing this value should also lead to changes in `mapConfiguration.startCenter`, `mapConfiguration.extent`, `mapConfiguration.options` and `mapConfiguration.startResolution` as they are described in or related to the leading coordinate system. Defaults to `'EPSG:25832'`. | | extent | number[]? | Map movement will be restricted to the rectangle described by the given coordinates. Unrestricted by default. | | namedProjections | Array<[string,string]>? | Array of usable coordinated systems mapped to a projection as a proj4 string. Defines the `'EPSG:25832'`, `'EPSG:3857'` and `'EPSG:4326'` by default. | | options | zoomOption[]? | Defines all available zoom levels mapped to the respective resolution and related scale. Defines 10 zoomLevels for `'EPSG:25832'` by default. | From 13d0fdbf16015031be4c09c66a0e5659731775cd Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 19 Aug 2024 19:19:08 +0200 Subject: [PATCH 08/37] Document WMTS and add two examples --- packages/core/README.md | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index fb047b1f..d9b8fd3b 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -276,8 +276,9 @@ However, not all listed services have been implemented in the masterportalApi ye Whitelisted and confirmed parameters include: -- WMS: id, name, url, typ, format, version, transparent, layers, STYLES -- WFS: id, name, url, typ, outputFormat, version, featureType +- WMS: id, name, url, typ, format, version, transparent, layers, STYLES +- WFS: id, name, url, typ, outputFormat, version, featureType +- WMTS: id, name, urls, typ, capabilitiesUrl, optionsFromCapabilities, tileMatrixSet, layers, legendURL, format, coordinateSystem, origin, transparent, tileSize, minScale, maxScale, requestEncoding, resLength ###### Example services register @@ -301,6 +302,35 @@ Whitelisted and confirmed parameters include: "version": "1.3.0", "transparent": true, "layers": ["A", "B"] + }, + { + "id": "my-self-defined-wmts", + "urls": [ + "url1/{TileMatrix}/{TileCol}/{TileRow}.png", + "url2/{TileMatrix}/{TileCol}/{TileRow}.png", + "url3/{TileMatrix}/{TileCol}/{TileRow}.png" + ], + "typ": "WMTS", + "format": "image/png", + "coordinateSystem": "EPSG:3857", + "origin": [-20037508.3428, 20037508.3428], + "transparent": false, + "tileSize": "256", + "minScale": "1", + "maxScale": "2500000", + "tileMatrixSet": "google3857", + "requestEncoding": "REST", + "resLength": "20" + }, + { + "id": "my-capabilities-wmts", + "capabilitiesUrl": "WMTS capabilities url", + "urls": "WMTS url", + "optionsFromCapabilities": true, + "tileMatrixSet": "EU_EPSG_25832_TOPPLUS", + "typ": "WMTS", + "layers": "layer-name", + "legendURL": "my-legend-url" } ] ``` From bd64b59e046f75e629dfc7753705b0a9c7576ec1 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 19 Aug 2024 19:50:28 +0200 Subject: [PATCH 09/37] Add another projection to the default of namedProjections --- packages/core/src/utils/createMap/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/core/src/utils/createMap/index.ts b/packages/core/src/utils/createMap/index.ts index 98111b76..9bcc9f20 100644 --- a/packages/core/src/utils/createMap/index.ts +++ b/packages/core/src/utils/createMap/index.ts @@ -55,6 +55,10 @@ export default async function createMap({ 'EPSG:4326', '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', ], + [ + 'EPSG:31467', + '+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel +nadgrids=BETA2007.gsb +units=m +no_defs +type=crs', + ], ], startResolution: 15.874991427504629, } From 49c5263e493ed4c658e4f17ba1ed50f8f052e7b8 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 19 Aug 2024 19:51:56 +0200 Subject: [PATCH 10/37] Remove now redundant configuration parameters from dish --- packages/clients/dish/src/mapConfig.ts | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/packages/clients/dish/src/mapConfig.ts b/packages/clients/dish/src/mapConfig.ts index 17cf69eb..0d674cd5 100644 --- a/packages/clients/dish/src/mapConfig.ts +++ b/packages/clients/dish/src/mapConfig.ts @@ -29,7 +29,6 @@ export const mapConfiguration = { startResolution: 264.583190458, startCenter: [553655.72, 6004479.25], extent: [426205.6233, 5913461.9593, 650128.6567, 6101486.8776], - epsg: 'EPSG:25832', locales, layers: [ { @@ -230,18 +229,4 @@ export const mapConfiguration = { { resolution: 0.02645831904, scale: 100, zoomLevel: zoomLevel++ }, { resolution: 0.01322915952, scale: 50, zoomLevel: zoomLevel++ }, ], - namedProjections: [ - [ - 'EPSG:31467', - '+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel +nadgrids=BETA2007.gsb +units=m +no_defs +type=crs', - ], - [ - 'EPSG:25832', - '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', - ], - [ - 'EPSG:4326', - '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', - ], - ], } From a2950faa949e4da570b13cbbcfe342876b22793f Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 19 Aug 2024 19:55:49 +0200 Subject: [PATCH 11/37] Remove epsg from example pages --- pages/examples/address.html | 1 - pages/examples/draw.html | 1 - pages/examples/gfi.html | 1 - pages/examples/layer.html | 1 - pages/examples/locales.html | 1 - pages/examples/orientation.html | 1 - pages/examples/render.js | 1 - 7 files changed, 7 deletions(-) diff --git a/pages/examples/address.html b/pages/examples/address.html index 431b3a58..297a2401 100644 --- a/pages/examples/address.html +++ b/pages/examples/address.html @@ -37,7 +37,6 @@ ], mapConfiguration: { language: 'en', - epsg: 'EPSG:25832', addressSearch: { displayComponent: true, addLoading: 'plugin/loadingIndicator/addLoadingKey', diff --git a/pages/examples/draw.html b/pages/examples/draw.html index d365a20a..aab4e6d8 100644 --- a/pages/examples/draw.html +++ b/pages/examples/draw.html @@ -37,7 +37,6 @@ enabledPlugins: ['draw', 'export', 'icon-menu', 'toast'], mapConfiguration: { language: 'en', - epsg: 'EPSG:25832', layers: [ { id: '66', diff --git a/pages/examples/gfi.html b/pages/examples/gfi.html index ce23ab00..f835b796 100644 --- a/pages/examples/gfi.html +++ b/pages/examples/gfi.html @@ -33,7 +33,6 @@ }, mapConfiguration: { language: 'en', - epsg: 'EPSG:25832', extendedMasterportalapiMarkers: { layers: [layerId], defaultStyle: { diff --git a/pages/examples/layer.html b/pages/examples/layer.html index 32e6f8ef..421467e7 100644 --- a/pages/examples/layer.html +++ b/pages/examples/layer.html @@ -33,7 +33,6 @@ enabledPlugins: ['attributions', 'icon-menu', 'layer-chooser', 'legend'], mapConfiguration: { language: 'en', - epsg: 'EPSG:25832', locales: [ { type: 'en', diff --git a/pages/examples/locales.html b/pages/examples/locales.html index 64fe5737..76ceb3aa 100644 --- a/pages/examples/locales.html +++ b/pages/examples/locales.html @@ -35,7 +35,6 @@ enabledPlugins: ['attributions', 'icon-menu', 'layer-chooser'], mapConfiguration: { language: 'en', - epsg: 'EPSG:25832', startResolution: 5.2916638091682096, vuetify: { theme: { diff --git a/pages/examples/orientation.html b/pages/examples/orientation.html index 5b9bf1e4..db5d4972 100644 --- a/pages/examples/orientation.html +++ b/pages/examples/orientation.html @@ -44,7 +44,6 @@ ], mapConfiguration: { language: 'en', - epsg: 'EPSG:25832', startResolution: 529.166380916, startCenter: [553655.72, 5704479.25], extent: [ diff --git a/pages/examples/render.js b/pages/examples/render.js index ea6eb227..e14f6b31 100644 --- a/pages/examples/render.js +++ b/pages/examples/render.js @@ -3,7 +3,6 @@ import client from '../node_modules/@polar/client-generic/dist/polar-client.js' const commonParameters = { services: 'https://geodienste.hamburg.de/services-internet.json', mapConfiguration: { - epsg: 'EPSG:25832', layers: [ { id: '453', From ae2d539e4f2fef5d4c2b7bd17aab330628567d19 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 19 Aug 2024 19:57:03 +0200 Subject: [PATCH 12/37] Remove epsg and namedProjections from meldemichel --- packages/clients/meldemichel/src/mapConfigurations.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/packages/clients/meldemichel/src/mapConfigurations.ts b/packages/clients/meldemichel/src/mapConfigurations.ts index 0f9e7b62..9bb5eae1 100644 --- a/packages/clients/meldemichel/src/mapConfigurations.ts +++ b/packages/clients/meldemichel/src/mapConfigurations.ts @@ -25,7 +25,6 @@ const hamburgRed = '#ff0019' const commonMapConfiguration: Partial = { checkServiceAvailability: false, // service register too long - epsg: 'EPSG:25832', locales: language, vuetify: { theme: { @@ -39,16 +38,6 @@ const commonMapConfiguration: Partial = { }, }, }, - namedProjections: [ - [ - 'EPSG:25832', - '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', - ], - [ - 'EPSG:4326', - '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', - ], - ], } const commonLayers: LayerConfiguration[] = [ From be48a73725976dabc0ea1b5c19ae31abd5db0d2e Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 19 Aug 2024 19:57:43 +0200 Subject: [PATCH 13/37] Add another projection to the defaults of namedProjection --- packages/core/src/utils/createMap/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/core/src/utils/createMap/index.ts b/packages/core/src/utils/createMap/index.ts index 9bcc9f20..8076247e 100644 --- a/packages/core/src/utils/createMap/index.ts +++ b/packages/core/src/utils/createMap/index.ts @@ -59,6 +59,10 @@ export default async function createMap({ 'EPSG:31467', '+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel +nadgrids=BETA2007.gsb +units=m +no_defs +type=crs', ], + [ + 'EPSG:4647', + '+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=32500000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', + ], ], startResolution: 15.874991427504629, } From fda034b4c140990d35f846011c2b2121aff4143a Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 19 Aug 2024 19:58:11 +0200 Subject: [PATCH 14/37] Remove epsg and namedProjections from snowbox --- packages/clients/snowbox/src/mapConfiguration.ts | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/packages/clients/snowbox/src/mapConfiguration.ts b/packages/clients/snowbox/src/mapConfiguration.ts index 4101240b..39e411cf 100644 --- a/packages/clients/snowbox/src/mapConfiguration.ts +++ b/packages/clients/snowbox/src/mapConfiguration.ts @@ -13,7 +13,6 @@ const hamburgBorder = '6074' export const mapConfiguration = { language: 'en', - epsg: 'EPSG:25832', locales: language, vuetify: { theme: { @@ -27,20 +26,6 @@ export const mapConfiguration = { }, }, }, - namedProjections: [ - [ - 'EPSG:25832', - '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', - ], - [ - 'EPSG:4326', - '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', - ], - [ - 'EPSG:4647', - '+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=32500000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', - ], - ], addressSearch: { searchMethods: [ { From 4325555f350011e44ecfeb32510909d0dd542658 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 19 Aug 2024 20:00:04 +0200 Subject: [PATCH 15/37] Remove epsg and namedProjections from textLocator --- packages/clients/textLocator/src/mapConfig.ts | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/packages/clients/textLocator/src/mapConfig.ts b/packages/clients/textLocator/src/mapConfig.ts index 88df1773..fa8ca3c3 100644 --- a/packages/clients/textLocator/src/mapConfig.ts +++ b/packages/clients/textLocator/src/mapConfig.ts @@ -21,7 +21,6 @@ export const mapConfiguration: Partial = { extent: [ 288427.40898665343, 5888233.576754751, 880090.4063210202, 6188713.349959846, ], - epsg: 'EPSG:25832', locales, vuetify: { theme }, layers: [ @@ -86,22 +85,4 @@ export const mapConfiguration: Partial = { { resolution: 0.2645831904584105, scale: 1000, zoomLevel: zoomLevel++ }, { resolution: 0.1322915952292052, scale: 500, zoomLevel: zoomLevel++ }, ], - namedProjections: [ - [ - 'EPSG:31467', - '+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel +nadgrids=BETA2007.gsb +units=m +no_defs +type=crs', - ], - [ - 'EPSG:25832', - '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', - ], - [ - 'EPSG:3857', - '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', - ], - [ - 'EPSG:4326', - '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', - ], - ], } From b46f29840bb833015c5783f4613a29cc1ac764ec Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Wed, 21 Aug 2024 14:28:30 +0200 Subject: [PATCH 16/37] Add new utility type PartialBy --- packages/types/custom/CHANGELOG.md | 1 + packages/types/custom/core.ts | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/packages/types/custom/CHANGELOG.md b/packages/types/custom/CHANGELOG.md index 97b79c5a..808936ef 100644 --- a/packages/types/custom/CHANGELOG.md +++ b/packages/types/custom/CHANGELOG.md @@ -8,6 +8,7 @@ - Feature: Add new getter `deviceIsHorizontal` to `CoreGetters`. - Feature: Add `footer` to `RenderType` as an option to display attributions in a footer. - Feature: Add new parameter `showZoomSlider` to `ZoomConfiguration`. +- Feature: Add new utility type `PartialBy`. - Fix: Add `string` as option for `SearchType` since arbitrary strings can be registered. - Fix: Remove unused parameters `proxyUrl` and `loadingStrategy` from `LayerConfigurationOptions`. - Fix: Properly document optional parameters of interfaces `AddressSearchConfiguration`, `FeatureList`, `FilterConfigurationTime`, `FilterConfigurationTimeOption`, `GeoLocationConfiguration`, `LayerConfigurationOptionLayers` and `PinsConfiguration` diff --git a/packages/types/custom/core.ts b/packages/types/custom/core.ts index a6cbebd8..b51b17af 100644 --- a/packages/types/custom/core.ts +++ b/packages/types/custom/core.ts @@ -791,3 +791,12 @@ export declare class PolarStore { modules?: PolarModuleTree }): void } + +/** + * Copied from https://stackoverflow.com/a/54178819.# + * + * Makes the properties defined by type `K` optional in type `T`. + * + * Example: PartialBy\ + */ +export type PartialBy = Omit & Partial> From c749d4b1259e7725f59961de53d3ed58150b2e54 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Wed, 21 Aug 2024 14:31:33 +0200 Subject: [PATCH 17/37] Adjust getInitialState in @polar/core to reflect default state --- packages/core/src/vuePlugins/vuex.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/core/src/vuePlugins/vuex.ts b/packages/core/src/vuePlugins/vuex.ts index 61d9bf59..f31b0766 100644 --- a/packages/core/src/vuePlugins/vuex.ts +++ b/packages/core/src/vuePlugins/vuex.ts @@ -13,6 +13,7 @@ import { CoreState, MoveHandleActionButton, MoveHandleProperties, + PartialBy, PluginContainer, PolarError, } from '@polar/lib-custom-types' @@ -56,6 +57,7 @@ const mutationLogger = (store) => { Vue.use(Vuex) +// @ts-expect-error | plugin is not defined here as it is defined later on. const getInitialState = (): CoreState => ({ map: 1, clientHeight: 0, @@ -67,10 +69,11 @@ const getInitialState = (): CoreState => ({ moveHandleActionButton: 1, selected: 1, zoomLevel: 0, - // TODO: Add default values for epsg, layers, namedProjections, options and remove @ts-ignore for configuration - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - configuration: {}, + configuration: { + layers: [], + layerConf: [], + startCenter: [0, 0], + }, hasSmallDisplay: false, errors: [], language: '', From a6a0b9642d89fe59e8c70baa930561871b295f26 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Thu, 22 Aug 2024 16:30:17 +0200 Subject: [PATCH 18/37] Adjust makeDocs to change all links to anchors in @polar/core in html --- scripts/makeDocs.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/makeDocs.js b/scripts/makeDocs.js index 94454f13..7bc17390 100644 --- a/scripts/makeDocs.js +++ b/scripts/makeDocs.js @@ -139,9 +139,8 @@ if (!fs.existsSync(docPath)) { const adjustRelativePathsInHtml = (htmlContent) => { return htmlContent.replace( - /..\/..\/core\/README.md#global-plugin-parameters/g, - () => - `https://dataport.github.io/polar/docs/${client}/core.html#global-plugin-parameters` + /..\/..\/core\/README.md/g, + () => `https://dataport.github.io/polar/docs/${client}/core.html` ) } From 7d5d432688a00c8dfe2d94831b338c4f9870b29d Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Thu, 22 Aug 2024 16:30:47 +0200 Subject: [PATCH 19/37] Adjust makeDocs to change all links to anchors in @polar/core in html --- packages/core/README.md | 58 ++++++++++++++++++++++ packages/plugins/LayerChooser/README.md | 64 +++---------------------- 2 files changed, 65 insertions(+), 57 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index 825956ee..bef6cea1 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -229,6 +229,7 @@ Fields that are not set as required have default values. | fieldName | type | description | | - | - | - | | layerConf | layerConf \| string | Layer configuration of all available layers as a service register. May either be a self defined register or a link to an external register. Layers defined here are not directly shown in a client, see `mapconfiguration.layers` for that. | +| layers | layer[] | Configuration of layers that are supposed to be used in the respective client. All layers defined here have to have an entry in `mapConfiguration.layerConf`. If `@polar/plugin-layer-chooser` is installed and configured, all these layers will be displayed in that menu. | | startCenter | number[] | Initial center coordinate. Needs to be defined in the chosen leading coordinate system. | | backgroundImage | string? | Image to be displayed as a background of the map. Defaults to `''`, so no image being used. | | epsg | `EPSG:${string}`? | Leading coordinate system. The coordinate system has to be defined in `mapConfiguration.namedProjections` as well. Changing this value should also lead to changes in `mapConfiguration.startCenter`, `mapConfiguration.extent`, `mapConfiguration.options` and `mapConfiguration.startResolution` as they are described in or related to the leading coordinate system. Defaults to `'EPSG:25832'`. | @@ -346,6 +347,63 @@ Since this is the base for many functions, the service id set in this is used to | scale | number | Scale in meters. | | zoomLevel | number | Zoom level. | +##### layer + +| fieldName | type | description | +| - | - | - | +| id | string | Service register id in `mapConfiguration.layerConf`. | +| name | string | Display name in UI. | +| type | enum["background", "mask"] | Layer handling. Backgrounds are mutually exclusive, masks ("overlays") can be stacked. | +| maxZoom | number? | If set, layer only available (and selectable) up to this zoom level. | +| minZoom | number? | If set, layer only available (and selectable) from this zoom level on. | +| visibility | boolean? | Initial visibility. Defaults to `false`. | + +
+Example configuration + +```js +layers: [ + { + id: backgroundmap, + visibility: true, + type: 'background', + name: 'Basemap Grayscale', + }, + { + id: memorialsWFS, + visibility: false, + hideInMenu: true, + type: 'mask', + name: 'Memorial (WFS)', + minZoom: 7, + }, + { + id: memorialsWMS, + visibility: true, + type: 'mask', + name: 'Cultural monuments (list)', + options: { + layers: { + order: '6,24,25,4,3,2,1,0', + title: { + '6': 'Monument area', + '24': 'Majority of structures', + '25': 'Material group', + '4': 'Architectural monument', + '3': 'Natural monument', + '2': 'Water bodies', + '1': 'Architectural monument (area)', + '0': 'Natural monument (area)', + }, + legend: true, + }, + }, + }, +] +``` + +
+ ##### Plugins in POLAR are modular components that extend the functionality of the map client. They can be added using the [addPlugins](#addplugins) method and configured through the `mapConfiguration` object. Each plugin has its own set of fields and options that can be customized. diff --git a/packages/plugins/LayerChooser/README.md b/packages/plugins/LayerChooser/README.md index 138f4985..48ac35ff 100644 --- a/packages/plugins/LayerChooser/README.md +++ b/packages/plugins/LayerChooser/README.md @@ -10,76 +10,26 @@ Order of layers within a layer is currently always as initially configured. ## Configuration -The tool does not require any configuration for itself, but is based on the `mapConfiguration.layers` array. It will infer its options from there, and change layer visibility and availability depending on `minZoom` and `maxZoom`. +// TODO: Link to layers (like global plugin parameters) +The tool does not require any configuration for itself, but is based on the [`mapConfiguration.layers`](../../core/README.md#mapconfiguration.layers). +It will infer its options from there, and change layer visibility and availability depending on `minZoom` and `maxZoom`. -Each object in `mapConfiguration.layers` array fits this definition: +However, this tool also supports the optional configuration parameters `mapConfiguration.layer.options` and `mapConfiguration.layer.hideInMenu` which are described in more depth in the following table. | fieldName | type | description | | - | - | - | -| id | string | Service register id. | -| name | string | Display name in UI. | -| type | enum["background", "mask"] | Layer handling. Backgrounds are mutually exclusive, masks ("overlays") can be stacked. | | hideInMenu | boolean? | Can be set for layers of type `'mask'` to hide them in the selection menu. | -| maxZoom | number? | If set, layer only available (and selectable) to this zoom level. | -| minZoom | number? | If set, layer only available (and selectable) from this zoom level on. | | options | options? | Shows a layer-specific sub-menu; its contents are configurable. | -| visibility | boolean? | Initial visibility. Defaults to `false`. | For details on the `displayComponent` attribute, refer to the [Global Plugin Parameters](../../core/README.md#global-plugin-parameters) section of `@polar/core`. -
-Example configuration - -```js -layers: [ - { - id: backgroundmap, - visibility: true, - type: 'background', - name: 'Basemap Grayscale', - }, - { - id: memorialsWFS, - visibility: false, - hideInMenu: true, - type: 'mask', - name: 'Memorial (WFS)', - minZoom: 7, - }, - { - id: memorialsWMS, - visibility: true, - type: 'mask', - name: 'Cultural monuments (list)', - options: { - layers: { - order: '6,24,25,4,3,2,1,0', - title: { - '6': 'Monument area', - '24': 'Majority of structures', - '25': 'Material group', - '4': 'Architectural monument', - '3': 'Natural monument', - '2': 'Water bodies', - '1': 'Architectural monument (area)', - '0': 'Natural monument (area)', - }, - legend: true, - }, - }, - }, -] -``` - -
- -### mapConfiguration.layers.options +### layer.options An option wheel will appear in the layer chooser that allows opening a sub-menu with configured configuration options for the end user. | fieldName | type | description | | - | - | - | -| layers | options.layers | If configured, all configured _layers of the layer_ can be turned off and on by the user. ⚠️ Only implemented for WMS. Only implemented for top layers; that is, only first level of nesting is considered. | +| layers | layer.options.layers | If configured, all configured _layers of the layer_ can be turned off and on by the user. ⚠️ Only implemented for WMS. Only implemented for top layers; that is, only first level of nesting is considered. | Example configuration: ```js @@ -101,7 +51,7 @@ options: { }, ``` -#### mapConfiguration.layers.options.layers +#### layer.options.layers This field is named like this to match the OGC specification for their name; that is, layers have layers that may have layers that may have layers, and so on. However, only the first level (a layer's layers) is currently implemented. From 1b4960b26f22030731c9859856384d9c5c8febf6 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Thu, 22 Aug 2024 16:38:46 +0200 Subject: [PATCH 20/37] Remove unused import --- packages/core/src/vuePlugins/vuex.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/core/src/vuePlugins/vuex.ts b/packages/core/src/vuePlugins/vuex.ts index f31b0766..ef95aea3 100644 --- a/packages/core/src/vuePlugins/vuex.ts +++ b/packages/core/src/vuePlugins/vuex.ts @@ -13,7 +13,6 @@ import { CoreState, MoveHandleActionButton, MoveHandleProperties, - PartialBy, PluginContainer, PolarError, } from '@polar/lib-custom-types' From 6a0c3a7a735e8ca930ce39f22a09e938fa4cc042 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 16 Sep 2024 19:21:46 +0200 Subject: [PATCH 21/37] Remove wrongfully adjusted type and document initializeLayerList --- packages/core/README.md | 13 ++++++++++++- packages/types/custom/core.ts | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index 2025f60a..152bd1bf 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -48,6 +48,17 @@ const Plugin = (options: PluginOptions) => (instance: Vue) => If the storeModule features a `setupModule` action, it will be executed automatically after initialization. +### initializeLayerList + +Layers intended to be used in the map have to be initialized by calling `initializeLayerList` with a service register. +This register may either be a link to a predefined one or the custom one, that is also required by [mapConfiguration.layerConf](#mapconfigurationlayerconf). + +``js +core.rawLayerList.initializeLayerList(services: mapConfiguration.layerConf | string, callback?: Function) +`` + +[createMap](#createmap) is usually called inside the callback or directly after this function call. + ### createMap The map is created by calling the `createMap` method. Depending on how you use POLAR, this may already have been done, as some clients come as ready-made standalone HTML pages that do this for you. @@ -226,7 +237,7 @@ Fields that are not set as required have default values. | fieldName | type | description | | - | - | - | -| layerConf | layerConf \| string | Layer configuration of all available layers as a service register. May either be a self defined register or a link to an external register. Layers defined here are not directly shown in a client, see `mapconfiguration.layers` for that. | +| layerConf | layerConf | Layer configuration of all available layers as a service register. Layers defined here are not directly shown in a client, see `mapconfiguration.layers` for that. | | layers | layer[] | Configuration of layers that are supposed to be used in the respective client. All layers defined here have to have an entry in `mapConfiguration.layerConf`. If `@polar/plugin-layer-chooser` is installed and configured, all these layers will be displayed in that menu. | | startCenter | number[] | Initial center coordinate. Needs to be defined in the chosen leading coordinate system. | | backgroundImage | string? | Image to be displayed as a background of the map. Defaults to `''`, so no image being used. | diff --git a/packages/types/custom/core.ts b/packages/types/custom/core.ts index 74a95171..0bba992f 100644 --- a/packages/types/custom/core.ts +++ b/packages/types/custom/core.ts @@ -580,7 +580,7 @@ export interface ExtendedMasterportalapiMarkers { export interface MasterportalApiConfig { /** masterportalapi-type layer configuration */ - layerConf: Record[] | string + layerConf: Record[] /** Initial center coordinate for the mapView */ startCenter: [number, number] // Image to be displayed as a background of the map From d0da3aa555383eda1c82e46bc12b53ac387a3cff Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 16 Sep 2024 19:33:42 +0200 Subject: [PATCH 22/37] Fix type issues regarding default values --- packages/core/src/vuePlugins/vuex.ts | 2 +- packages/lib/testMountParameters/index.ts | 37 +++++++++++++++++++++++ packages/types/custom/core.ts | 13 +++++++- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/packages/core/src/vuePlugins/vuex.ts b/packages/core/src/vuePlugins/vuex.ts index ef95aea3..d1630586 100644 --- a/packages/core/src/vuePlugins/vuex.ts +++ b/packages/core/src/vuePlugins/vuex.ts @@ -56,7 +56,6 @@ const mutationLogger = (store) => { Vue.use(Vuex) -// @ts-expect-error | plugin is not defined here as it is defined later on. const getInitialState = (): CoreState => ({ map: 1, clientHeight: 0, @@ -68,6 +67,7 @@ const getInitialState = (): CoreState => ({ moveHandleActionButton: 1, selected: 1, zoomLevel: 0, + // @ts-expect-error | Required values are set in utils/createMap/index.ts configuration: { layers: [], layerConf: [], diff --git a/packages/lib/testMountParameters/index.ts b/packages/lib/testMountParameters/index.ts index c593fb00..82bb747f 100644 --- a/packages/lib/testMountParameters/index.ts +++ b/packages/lib/testMountParameters/index.ts @@ -57,6 +57,43 @@ export default (): MockParameters => { startCenter: [0, 0], layerConf: [], layers: [], + epsg: 'EPSG:25832', + backgroundImage: '', + options: [ + { resolution: 66.14579761460263, scale: 250000, zoomLevel: 0 }, + { resolution: 26.458319045841044, scale: 100000, zoomLevel: 1 }, + { resolution: 15.874991427504629, scale: 60000, zoomLevel: 2 }, + { resolution: 10.583327618336419, scale: 40000, zoomLevel: 3 }, + { resolution: 5.2916638091682096, scale: 20000, zoomLevel: 4 }, + { resolution: 2.6458319045841048, scale: 10000, zoomLevel: 5 }, + { resolution: 1.3229159522920524, scale: 5000, zoomLevel: 6 }, + { resolution: 0.6614579761460262, scale: 2500, zoomLevel: 7 }, + { resolution: 0.2645831904584105, scale: 1000, zoomLevel: 8 }, + { resolution: 0.1322915952292052, scale: 500, zoomLevel: 9 }, + ], + namedProjections: [ + [ + 'EPSG:25832', + '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', + ], + [ + 'EPSG:3857', + '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', + ], + [ + 'EPSG:4326', + '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', + ], + [ + 'EPSG:31467', + '+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel +nadgrids=BETA2007.gsb +units=m +no_defs +type=crs', + ], + [ + 'EPSG:4647', + '+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=32500000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', + ], + ], + startResolution: 15.874991427504629, }, errors: [], hasSmallDisplay: false, diff --git a/packages/types/custom/core.ts b/packages/types/custom/core.ts index 0bba992f..91ff26ea 100644 --- a/packages/types/custom/core.ts +++ b/packages/types/custom/core.ts @@ -661,7 +661,18 @@ export interface CoreState { clientHeight: number clientWidth: number components: number - configuration: MapConfig + // NOTE: The additional values are not required in the configuration but have default values. + configuration: MapConfig & + Required< + Pick< + MasterportalApiConfig, + | 'backgroundImage' + | 'epsg' + | 'namedProjections' + | 'options' + | 'startResolution' + > + > errors: PolarError[] hasSmallDisplay: boolean hovered: number From 00d64588518e0da252fb30f94ce79b0f82136923 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 16 Sep 2024 19:41:29 +0200 Subject: [PATCH 23/37] Remove TODO --- packages/plugins/LayerChooser/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/plugins/LayerChooser/README.md b/packages/plugins/LayerChooser/README.md index 48ac35ff..101880f9 100644 --- a/packages/plugins/LayerChooser/README.md +++ b/packages/plugins/LayerChooser/README.md @@ -10,7 +10,6 @@ Order of layers within a layer is currently always as initially configured. ## Configuration -// TODO: Link to layers (like global plugin parameters) The tool does not require any configuration for itself, but is based on the [`mapConfiguration.layers`](../../core/README.md#mapconfiguration.layers). It will infer its options from there, and change layer visibility and availability depending on `minZoom` and `maxZoom`. From 2a4ce81ffcce4dbbaeb16352ad60e426a5a323a8 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 16 Sep 2024 19:45:40 +0200 Subject: [PATCH 24/37] Add changelog entries --- packages/core/CHANGELOG.md | 5 +++++ packages/plugins/LayerChooser/CHANGELOG.md | 1 + packages/types/custom/CHANGELOG.md | 2 ++ 3 files changed, 8 insertions(+) diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index f7fbffc5..705ef47c 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -6,6 +6,11 @@ - Breaking: Remove support for marking client CSS via `data-polar="true"`. Please use the configuration parameter `stylePath` instead. - Feature: Add new state parameter `mapHasDimensions` to let plugins have a "hook" to react on when the map is ready. - Feature: Add `deviceIsHorizontal` as a getter to have a more central place to check if the device is in landscape mode. +- Feature: Add clearer documentation regarding `@masterportal/masterportalapi` related configuration parameters including examples. +- Feature: Officially add support for WMTS layers. +- Feature: Add reasonable default values for configuration parameters `epsg`, `backgroundImage`, `options`, `namedProjections` and `startResolution`. +- Fix: Document `rawLayerList.initializeLayerList` as an essential step when creating a client. +- Fix: Move basic documentation of `layers` from `@polar/plugin-layer-chooser` to `@polar/core`. - Fix: Adjust documentation to properly describe optionality of configuration parameters. - Fix: Add package `events` as a dependency to fix issue with `xml2js`. See https://github.com/Leonidas-from-XIV/node-xml2js/issues/697 for more information. - Chore: Update dependencies to latest versions. diff --git a/packages/plugins/LayerChooser/CHANGELOG.md b/packages/plugins/LayerChooser/CHANGELOG.md index 16b49342..09962483 100644 --- a/packages/plugins/LayerChooser/CHANGELOG.md +++ b/packages/plugins/LayerChooser/CHANGELOG.md @@ -2,6 +2,7 @@ ## unpublished +- Fix: Move relevant documentation of `layers` to `@polar/core`. - Fix: The LayerChooser plugin will keep working on the error that a layer without entry in the service register has been configured. The layer will not be displayed. - Fix: An outdated warning has been removed. - Fix: Adjust documentation to properly describe optionality of configuration parameters. diff --git a/packages/types/custom/CHANGELOG.md b/packages/types/custom/CHANGELOG.md index 7fafe74e..65bd28d4 100644 --- a/packages/types/custom/CHANGELOG.md +++ b/packages/types/custom/CHANGELOG.md @@ -12,6 +12,8 @@ - Feature: Add new types `LoaderStyles` and `LoadingIndicatorConfiguration`. - Feature: Add `loadingIndicator` to `MapConfig` to configure loader style. - Feature: Add new utility type `PartialBy`. +- Feature: Add new type `MasterportalApiConfig`. +- Feature: Change `MapConfig` to allow for partial configuration as some parameters have default values and have it be extended from `MasterportalApiConfig`. - Fix: Add `string` as option for `SearchType` since arbitrary strings can be registered. - Fix: Remove unused parameters `proxyUrl` and `loadingStrategy` from `LayerConfigurationOptions`. - Fix: Properly document optional parameters of interfaces `AddressSearchConfiguration`, `FeatureList`, `FilterConfigurationTime`, `FilterConfigurationTimeOption`, `GeoLocationConfiguration`, `LayerConfigurationOptionLayers` and `PinsConfiguration` From 73536909e912b914055a018a87ff4454d3e2e035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20R=C3=B6hling?= <73653210+dopenguin@users.noreply.github.com> Date: Mon, 23 Sep 2024 15:31:51 +0200 Subject: [PATCH 25/37] Update packages/core/README.md Co-authored-by: Dennis Sen <108349707+warm-coolguy@users.noreply.github.com> --- packages/core/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/README.md b/packages/core/README.md index 152bd1bf..3504871f 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -51,7 +51,7 @@ If the storeModule features a `setupModule` action, it will be executed automati ### initializeLayerList Layers intended to be used in the map have to be initialized by calling `initializeLayerList` with a service register. -This register may either be a link to a predefined one or the custom one, that is also required by [mapConfiguration.layerConf](#mapconfigurationlayerconf). +This register may either be a link to a predefined service register like [the Hamburg service register](https://geodienste.hamburg.de/services-internet.json), or the custom service register that is also used in [mapConfiguration.layerConf](#mapconfigurationlayerconf). ``js core.rawLayerList.initializeLayerList(services: mapConfiguration.layerConf | string, callback?: Function) From 21294279240bd5ff899e4e0cdcf0a6e90631b4d7 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 23 Sep 2024 17:12:04 +0200 Subject: [PATCH 26/37] Adjust documentation to fit actual code --- packages/core/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/README.md b/packages/core/README.md index 3504871f..5944115e 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -243,7 +243,7 @@ Fields that are not set as required have default values. | backgroundImage | string? | Image to be displayed as a background of the map. Defaults to `''`, so no image being used. | | epsg | `EPSG:${string}`? | Leading coordinate system. The coordinate system has to be defined in `mapConfiguration.namedProjections` as well. Changing this value should also lead to changes in `mapConfiguration.startCenter`, `mapConfiguration.extent`, `mapConfiguration.options` and `mapConfiguration.startResolution` as they are described in or related to the leading coordinate system. Defaults to `'EPSG:25832'`. | | extent | number[]? | Map movement will be restricted to the rectangle described by the given coordinates. Unrestricted by default. | -| namedProjections | Array<[string,string]>? | Array of usable coordinated systems mapped to a projection as a proj4 string. Defines the `'EPSG:25832'`, `'EPSG:3857'` and `'EPSG:4326'` by default. | +| namedProjections | Array<[string,string]>? | Array of usable coordinated systems mapped to a projection as a proj4 string. Defines `'EPSG:25832'`, `'EPSG:3857'`, `'EPSG:4326'`, `'EPSG:31467'` and `'EPSG:4647'` by default. | | options | zoomOption[]? | Defines all available zoom levels mapped to the respective resolution and related scale. Defines 10 zoomLevels for `'EPSG:25832'` by default. | | startResolution | number? | Initial resolution; must be described in `mapConfiguration.options`. Defaults to `15.874991427504629` which is zoom level to in the default of `mapConfiguration.options`. | From 1359f171c522974ba17f34d53c33606fb1e80eec Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 23 Sep 2024 17:13:59 +0200 Subject: [PATCH 27/37] Remove example that is part of layerChooser --- packages/core/README.md | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index 5944115e..72fab187 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -386,28 +386,6 @@ layers: [ name: 'Memorial (WFS)', minZoom: 7, }, - { - id: memorialsWMS, - visibility: true, - type: 'mask', - name: 'Cultural monuments (list)', - options: { - layers: { - order: '6,24,25,4,3,2,1,0', - title: { - '6': 'Monument area', - '24': 'Majority of structures', - '25': 'Material group', - '4': 'Architectural monument', - '3': 'Natural monument', - '2': 'Water bodies', - '1': 'Architectural monument (area)', - '0': 'Natural monument (area)', - }, - legend: true, - }, - }, - }, ] ``` From df4a62b65c2e27204e0972927de1dc0e5b792ee3 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 23 Sep 2024 17:16:39 +0200 Subject: [PATCH 28/37] Move LayerChooser specific configuration parameters to that package --- packages/core/README.md | 3 --- packages/plugins/LayerChooser/README.md | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index 72fab187..1f3e6d90 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -362,7 +362,6 @@ Since this is the base for many functions, the service id set in this is used to | - | - | - | | id | string | Service register id in `mapConfiguration.layerConf`. | | name | string | Display name in UI. | -| type | enum["background", "mask"] | Layer handling. Backgrounds are mutually exclusive, masks ("overlays") can be stacked. | | maxZoom | number? | If set, layer only available (and selectable) up to this zoom level. | | minZoom | number? | If set, layer only available (and selectable) from this zoom level on. | | visibility | boolean? | Initial visibility. Defaults to `false`. | @@ -375,14 +374,12 @@ layers: [ { id: backgroundmap, visibility: true, - type: 'background', name: 'Basemap Grayscale', }, { id: memorialsWFS, visibility: false, hideInMenu: true, - type: 'mask', name: 'Memorial (WFS)', minZoom: 7, }, diff --git a/packages/plugins/LayerChooser/README.md b/packages/plugins/LayerChooser/README.md index 101880f9..d87f2970 100644 --- a/packages/plugins/LayerChooser/README.md +++ b/packages/plugins/LayerChooser/README.md @@ -11,12 +11,14 @@ Order of layers within a layer is currently always as initially configured. ## Configuration The tool does not require any configuration for itself, but is based on the [`mapConfiguration.layers`](../../core/README.md#mapconfiguration.layers). -It will infer its options from there, and change layer visibility and availability depending on `minZoom` and `maxZoom`. +It will infer its options from there, and change layer visibility and availability depending on `minZoom` and `maxZoom`. +It also requires the configuration of `type` for each layer. However, this tool also supports the optional configuration parameters `mapConfiguration.layer.options` and `mapConfiguration.layer.hideInMenu` which are described in more depth in the following table. | fieldName | type | description | | - | - | - | +| type | enum["background", "mask"] | Layer handling. Backgrounds are mutually exclusive, masks ("overlays") can be stacked. | | hideInMenu | boolean? | Can be set for layers of type `'mask'` to hide them in the selection menu. | | options | options? | Shows a layer-specific sub-menu; its contents are configurable. | From 60856f247d4351e69beb2cff9d2b20d599155820 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 23 Sep 2024 17:17:53 +0200 Subject: [PATCH 29/37] Remove layerChooser specific configuration --- packages/core/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/core/README.md b/packages/core/README.md index 1f3e6d90..06ad6e18 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -379,7 +379,6 @@ layers: [ { id: memorialsWFS, visibility: false, - hideInMenu: true, name: 'Memorial (WFS)', minZoom: 7, }, From 6b0ba112a7b9bbbda8b3454f2d945369f03b1f63 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 23 Sep 2024 17:18:46 +0200 Subject: [PATCH 30/37] Add basic example for layer configuration to LayerChooser --- packages/plugins/LayerChooser/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/plugins/LayerChooser/README.md b/packages/plugins/LayerChooser/README.md index d87f2970..fa2b6550 100644 --- a/packages/plugins/LayerChooser/README.md +++ b/packages/plugins/LayerChooser/README.md @@ -24,6 +24,27 @@ However, this tool also supports the optional configuration parameters `mapConfi For details on the `displayComponent` attribute, refer to the [Global Plugin Parameters](../../core/README.md#global-plugin-parameters) section of `@polar/core`. +**Example configuration:** + +```js +layers: [ + { + id: backgroundmap, + visibility: true, + type: 'background', + name: 'Basemap Grayscale', + }, + { + id: memorialsWFS, + visibility: false, + hideInMenu: true, + type: 'mask', + name: 'Memorial (WFS)', + minZoom: 7, + }, +] +``` + ### layer.options An option wheel will appear in the layer chooser that allows opening a sub-menu with configured configuration options for the end user. From 71e09ee221558a2b155968f6cf9ae9db969ae479 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 23 Sep 2024 17:28:45 +0200 Subject: [PATCH 31/37] Move configuration parameters to layerChooser --- packages/core/README.md | 6 ------ packages/plugins/LayerChooser/README.md | 9 ++++++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index 06ad6e18..28d7986f 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -362,9 +362,6 @@ Since this is the base for many functions, the service id set in this is used to | - | - | - | | id | string | Service register id in `mapConfiguration.layerConf`. | | name | string | Display name in UI. | -| maxZoom | number? | If set, layer only available (and selectable) up to this zoom level. | -| minZoom | number? | If set, layer only available (and selectable) from this zoom level on. | -| visibility | boolean? | Initial visibility. Defaults to `false`. |
Example configuration @@ -373,14 +370,11 @@ Since this is the base for many functions, the service id set in this is used to layers: [ { id: backgroundmap, - visibility: true, name: 'Basemap Grayscale', }, { id: memorialsWFS, - visibility: false, name: 'Memorial (WFS)', - minZoom: 7, }, ] ``` diff --git a/packages/plugins/LayerChooser/README.md b/packages/plugins/LayerChooser/README.md index fa2b6550..2d33534f 100644 --- a/packages/plugins/LayerChooser/README.md +++ b/packages/plugins/LayerChooser/README.md @@ -11,16 +11,19 @@ Order of layers within a layer is currently always as initially configured. ## Configuration The tool does not require any configuration for itself, but is based on the [`mapConfiguration.layers`](../../core/README.md#mapconfiguration.layers). -It will infer its options from there, and change layer visibility and availability depending on `minZoom` and `maxZoom`. -It also requires the configuration of `type` for each layer. +It will infer `id` and `name` from that configuration. -However, this tool also supports the optional configuration parameters `mapConfiguration.layer.options` and `mapConfiguration.layer.hideInMenu` which are described in more depth in the following table. +This plugin requires the configuration of `mapConfiguration.layer.type`. +Also, this plugin also supports the optional configuration parameters `mapConfiguration.layer.hideInMenu`, `mapConfiguration.layer.minZoom`, `mapConfiguration.layer.maxZoom`, `mapConfiguration.layer.options` and `mapConfiguration.layer.visibility` which are described in more depth in the following table. | fieldName | type | description | | - | - | - | | type | enum["background", "mask"] | Layer handling. Backgrounds are mutually exclusive, masks ("overlays") can be stacked. | | hideInMenu | boolean? | Can be set for layers of type `'mask'` to hide them in the selection menu. | +| maxZoom | number? | If set, layer only available (and selectable) up to this zoom level. | +| minZoom | number? | If set, layer only available (and selectable) from this zoom level on. | | options | options? | Shows a layer-specific sub-menu; its contents are configurable. | +| visibility | boolean? | Initial visibility. Defaults to `false`. | For details on the `displayComponent` attribute, refer to the [Global Plugin Parameters](../../core/README.md#global-plugin-parameters) section of `@polar/core`. From 869c8273d2af9d1d17085297d82ef2fba0009dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20R=C3=B6hling?= <73653210+dopenguin@users.noreply.github.com> Date: Mon, 23 Sep 2024 17:31:34 +0200 Subject: [PATCH 32/37] Update packages/core/README.md Co-authored-by: Dennis Sen <108349707+warm-coolguy@users.noreply.github.com> --- packages/core/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/README.md b/packages/core/README.md index 3504871f..76f3b55e 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -243,7 +243,7 @@ Fields that are not set as required have default values. | backgroundImage | string? | Image to be displayed as a background of the map. Defaults to `''`, so no image being used. | | epsg | `EPSG:${string}`? | Leading coordinate system. The coordinate system has to be defined in `mapConfiguration.namedProjections` as well. Changing this value should also lead to changes in `mapConfiguration.startCenter`, `mapConfiguration.extent`, `mapConfiguration.options` and `mapConfiguration.startResolution` as they are described in or related to the leading coordinate system. Defaults to `'EPSG:25832'`. | | extent | number[]? | Map movement will be restricted to the rectangle described by the given coordinates. Unrestricted by default. | -| namedProjections | Array<[string,string]>? | Array of usable coordinated systems mapped to a projection as a proj4 string. Defines the `'EPSG:25832'`, `'EPSG:3857'` and `'EPSG:4326'` by default. | +| namedProjections | Array<[string,string]>? | Array of usable coordinated systems mapped to a projection as a proj4 string. Defines `'EPSG:25832'`, `'EPSG:3857'` and `'EPSG:4326'` by default. If you set a value, please mind that all pre-configured projections are overridden, and requiring e.g. `'EPSG:4326'` will only work if it is also defined in your override. | | options | zoomOption[]? | Defines all available zoom levels mapped to the respective resolution and related scale. Defines 10 zoomLevels for `'EPSG:25832'` by default. | | startResolution | number? | Initial resolution; must be described in `mapConfiguration.options`. Defaults to `15.874991427504629` which is zoom level to in the default of `mapConfiguration.options`. | From d3013524d7fa6268d9aa21c373b1b927616c6be3 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 23 Sep 2024 17:33:54 +0200 Subject: [PATCH 33/37] Move default values to its own file --- packages/core/src/utils/createMap/defaults.ts | 42 ++++++++++++++++++ packages/core/src/utils/createMap/index.ts | 44 +------------------ 2 files changed, 44 insertions(+), 42 deletions(-) create mode 100644 packages/core/src/utils/createMap/defaults.ts diff --git a/packages/core/src/utils/createMap/defaults.ts b/packages/core/src/utils/createMap/defaults.ts new file mode 100644 index 00000000..fd4196e0 --- /dev/null +++ b/packages/core/src/utils/createMap/defaults.ts @@ -0,0 +1,42 @@ +import { MasterportalApiConfig } from '@polar/lib-custom-types' + +// Default configuration parameters of @masterportal/masterportalapi +export default { + epsg: 'EPSG:25832', + backgroundImage: '', + options: [ + { resolution: 66.14579761460263, scale: 250000, zoomLevel: 0 }, + { resolution: 26.458319045841044, scale: 100000, zoomLevel: 1 }, + { resolution: 15.874991427504629, scale: 60000, zoomLevel: 2 }, + { resolution: 10.583327618336419, scale: 40000, zoomLevel: 3 }, + { resolution: 5.2916638091682096, scale: 20000, zoomLevel: 4 }, + { resolution: 2.6458319045841048, scale: 10000, zoomLevel: 5 }, + { resolution: 1.3229159522920524, scale: 5000, zoomLevel: 6 }, + { resolution: 0.6614579761460262, scale: 2500, zoomLevel: 7 }, + { resolution: 0.2645831904584105, scale: 1000, zoomLevel: 8 }, + { resolution: 0.1322915952292052, scale: 500, zoomLevel: 9 }, + ], + namedProjections: [ + [ + 'EPSG:25832', + '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', + ], + [ + 'EPSG:3857', + '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', + ], + [ + 'EPSG:4326', + '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', + ], + [ + 'EPSG:31467', + '+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel +nadgrids=BETA2007.gsb +units=m +no_defs +type=crs', + ], + [ + 'EPSG:4647', + '+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=32500000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', + ], + ], + startResolution: 15.874991427504629, +} as Partial diff --git a/packages/core/src/utils/createMap/index.ts b/packages/core/src/utils/createMap/index.ts index 8076247e..8616d075 100644 --- a/packages/core/src/utils/createMap/index.ts +++ b/packages/core/src/utils/createMap/index.ts @@ -1,10 +1,10 @@ import Vue from 'vue' -import { MasterportalApiConfig } from '@polar/lib-custom-types' import { makeStore } from '../../vuePlugins/vuex' import vuetify from '../../vuePlugins/vuetify' import language from '../../language' import { MapContainer } from '../../components' import { CreateOptions, MapInstance } from '../../types' +import defaults from './defaults' import subscribeFunction from './subscribe' import { updateSizeOnReady } from './updateSizeOnReady' import { makeShadowRoot } from './makeShadowRoot' @@ -27,53 +27,13 @@ export default async function createMap({ await language(mapConfiguration?.language) - const mpapiDefaults: Partial = { - epsg: 'EPSG:25832', - backgroundImage: '', - options: [ - { resolution: 66.14579761460263, scale: 250000, zoomLevel: 0 }, - { resolution: 26.458319045841044, scale: 100000, zoomLevel: 1 }, - { resolution: 15.874991427504629, scale: 60000, zoomLevel: 2 }, - { resolution: 10.583327618336419, scale: 40000, zoomLevel: 3 }, - { resolution: 5.2916638091682096, scale: 20000, zoomLevel: 4 }, - { resolution: 2.6458319045841048, scale: 10000, zoomLevel: 5 }, - { resolution: 1.3229159522920524, scale: 5000, zoomLevel: 6 }, - { resolution: 0.6614579761460262, scale: 2500, zoomLevel: 7 }, - { resolution: 0.2645831904584105, scale: 1000, zoomLevel: 8 }, - { resolution: 0.1322915952292052, scale: 500, zoomLevel: 9 }, - ], - namedProjections: [ - [ - 'EPSG:25832', - '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', - ], - [ - 'EPSG:3857', - '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', - ], - [ - 'EPSG:4326', - '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', - ], - [ - 'EPSG:31467', - '+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel +nadgrids=BETA2007.gsb +units=m +no_defs +type=crs', - ], - [ - 'EPSG:4647', - '+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=32500000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', - ], - ], - startResolution: 15.874991427504629, - } - const instance: MapInstance = new Vue({ vuetify: vuetify(mapConfiguration?.vuetify), el: shadowRoot.appendChild(document.createElement('div')), render: (createElement) => createElement(MapContainer, { props: { - mapConfiguration: { ...mpapiDefaults, ...mapConfiguration }, + mapConfiguration: { ...defaults, ...mapConfiguration }, }, }), store: makeStore(), From 97818b77235623d6af2ff635dd2250a9a88d3bc1 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Mon, 23 Sep 2024 17:53:22 +0200 Subject: [PATCH 34/37] Make the mpapiDefaults an export of @polar/core --- package-lock.json | 1 + packages/core/src/index.ts | 1 + packages/core/src/utils/createMap/defaults.ts | 20 ++++++++-- packages/lib/testMountParameters/index.ts | 39 +------------------ packages/lib/testMountParameters/package.json | 1 + 5 files changed, 22 insertions(+), 40 deletions(-) diff --git a/package-lock.json b/package-lock.json index 555f695c..b8fa6cb6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16961,6 +16961,7 @@ "version": "1.2.1", "license": "EUPL-1.2", "devDependencies": { + "@polar/core": "^1.4.1", "@polar/lib-custom-types": "^1.4.1" } }, diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 2683a92f..478682f6 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -9,6 +9,7 @@ import './monkeyHeaderLoader' export { NineLayout, NineLayoutTag } from './components/layouts' export { setLayout, getLayout } from './utils/layout' +export { default as mpapiDefaults } from './utils/createMap/defaults' export type PolarCore = typeof mpapi & { // TODO add more diff --git a/packages/core/src/utils/createMap/defaults.ts b/packages/core/src/utils/createMap/defaults.ts index fd4196e0..811b80fe 100644 --- a/packages/core/src/utils/createMap/defaults.ts +++ b/packages/core/src/utils/createMap/defaults.ts @@ -1,6 +1,6 @@ -import { MasterportalApiConfig } from '@polar/lib-custom-types' +import { MasterportalApiConfig, PartialBy } from '@polar/lib-custom-types' -// Default configuration parameters of @masterportal/masterportalapi +// Default configuration parameters for @masterportal/masterportalapi export default { epsg: 'EPSG:25832', backgroundImage: '', @@ -39,4 +39,18 @@ export default { ], ], startResolution: 15.874991427504629, -} as Partial +} as PartialBy< + // The type is this weird as CoreState.configuration has some values required ... + MasterportalApiConfig & + Required< + Pick< + MasterportalApiConfig, + | 'backgroundImage' + | 'epsg' + | 'namedProjections' + | 'options' + | 'startResolution' + > + >, + 'layerConf' | 'startCenter' +> diff --git a/packages/lib/testMountParameters/index.ts b/packages/lib/testMountParameters/index.ts index 82bb747f..76ee34fc 100644 --- a/packages/lib/testMountParameters/index.ts +++ b/packages/lib/testMountParameters/index.ts @@ -5,6 +5,7 @@ import VueI18Next from 'i18next-vue' import Vuetify from 'vuetify' import Vuex, { Store } from 'vuex' import { VueConstructor } from 'vue/types/umd' +import { mpapiDefaults } from '@polar/core' import { CoreGetters, CoreState, PolarStore } from '@polar/lib-custom-types' Vue.use(VueI18Next, { i18next }) @@ -57,43 +58,7 @@ export default (): MockParameters => { startCenter: [0, 0], layerConf: [], layers: [], - epsg: 'EPSG:25832', - backgroundImage: '', - options: [ - { resolution: 66.14579761460263, scale: 250000, zoomLevel: 0 }, - { resolution: 26.458319045841044, scale: 100000, zoomLevel: 1 }, - { resolution: 15.874991427504629, scale: 60000, zoomLevel: 2 }, - { resolution: 10.583327618336419, scale: 40000, zoomLevel: 3 }, - { resolution: 5.2916638091682096, scale: 20000, zoomLevel: 4 }, - { resolution: 2.6458319045841048, scale: 10000, zoomLevel: 5 }, - { resolution: 1.3229159522920524, scale: 5000, zoomLevel: 6 }, - { resolution: 0.6614579761460262, scale: 2500, zoomLevel: 7 }, - { resolution: 0.2645831904584105, scale: 1000, zoomLevel: 8 }, - { resolution: 0.1322915952292052, scale: 500, zoomLevel: 9 }, - ], - namedProjections: [ - [ - 'EPSG:25832', - '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', - ], - [ - 'EPSG:3857', - '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', - ], - [ - 'EPSG:4326', - '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', - ], - [ - 'EPSG:31467', - '+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel +nadgrids=BETA2007.gsb +units=m +no_defs +type=crs', - ], - [ - 'EPSG:4647', - '+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=32500000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', - ], - ], - startResolution: 15.874991427504629, + ...mpapiDefaults, }, errors: [], hasSmallDisplay: false, diff --git a/packages/lib/testMountParameters/package.json b/packages/lib/testMountParameters/package.json index 11381512..48c39465 100644 --- a/packages/lib/testMountParameters/package.json +++ b/packages/lib/testMountParameters/package.json @@ -10,6 +10,7 @@ "directory": "packages/lib/createTestMountParameters" }, "devDependencies": { + "@polar/core": "^1.4.1", "@polar/lib-custom-types": "^1.4.1" } } From be841eaf642863a410e8a3747cbcddefbb09abe5 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Thu, 26 Sep 2024 11:36:56 +0200 Subject: [PATCH 35/37] Remove backgroundImage from the repository --- packages/core/CHANGELOG.md | 2 +- packages/core/README.md | 1 - packages/core/src/utils/createMap/defaults.ts | 7 +------ packages/types/custom/core.ts | 8 +------- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 705ef47c..9a2c09e2 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -8,7 +8,7 @@ - Feature: Add `deviceIsHorizontal` as a getter to have a more central place to check if the device is in landscape mode. - Feature: Add clearer documentation regarding `@masterportal/masterportalapi` related configuration parameters including examples. - Feature: Officially add support for WMTS layers. -- Feature: Add reasonable default values for configuration parameters `epsg`, `backgroundImage`, `options`, `namedProjections` and `startResolution`. +- Feature: Add reasonable default values for configuration parameters `epsg`, `options`, `namedProjections` and `startResolution`. - Fix: Document `rawLayerList.initializeLayerList` as an essential step when creating a client. - Fix: Move basic documentation of `layers` from `@polar/plugin-layer-chooser` to `@polar/core`. - Fix: Adjust documentation to properly describe optionality of configuration parameters. diff --git a/packages/core/README.md b/packages/core/README.md index 7c25d968..f5e78e81 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -240,7 +240,6 @@ Fields that are not set as required have default values. | layerConf | layerConf | Layer configuration of all available layers as a service register. Layers defined here are not directly shown in a client, see `mapconfiguration.layers` for that. | | layers | layer[] | Configuration of layers that are supposed to be used in the respective client. All layers defined here have to have an entry in `mapConfiguration.layerConf`. If `@polar/plugin-layer-chooser` is installed and configured, all these layers will be displayed in that menu. | | startCenter | number[] | Initial center coordinate. Needs to be defined in the chosen leading coordinate system. | -| backgroundImage | string? | Image to be displayed as a background of the map. Defaults to `''`, so no image being used. | | epsg | `EPSG:${string}`? | Leading coordinate system. The coordinate system has to be defined in `mapConfiguration.namedProjections` as well. Changing this value should also lead to changes in `mapConfiguration.startCenter`, `mapConfiguration.extent`, `mapConfiguration.options` and `mapConfiguration.startResolution` as they are described in or related to the leading coordinate system. Defaults to `'EPSG:25832'`. | | extent | number[]? | Map movement will be restricted to the rectangle described by the given coordinates. Unrestricted by default. | | namedProjections | Array<[string,string]>? | Array of usable coordinated systems mapped to a projection as a proj4 string. Defines `'EPSG:25832'`, `'EPSG:3857'`, `'EPSG:4326'`, `'EPSG:31467'` and `'EPSG:4647'` by default. If you set a value, please mind that all pre-configured projections are overridden, and requiring e.g. `'EPSG:4326'` will only work if it is also defined in your override. | diff --git a/packages/core/src/utils/createMap/defaults.ts b/packages/core/src/utils/createMap/defaults.ts index 811b80fe..de03fb3f 100644 --- a/packages/core/src/utils/createMap/defaults.ts +++ b/packages/core/src/utils/createMap/defaults.ts @@ -3,7 +3,6 @@ import { MasterportalApiConfig, PartialBy } from '@polar/lib-custom-types' // Default configuration parameters for @masterportal/masterportalapi export default { epsg: 'EPSG:25832', - backgroundImage: '', options: [ { resolution: 66.14579761460263, scale: 250000, zoomLevel: 0 }, { resolution: 26.458319045841044, scale: 100000, zoomLevel: 1 }, @@ -45,11 +44,7 @@ export default { Required< Pick< MasterportalApiConfig, - | 'backgroundImage' - | 'epsg' - | 'namedProjections' - | 'options' - | 'startResolution' + 'epsg' | 'namedProjections' | 'options' | 'startResolution' > >, 'layerConf' | 'startCenter' diff --git a/packages/types/custom/core.ts b/packages/types/custom/core.ts index d2fc98b1..b12da3ed 100644 --- a/packages/types/custom/core.ts +++ b/packages/types/custom/core.ts @@ -583,8 +583,6 @@ export interface MasterportalApiConfig { layerConf: Record[] /** Initial center coordinate for the mapView */ startCenter: [number, number] - // Image to be displayed as a background of the map - backgroundImage?: string /** The epsg code of the projection that the map will use */ epsg?: `EPSG:${string}` /** Extent in which the map can be viewed in; coordinates are written in the set projection of the map set through this config. */ @@ -666,11 +664,7 @@ export interface CoreState { Required< Pick< MasterportalApiConfig, - | 'backgroundImage' - | 'epsg' - | 'namedProjections' - | 'options' - | 'startResolution' + 'epsg' | 'namedProjections' | 'options' | 'startResolution' > > errors: PolarError[] From 6e7bb737cb63ff8154c182849fd82c99ddab7681 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Thu, 26 Sep 2024 11:39:15 +0200 Subject: [PATCH 36/37] Adjust documentation --- packages/core/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index f5e78e81..33b0c14c 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -368,12 +368,12 @@ Since this is the base for many functions, the service id set in this is used to ```js layers: [ { - id: backgroundmap, + id: 'basemap', name: 'Basemap Grayscale', }, { - id: memorialsWFS, - name: 'Memorial (WFS)', + id: 'my-wfs', + name: 'My WFS service', }, ] ``` From f300533ea783d316ec0a8e57fc7ba3f7909911f9 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Thu, 26 Sep 2024 12:52:38 +0200 Subject: [PATCH 37/37] Fix tests by importing from subpath --- packages/lib/testMountParameters/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lib/testMountParameters/index.ts b/packages/lib/testMountParameters/index.ts index 75138a3a..9cb1b761 100644 --- a/packages/lib/testMountParameters/index.ts +++ b/packages/lib/testMountParameters/index.ts @@ -5,7 +5,7 @@ import VueI18Next from 'i18next-vue' import Vuetify from 'vuetify' import Vuex, { Store } from 'vuex' import { VueConstructor } from 'vue/types/umd' -import { mpapiDefaults } from '@polar/core' +import mpapiDefaults from '@polar/core/src/utils/createMap/defaults' import { CoreGetters, CoreState, PolarStore } from '@polar/lib-custom-types' Vue.use(VueI18Next, { i18next })