Skip to content

Commit

Permalink
Merge branch 'main' into dish_intern
Browse files Browse the repository at this point in the history
  • Loading branch information
warm-coolguy authored Feb 17, 2025
2 parents 983debb + de516a1 commit ba46001
Show file tree
Hide file tree
Showing 25 changed files with 319 additions and 68 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 46 additions & 3 deletions packages/clients/diplan/example/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// service id map to avoid typos, ease renames
const basemap = 'basemapde_farbe'
const xplanwms = '1111'
const xplanwfs = '1112'
const xplanwms = 'xplanwms'
const xplanwfs = 'xplanwfs'
const flurstuecke = 'flurstuecke'

export default {
startResolution: 264.583190458,
Expand All @@ -18,18 +19,21 @@ export default {
[basemap]: 'BasemapDE',
[xplanwms]: 'XPlanWMS',
[xplanwfs]: 'XPlanSynWFS',
[flurstuecke]: 'Flurstücke',
},
attributions: {
[basemap]: `$t(diplan.layers.${basemap}) © GeoBasis-DE / BKG <YEAR> CC BY 4.0`,
[xplanwms]: `$t(diplan.layers.${xplanwms}) © ???`,
[xplanwfs]: `$t(diplan.layers.${xplanwfs}) © ???`,
[flurstuecke]: `$t(diplan.layers.${flurstuecke}) © ???`,
},
},
},
},
// TODO should we provide english locales?
],
addressSearch: {
displayComponent: true,
searchMethods: [
{
queryParameters: {
Expand Down Expand Up @@ -59,10 +63,18 @@ export default {
},
{
id: xplanwfs,
visibility: true,
visibility: false,
type: 'mask',
name: `diplan.layers.${xplanwfs}`,
},
{
id: flurstuecke,
visibility: false,
// TODO available from 7, but only starts loading from 8 - bug or skill issue?
minZoom: 7,
type: 'mask',
name: `diplan.layers.${flurstuecke}`,
},
],
attributions: {
layerAttributions: [
Expand All @@ -78,8 +90,39 @@ export default {
id: xplanwfs,
title: `diplan.attributions.${xplanwfs}`,
},
{
id: flurstuecke,
title: `diplan.attributions.${flurstuecke}`,
},
],
},
draw: {
enableOptions: true,
measureOptions: {
metres: true,
kilometres: true,
hectares: true,
},
selectableDrawModes: ['Point', 'LineString', 'Circle', 'Text', 'Polygon'],
snapTo: [xplanwfs, flurstuecke],
textStyle: {
font: {
size: [10, 20, 30],
family: 'Arial',
},
},
style: {
fill: { color: 'rgb(51 117 212 / 50%)' },
stroke: {
color: '#3375d4',
width: 2,
},
circle: {
radius: 7,
fillColor: 'rgb(51 117 212 / 50%)',
},
},
},
export: {
displayComponent: true,
showJpg: false,
Expand Down
20 changes: 17 additions & 3 deletions packages/clients/diplan/example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ <h1>Testseite <code>@polar/client-diplan</code> (dev)</h1>
<main>
<section>
<h2 class="padded-x">Beispielinstanz</h2>
<div class="padded-x">
<h3>Steuerung von außen</h3>
<button id="action-plus">+</button>
<button id="action-minus">-</button>
<button id="action-toast">Toast</button>
<button id="action-load-geojson">GeoJSON hinzufügen</button>
<button id="action-zoom-to-all">Zoome auf Zeichnung</button>
<label>
Adresssuche (erstbestes Ergebnis):
<input id="action-address-search-filler"/>
</label>
<br/>
</div>
<h3 class="padded-x">Klient</h3>
<div id="polarstern">
<noscript>Bitte benutzen Sie einen Browser mit aktiviertem JavaScript, um den Kartenklienten zu nutzen.</noscript>
</div>
Expand Down Expand Up @@ -47,9 +61,9 @@ <h2>Informationen aus Kartenklient</h2>
<td>Wert der aktuellen <code>GetFeatureInformation</code>-Antwort(en) als <code>Record&lt;LayerId, Feature[]&gt;</code></td>
</tr>
<tr>
<td><code>plugin/...</code></td>
<td id="subscribed-a">uninitialized</td>
<td>Text</td>
<td><code>plugin/draw/featureCollection</code></td>
<td id="subscribed-draw">uninitialized</td>
<td>Die hergestellte Zeichnung als GeoJSON.</td>
</tr>
<tr>
<td><code>plugin/...</code></td>
Expand Down
26 changes: 20 additions & 6 deletions packages/clients/diplan/example/prod-example.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ <h1>Testseite <code>@polar/client-diplan</code> (build)</h1>
<main>
<section>
<h2 class="padded-x">Beispielinstanz</h2>
<div class="padded-x">
<h3>Steuerung von außen</h3>
<button id="action-plus">+</button>
<button id="action-minus">-</button>
<button id="action-toast">Toast</button>
<button id="action-load-geojson">GeoJSON hinzufügen</button>
<button id="action-zoom-to-all">Zoome auf Zeichnung</button>
<label>
Adresssuche (erstbestes Ergebnis):
<input id="action-address-search-filler"/>
</label>
<br/>
</div>
<h3 class="padded-x">Klient</h3>
<div id="polarstern">
<noscript>Bitte benutzen Sie einen Browser mit aktiviertem JavaScript, um den Kartenklienten zu nutzen.</noscript>
</div>
Expand Down Expand Up @@ -47,9 +61,9 @@ <h2>Informationen aus Kartenklient</h2>
<td>Wert der aktuellen <code>GetFeatureInformation</code>-Antwort(en) als <code>Record&lt;LayerId, Feature[]&gt;</code></td>
</tr>
<tr>
<td><code>plugin/...</code></td>
<td id="subscribed-a">uninitialized</td>
<td>Text</td>
<td><code>plugin/draw/featureCollection</code></td>
<td id="subscribed-draw">uninitialized</td>
<td>Die hergestellte Zeichnung als GeoJSON.</td>
</tr>
<tr>
<td><code>plugin/...</code></td>
Expand Down Expand Up @@ -81,16 +95,16 @@ <h2>Informationen aus Kartenklient</h2>
</section>
</main>
<footer>At solmen va esser necessi far uniform grammatica, pronunciation e plu sommun paroles.</footer>
<!-- Example without build tools. Most frameworks will allow importing this. (Try "* as MapClient".) -->
<!-- Example without build tools. Most frameworks will allow importing this. (Try "* as PolarClientDiPlan".) -->
<script src="../dist/polar-client.js"></script>
<!-- → window.MapClient is now available. TODO: Choose a better name. -->
<!-- → window.PolarClientDiPlan is now available. -->
<link rel="stylesheet" src="../dist/polar-client.css">
<script type="module">
import services from './services.js'
import config from './config.js'

import setup from './setup.js'
setup(MapClient, services, config)
setup(PolarClientDiPlan, services, config)
</script>
</body>
</html>
13 changes: 11 additions & 2 deletions packages/clients/diplan/example/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
export default [
{
visibility: true,
id: '1111',
id: 'xplanwms',
name: 'XPlanWMS',
url: 'https://hh-qs.xplanungsplattform.de/xplan-wms/services/wms',
typ: 'WMS',
Expand Down Expand Up @@ -137,7 +137,7 @@ export default [
},
{
visibility: false,
id: '1112',
id: 'xplanwfs',
name: 'XPlanSynWFS',
url: 'https://hh-qs.xplanungsplattform.de/xplansyn-wfs/services/xplansynwfs',
typ: 'WFS',
Expand Down Expand Up @@ -442,4 +442,13 @@ export default [
legend: true,
featureCount: 1,
},
{
id: 'flurstuecke',
typ: 'OAF',
name: 'Flurstueck',
url: 'https://api.hamburg.de/datasets/v1/alkis_vereinfacht',
collection: 'Flurstueck',
crs: 'http://www.opengis.net/def/crs/EPSG/0/25832',
bboxCrs: 'http://www.opengis.net/def/crs/EPSG/0/25832',
},
]
61 changes: 61 additions & 0 deletions packages/clients/diplan/example/setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
/* eslint-disable max-lines-per-function */

const geoJSON = {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
properties: {},
geometry: {
type: 'Polygon',
coordinates: [
[
[553702.4519707427, 5926504.665153537],
[549799.849911481, 5938873.929307467],
[582674.3113259386, 5942313.510783426],
[572421.7126956752, 5930142.68402234],
[553702.4519707427, 5926504.665153537],
],
],
},
},
],
}

/* this is an example setup function displaying how POLAR is instantiated
* you may do this in any other format as long as all required contents arrive
* in `initializeLayerList` and `createMap` */
Expand Down Expand Up @@ -40,10 +62,46 @@ export default (client, layerConf, config) => {

// TODO expand example bindings

const actionPlus = document.getElementById('action-plus')
const actionMinus = document.getElementById('action-minus')
const actionToast = document.getElementById('action-toast')
const actionLoadGeoJson = document.getElementById('action-load-geojson')
const actionZoomToAll = document.getElementById('action-zoom-to-all')
const actionFillAddressSearch = document.getElementById(
'action-address-search-filler'
)

actionPlus.onclick = () =>
mapInstance.$store.dispatch('plugin/zoom/increaseZoomLevel')
actionMinus.onclick = () =>
mapInstance.$store.dispatch('plugin/zoom/decreaseZoomLevel')
actionToast.onclick = () =>
mapInstance.$store.dispatch('plugin/toast/addToast', {
type: 'success',
text: 'Dies ist eine Beispielnachricht.',
timeout: 3000,
})
actionLoadGeoJson.onclick = () => {
mapInstance.$store.dispatch('plugin/draw/addFeatures', {
geoJSON,
})
}
actionZoomToAll.onclick = () =>
mapInstance.$store.dispatch('plugin/draw/zoomToAllFeatures', {
margin: 10, // defaults to 20
})
actionFillAddressSearch.addEventListener('input', (e) =>
mapInstance.$store.dispatch('plugin/addressSearch/search', {
input: e.target.value,
autoselect: 'first',
})
)

const htmlZoom = document.getElementById('subscribed-zoom')
const htmlGfi = document.getElementById('subscribed-gfi')
const htmlExportA = document.getElementById('subscribed-export-a')
const htmlExportImg = document.getElementById('subscribed-export-img')
const htmlDraw = document.getElementById('subscribed-draw')

mapInstance.subscribe(
'plugin/zoom/zoomLevel',
Expand All @@ -64,6 +122,9 @@ export default (client, layerConf, config) => {
htmlExportA.setAttribute('href', screenshot)
}
})
mapInstance.subscribe('plugin/draw/featureCollection', (geojson) => {
htmlDraw.innerHTML = JSON.stringify(geojson, null, 2)
})

window.mapInstance = mapInstance
})
Expand Down
8 changes: 8 additions & 0 deletions packages/clients/diplan/example/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ h2 {
border-bottom: 2px solid #2b3980;
}

#subscribed-draw, #subscribed-gfi {
display: block;
max-width: 600px;
max-height: 400px;
white-space: pre-wrap;
overflow-y: auto;
}

footer {
color: #ecf4ff;
background: #2b3980;
Expand Down
1 change: 1 addition & 0 deletions packages/clients/diplan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@polar/plugin-attributions": "^1.4.0",
"@polar/plugin-draw": "^3.0.0",
"@polar/plugin-export": "^1.2.2",
"@polar/plugin-fullscreen": "^1.2.3",
"@polar/plugin-gfi": "^3.0.0",
"@polar/plugin-icon-menu": "^1.3.1",
"@polar/plugin-layer-chooser": "^2.0.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/clients/diplan/src/polar-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import AddressSearch from '@polar/plugin-address-search'
import Attributions from '@polar/plugin-attributions'
import Draw from '@polar/plugin-draw'
import Export from '@polar/plugin-export'
import Fullscreen from '@polar/plugin-fullscreen'
import Gfi from '@polar/plugin-gfi'
import IconMenu from '@polar/plugin-icon-menu'
import LayerChooser from '@polar/plugin-layer-chooser'
Expand Down Expand Up @@ -45,6 +46,11 @@ polarCore.addPlugins([
icon: '$vuetify.icons.ruler',
id: 'draw',
},
{
plugin: Fullscreen({ renderType: 'iconMenu' }),
// TODO icon: '$vuetify.icons.fullscreen',
id: 'fullscreen',
},
{
plugin: Zoom({
renderType: 'iconMenu',
Expand All @@ -62,6 +68,7 @@ polarCore.addPlugins([
AddressSearch({
addLoading: 'plugin/loadingIndicator/addLoadingKey',
removeLoading: 'plugin/loadingIndicator/removeLoadingKey',
layoutTag: NineLayoutTag.TOP_LEFT,
// must be overridden by client-specific configuration
searchMethods: [],
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/clients/diplan/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default getClientConfig({
root: 'example',
build: {
lib: {
name: 'MapClient',
name: 'PolarClientDiPlan',
entry: '../src/polar-client.ts',
fileName: () => 'polar-client.js',
},
Expand Down
11 changes: 11 additions & 0 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ Whitelisted and confirmed parameters include:
- WMS: id, name, url, typ, format, version, transparent, layers, STYLES, singleTile
- 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
- OAF: id, name, url, typ, collection, crs, bboxCrs
- GeoJSON: id, name, url, typ, version, minScale, maxScale, legendURL

###### Example services register
Expand Down Expand Up @@ -396,6 +397,16 @@ Whitelisted and confirmed parameters include:
"layers": "layer-name",
"legendURL": "my-legend-url"
},
{
"id": "oaf",
"typ": "OAF",
"name": "My OAF",
"url": "https://api.hamburg.de/datasets/v1/stadtgruen",
"collection": "poi",
"crs": "http://www.opengis.net/def/crs/EPSG/0/25832",
"bboxCrs": "http://www.opengis.net/def/crs/EPSG/0/25832",
"gfiTheme": "default",
},
{
"id": "my-geojson",
"name": "My GeoJSON data",
Expand Down
Loading

0 comments on commit ba46001

Please sign in to comment.