Addon, which provides a JavaScript API for the LGB Masterportal map viewer.
If this addon is included to a LGB Masterportal map viewer a global object
window.MpJsApi is injected to the window object of the browser
page. The window.MpJsApi object offers the static JavaScript
functions listed below. Ensure to call them without the Addons.
prefix:Example
const stateObj = MpJsApi.getMapViewerState();
Methods
-
staticAddons.MpJsApi.activateGFITool(){void}
addons/mpJsApi/src/marker.js, line 669 -
Activates the get feature info tool
Example
MpJsApi.activateGFITool() -
async,staticAddons.MpJsApi.addFeaturesAsLayer(baseUrl, collectionId, opts, layerCfg){Promise.<Object>}
addons/mpJsApi/src/ogcApi.js, line 1008 -
Lädt Features aus einer OGC-API und fügt sie direkt als GeoJSON-Layer zur Karte hinzu. Die Funktion kombiniert zwei Schritte: 1. Laden der Features über `getFeatures(...)` 2. Darstellung der Ergebnisse als Karte-Layer über `GeoJSON.addGeoJSONLayer(...)` Dadurch können OGC-Features mit einem einzigen Aufruf geladen und visualisiert werden. Typische Anwendungsfälle: - Adressen im aktuellen Kartenausschnitt anzeigen - Polygonflächen aus einer OGC-Collection darstellen - schnelle visuelle Analyse von OGC-Daten - Debugging und Konsolen-Experimente Der Layer wird als GeoJSON-Layer in die Karte eingefügt und erhält standardmäßig den Namen `OGC:
`, sofern kein eigener Name angegeben wird. Name Type Default Description baseUrlstring Basis-URL der OGC-API. collectionIdstring ID der Collection. optsObject {} optional Optionen für den Feature-Request (siehe `getFeatures`). Name Type Default Description limitnumber 100 optional Maximale Anzahl Features. bboxArray | string optional BoundingBox oder `"map"` für aktuellen Kartenausschnitt. datetimestring optional Zeitfilter. propertiesArray.<string> optional Liste der gewünschten Attribute. sortbystring optional Sortierung der Features. cqlstring optional Optionaler CQL2-Filter. filtersObject optional Einfache Queryparameter. maxPagesnumber 1 optional Maximale Anzahl Seiten. fstring "json" optional Ausgabeformat. layerCfgObject {} optional Konfiguration des darzustellenden Layers. Name Type Description layerNamestring optional Anzeigename des Layers. singleFeatureStyleObject optional Optionaler Style für alle Features. Returns:
Name Type Description ErgebnisobjektPromise.<Object> return.ok Gibtboolean an, ob der Layer erfolgreich erstellt wurde. return.layerId IDstring des erzeugten Layers. return.count Anzahlnumber der dargestellten Features. return.meta MetadatenObject zur OGC-Abfrage. [return.error] Fehlercode.string [return.detail] Detailinformationstring zum Fehler. --------------------------------------------------------- Konsolenbeispiele --------------------------------------------------------- Examples
Beispiel 1 – Adressen im aktuellen Kartenausschnitt anzeigen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcAddFeaturesAsLayer( BASE, "adresse", { bbox: "map", limit: 100 } ); console.log(res);Beispiel 2 – Adressen mit eigenem Layernamen anzeigen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcAddFeaturesAsLayer( BASE, "adresse", { bbox: "map", limit: 50 }, { layerName: "OGC Adressen" } ); console.log(res);Beispiel 3 – Polygonflächen darstellen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcAddFeaturesAsLayer( BASE, "besondere_flaeche", { bbox: "map", limit: 20 }, { layerName: "Besondere Flächen" } ); console.log(res);Beispiel 4 – Features filtern und darstellen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcAddFeaturesAsLayer( BASE, "adresse", { bbox: "map", limit: 50, filters: { ort: "Brandenburg" } }, { layerName: "Adressen Brandenburg" } ); console.log(res);Beispiel 5 – Darstellung mit einfachem Style const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcAddFeaturesAsLayer( BASE, "adresse", { bbox: "map", limit: 100 }, { layerName: "Adressen Styled", singleFeatureStyle: { type: "circle", radius: 5, fillColor: "#ff0000", strokeColor: "#ffffff", strokeWidth: 1 } } ); console.log(res); -
staticAddons.MpJsApi.addGeoJSONLayer(geojson, cfg){String}
addons/mpJsApi/src/geoJson.js, line 448 -
Fügt dynamisch eine GeoJSON-Layer auf der Karte hinzu.
Name Type Description geojsonString | Object Das GeoJSON (als String oder Objekt), das angezeigt werden soll. cfgObject Konfigurationsobjekt: Name Type Default Description hoverFieldstring optional Name des Attributs für Tooltips beim Hover. (Optional) layerNameString Anzeigename der Ebene. styleObject optional Style-Objekt für die Layer-Darstellung (nach `style.json.md`). (Optional) hoverStyleObject optional Style-Objekt für Hover-Effekte (nach `style.json.md`). (Optional) singleFeatureStyleObject optional Alternative Style-Definition für Einzel-Features. (Optional) singleFeatureStyleHoverObject optional Alternative Hover-Style-Definition. (Optional) hoverStyleMapObject optional CSS-Stildefinitionen für Popup-Inhalte je Attribut. (Optional) clusteringboolean optional Aktiviert Clustering (Optional). clusterByAttributestring optional Attribut zum Gruppieren von Features beim Clustering. (Optional) clusterStyleMapObject optional Attributbasierte Cluster-Styles. (Optional) hideHoverLabelsboolean false optional Labels im Popup ausblenden. (Optional) popupEventModestring "hover" optional Ereignis-Modus für Popups ("hover" | "click" | "both" | "none"). (Optional) showInLayerTreeboolean true optional Sichtbarkeit im Kartenebenenbaum. (Optional) Returns:
- ID der hinzugefügten Layer.
Examples
// Einfaches GeoJSON als String laden mit festem Style MpJsApi.addGeoJSONLayer('{"type":"FeatureCollection","features":[...]}', { hoverField: "type", layerName: "exampleLayer", style: { rules: [{ style: { type: "circle", circleFillColor: [255, 0, 0, 0.8] } }] } });// GeoJSON-Objekt laden mit Single-Feature-Style und Hover-Style MpJsApi.addGeoJSONLayer(myGeoJsonObj, { layerName: "MyLayer", singleFeatureStyle: { type: "circle", fillColor: "blue", radius: 8 }, singleFeatureStyleHover: { type: "circle", fillColor: "green", radius: 10 } });// Komplexes Styling mit Tooltip-Feldern, Hover-Style, Popup-Events und Style-Regeln MpJsApi.addGeoJSONLayer(exampleGeoJSON2, { hoverField: ["postleitzahl", "strassenname"], hoverStyleMap: { strassenname: "font-weight: bold; font-size: 14px; color: #004085;", postleitzahl: "font-style: italic; font-size: 13px; color: #6c757d;" }, popupEventMode: "click", // "hover" | "click" | "both" | "none" hideHoverLabels: true, layerName: "My Lovely Layer", style: { rules: [ { style: { type: "circle", circleFillColor: [255, 105, 180, 0.8], circleRadius: 12, lineStrokeColor: [255, 20, 147, 0.9], lineStrokewidth: 2 } } ] }, hoverStyle: { rules: [ { style: { type: "circle", circleFillColor: [255, 182, 193, 1.0], circleRadius: 14, lineStrokeColor: [255, 105, 180, 1.0], lineStrokewidth: 3 } } ] } });// Nutzung von singleFeatureStyle und singleFeatureStyleHover ohne rules MpJsApi.addGeoJSONLayer(exampleGeoJSON2, { hoverField: ["postleitzahl", "strassenname"], hoverStyleMap: { strassenname: "font-weight: bold; font-size: 14px; color: #004085;", postleitzahl: "font-style: italic; font-size: 13px; color: #6c757d;" }, popupEventMode: "click", hideHoverLabels: true, layerName: "My Lovely Layer", singleFeatureStyle: { radius: 8, fillColor: "pink", strokeColor: "#ffffff", strokeWidth: 2, showLabel: true, labelField: "postleitzahl", font: "13px Arial", textColor: "#ffffff", textStrokeColor: "#000000", textStrokeWidth: 2, labelOffsetY: -12 }, singleFeatureStyleHover: { type: "circle", radius: 12, fillColor: "yellow", strokeColor: "#000000", strokeWidth: 3, showLabel: true, labelField: "postleitzahl", font: "bold 14px Arial", textColor: "#000000", textStrokeColor: "#ffffff", textStrokeWidth: 2, labelOffsetY: -14 } });// Spiderfy-Beispiel: // Mehrere Punkte liegen exakt auf derselben Koordinate. // Bei normalem Zoom erscheinen sie als Cluster. // Bei Klick auf den Cluster (und ausreichendem Zoom) werden sie per Spiderfy aufgefächert. const spiderfyGeoJSON = { type: "FeatureCollection", features: [ { type: "Feature", properties: { name: "Projekt A", category: "Modellprojekt" }, geometry: { type: "Point", coordinates: [13.405, 52.52] } }, { type: "Feature", properties: { name: "Projekt B", category: "Entwicklungsprojekt" }, geometry: { type: "Point", coordinates: [13.405, 52.52] } }, { type: "Feature", properties: { name: "Projekt C", category: "Entwicklungsprojekt" }, geometry: { type: "Point", coordinates: [13.405, 52.52] } }, { type: "Feature", properties: { name: "Projekt D", category: "Modellprojekt" }, geometry: { type: "Point", coordinates: [13.41, 52.521] } } ] }; const result = MpJsApi.addGeoJSONLayer(spiderfyGeoJSON, { layerName: "Spiderfy Demo", clustering: true, clusterByAttribute: "category", clusterDistance: 40, spiderfyMinZoom: 9, spiderfyRadius: 120, popupEventMode: "click", hoverField: "name", singleFeatureStyle: { type: "circle", radius: 8, fillColor: "#c13b3b", strokeColor: "#ffffff", strokeWidth: 2 }, defaultClusterStyle: { type: "circle", radius: 14, fillColor: [193, 59, 59, 1], strokeColor: "#ffffff", strokeWidth: 2 } }); // Optional auf die Demo zoomen GeoJSON.zoomOnGeoJSONLayer(result); // Verhalten: // - Bei kleinem Maßstab bleiben die Punkte geclustert. // - Bei Klick auf einen Cluster mit mehreren Punkten // wird bei ausreichendem Zoom Spiderfy ausgelöst. // - Punkte mit identischer Koordinate werden kreisförmig auseinandergezogen, // damit sie einzeln sichtbar und anklickbar sind.// Beispiel: GeoJSON-Layer mit Clustering, Kategorie-Farben und Spiderfy const myGeoJson = { type: "FeatureCollection", features: [ { type: "Feature", properties: { Projekt: "Projekt A", Kategorie: "Entwicklungsprojekt", IconUrl: "" }, geometry: { type: "Point", coordinates: [14.547071837821505, 52.338853439016425] } }, { type: "Feature", properties: { Projekt: "
Beschreibung Projekt AProjekt B", Kategorie: "Modellprojekt", IconUrl: "" }, geometry: { type: "Point", coordinates: [14.654953244431566, 51.75054721576917] } }, { type: "Feature", properties: { Projekt: "
Beschreibung Projekt BProjekt C", Kategorie: "Modellprojekt", IconUrl: "" }, geometry: { type: "Point", coordinates: [14.654953244431566, 51.75054721576917] } } ] }; const {layerId, layer} = MpJsApi.addGeoJSONLayer(myGeoJson, { layerName: "Standorte", clustering: true, clusterByAttribute: "Kategorie", clusterDistance: 40, spiderfyMinZoom: 10, spiderfyRadius: 80, popupEventMode: "click", hoverField: "Projekt", showHalo: true, defaultClusterStyle: { type: "circle", radius: 14, fillColor: "#666666", strokeColor: "#ffffff", strokeWidth: 2 }, singleFeatureStyle: { type: "circle", radius: 8, fillColor: "#999999", strokeColor: "#ffffff", strokeWidth: 2 }, singleFeatureStyleMap: { "Modellprojekt": { type: "circle", radius: 8, fillColor: "#1f78b4", strokeColor: "#ffffff", strokeWidth: 2 }, "Entwicklungsprojekt": { type: "circle", radius: 8, fillColor: "#33a02c", strokeColor: "#ffffff", strokeWidth: 2 } } });
Beschreibung Projekt C// Komplexes Beispiel mit Clustering, individuellen Styles und Popup-Hover-Logik MpJsApi.addGeoJSONLayer(exampleGeoJSON2, { layerName: "POIs2fr", hoverField: ["postleitzahl", "strassenname"], hoverStyleMap: { strassenname: "font-weight: bold; font-size: 14px; color: #004085;", postleitzahl: "font-style: italic; font-size: 13px; color: #6c757d;" }, clustering: true, clusterByAttribute: "postleitzahl", clusterDistance: 50, showInLayerTree: false, popupEventMode: "click", hideHoverLabels: true, defaultClusterStyle: { type: "text", font: '900 30px "Font Awesome 5 Free"', glyph: "\uf041", color: "#555", stroke: "#fff", strokeWidth: 2, offsetY: -10, showCount: true, countFont: 'bold 11px "Arial"', countColor: "#fff", countOffsetY: -12, showCountWhenSingle: false }, singleFeatureStyle: { radius: 8, fillColor: "pink", strokeColor: "#ffffff", strokeWidth: 2, showLabel: true, labelField: "name", font: "13px Arial", textColor: "#ffffff", textStrokeColor: "#000000", textStrokeWidth: 2, labelOffsetY: -12 }, singleFeatureStyleHover: { type: "circle", radius: 12, fillColor: "yellow", strokeColor: "#000000", strokeWidth: 3, showLabel: true, labelField: "name", font: "bold 14px Arial", textColor: "#000000", textStrokeColor: "#ffffff", textStrokeWidth: 2, labelOffsetY: -14 }, clusterStyleMap: { 13351: { type: "text", font: '900 30px "Font Awesome 5 Free"', glyph: "\uf2e7", color: "#000", stroke: "#fff", strokeWidth: 2, offsetY: -10, showCount: true, countFont: 'bold 11px "Arial"', countColor: "#fff", countOffsetY: -12, showCountWhenSingle: false }, 10559: { type: "text", font: '900 30px "Font Awesome 5 Free"', glyph: "\uf0fc", color: "#17a2b8", stroke: "#fff", strokeWidth: 2, offsetY: -10, showCount: true, countFont: 'bold 11px "Arial"', countColor: "#fff", countOffsetY: -12 }, 10555: { type: "text", font: '900 30px "Font Awesome 5 Free"', glyph: "\uf0f4", color: "#28a745", stroke: "#fff", strokeWidth: 2, offsetY: -10, showCount: true, countFont: 'bold 11px "Arial"', countColor: "#fff", countOffsetY: -12, showCountWhenSingle: false }, 13351: { type: "text", font: '900 30px "Font Awesome 5 Free"', glyph: "\uf805", color: "#ffc107", stroke: "#343a40", strokeWidth: 2, offsetY: -10, showCount: true, countFont: 'bold 11px "Arial"', countColor: "#fff", countOffsetY: -12 } } }); -
staticAddons.MpJsApi.addGeoJSONLayerFromURL(url, cfg){String}
addons/mpJsApi/src/geoJson.js, line 1502 -
Add GeoJSON from a URL
Name Type Description urlString The URL to the geojson cfgObject The configuration object, consisting of the following properties: Name Type Description useProxyboolean Flag indicating if the configured corsProxy of the masterportal should be used. Optional hoverFieldstring Name of the attribute that should be used in tooltips when hovering. If commited, hovering will be disabled. Optional layerNameString The name to use for the layer styleObject The style object to use for the layer using a syntax as specified by `style.json.md` in `doc` folder. Optional hoverStyleString The style object to use for a feature when hovered using a syntax as specified by `style.json.md` in `doc` folder. Optional Returns:
layerId used to reference the added layer
Example
await MpJsApi.addGeoJSONLayerFromURL("ressources/catering.json", { useProxy: false, hoverField: "type", layerName: "catering", style: { "rules": [ { "style": { "type": "circle", "circleFillColor": [255, 0, 255, 0.8], "circleRadius": 15 } } ] } }); -
staticAddons.MpJsApi.addHTMLMarker(coordinates, options)
addons/mpJsApi/src/marker.js, line 412 -
Adds a marker to the map at the given coordinates and with further optional functionality. When adding multiple markers, please ensure to use distinct IDs. This is nesseccary to prevent unwanted behaviour on marker interaction.
Name Type Description coordinatesArray The array with x / y coordinates in projection EPSG:4326 for the marker optionsObject The options object of the marker. Name Type Description idnumber The distinct id of the marker. colorstring optional Color like string (named-color, hex, rgb(a), hsl). centerMapboolean optional If set to false, map will no be centered to added marker. popupObject Object containing html content Name Type Description contentstring Content of popup as HTML string hoverContentstring optional Hover content of popup as HTML string classNamestring optional CSS class name of the popup offsetArray optional Offsets in pixels used when positioning the popup. Default [0, -20]. Example
MpJsApi.addHTMLMarker([13,51.5], {color: "red", id: 123, popup: { hoverContent: "short hover info", content: "Hi!", className: "fancy-popup"}} ) MpJsApi.addHTMLMarker([13,52], {centerMap: false, color: "green", id: 124, popup: { content: "
I am a
popupHi!", className: "fancy-popup2"}} )
I am another
popup -
staticAddons.MpJsApi.addMarker(coordinates, options)
addons/mpJsApi/src/marker.js, line 171 -
Adds a marker to the map at the given coordinates and with further optional functionality
Name Type Description coordinatesArray The array with x / y coordinates in projection EPSG:4326 for the marker optionsObject The optional options object Example
MpJsApi.addMarker([13,52], {color: "green", id: 123, address: "Mainstreet 123"}) -
staticAddons.MpJsApi.addMarkerAtCurrentPosition(){Promise.<Array.<number>>}
addons/mpJsApi/src/marker.js, line 936 -
Setzt einen Marker an der aktuellen Position des Benutzers mittels Geolocation-API. Wenn bereits ein Marker mit der ID "geolocation-marker" existiert, wird dieser vorher entfernt. Die Koordinaten (Longitude, Latitude) werden im EPSG:4326-Format zurückgegeben.
Returns:
Promise, das aufgelöst wird mit [longitude, latitude] der aktuellen Position.
Example
MpJsApi.addMarkerAtCurrentPosition() .then(([lon, lat]) => { console.log("Marker gesetzt bei:", lon, lat); }) .catch(err => { console.error("Geolocation-Fehler:", err); }); -
staticAddons.MpJsApi.addResetButton(state, callback, targetSelector, btnOpts){Object}
addons/mpJsApi/src/resetButton.js, line 50 -
Adds a button to the MapViewer in order to reset the MapViewer state.
The MapViewer state object which will be applied on click has to be provided as first argument. The state object is mandatory, otherwise the function exits without rendering the button.
In order to apply a normal map state object AND a themed map ("Themenkarte") configuration you can pass in an array as first function parameter: [0 => normal map state, 1 => themed map conf].
On button click the provided callback function will be called with a notify function accepting a string argument, to use the application specific notification API. If no callback is defined, a no-op function will be called.
The default targetSelector is#roota. should be overwritten if the button should not be placed within the application menu.
The button options can be overwritten, e.g. to apply custom styles. Please note that we do not provide any translations, as they should be handled by the calling instance. The class property will be completely overwritten, so make sure that all required classes (e.g. Bootstrap button classes) will be set explicitly by the calling instance, when setting the btnOpts.class property.Name Type Description stateObject | Array The state object or array with a state object and a themed map conf to be applied on click callbackfunction Callback function to be triggered onClick targetSelectorString Selector for the button target btnOptsObject Object that contains the button options Returns:
The added reset button markup element
Example
// executing with map state object only const stateObj = {extent: [353813, 5800182, 381488, 5813993], layers: []}; const resetCallback = (msg) => {msg("Zurückgesetzt")}; MpJsApi.addResetButton(stateObj, resetCallback, null, {text: ''}); // executing with map state object and themed map config const themedMap = {"extent": [268579, 5672299, 493510, 5954804], "layers": [{ "uuid": "99999-2222-11111", "url": "https://isk.geobasis-bb.de/ows/alkis_wms", "layers": "adv_alkis_gewaesser,adv_alkis_vegetation,adv_alkis_verkehr,adv_alkis_siedlung,adv_alkis_gebaeude,adv_alkis_flurstuecke", "title": "Liegenschaftskataster (ab 1 : 5000)", "opacity": 0.8, "visible": false }, { "uuid": "99999-2222-22222", "url": "https://isk.geobasis-bb.de/ows/sonnenenergie_wms", "layers": "photovoltaik_kreise", "title": "Sonnenenergie im Land Brandenburg (WMS-MWE-Sonnenenergie)", "transparent": true, "opacity": 0.86, "visible": true }]}; MpJsApi.addResetMenuEntry([stateObj, themedMap], resetCallback, {icon: "fas fa-sync fa-lg"}); -
staticAddons.MpJsApi.addResetMenuEntry(state, callback, opts){Object}
addons/mpJsApi/src/resetButton.js, line 216 -
Adds a menu entry to the MapViewer's main menu in order to reset the MapViewer state.
Similar to the functionAddons.MpJsApi.addResetButtonbut instead of adding a button markup this creates the correct markup to add an entry to the MapViewer's main menu.
The MapViewer state object will be applied on click and has to be provided as first argument. The state object is mandatory, otherwise the function exits without rendering the menu entry.
In order to apply a normal map state object AND a themed map ("Themenkarte") configuration you can pass in an array as first function parameter: [0 => normal map state, 1 => themed map conf].
By clicking the menu entry the provided callback function will be called with a notify function accepting a string argument, to use the application specific notification API. If no callback is defined, a no-op function will be called.
The markup options can be overwritten, e.g. to apply custom styles. Please note that we do not provide any translations, as they should be handled by the calling instance. The class property will be completely overwritten, so make sure that all required classes (e.g. Bootstrap classes) will be set explicitly by the calling instance, when setting the opts.class property.Name Type Description stateObject | Array The state object or array with a state object and a themed map conf to be applied on click callbackfunction Callback function to be triggered on click optsObject Object that contains the options Returns:
The added resetlimarkup element
Example
// executing with map state object only const stateObj = {extent: [353813, 5800182, 381488, 5813993], layers: []}; const resetCallback = (msg) => {msg("Zurückgesetzt")}; MpJsApi.addResetMenuEntry(stateObj, resetCallback, {icon: "fas fa-sync fa-lg"}); // executing with map state object and themed map config const themedMap = {"extent": [268579, 5672299, 493510, 5954804], "layers": [{ "uuid": "99999-2222-11111", "url": "https://isk.geobasis-bb.de/ows/alkis_wms", "layers": "adv_alkis_gewaesser,adv_alkis_vegetation,adv_alkis_verkehr,adv_alkis_siedlung,adv_alkis_gebaeude,adv_alkis_flurstuecke", "title": "Liegenschaftskataster (ab 1 : 5000)", "opacity": 0.8, "visible": false }, { "uuid": "99999-2222-22222", "url": "https://isk.geobasis-bb.de/ows/sonnenenergie_wms", "layers": "photovoltaik_kreise", "title": "Sonnenenergie im Land Brandenburg (WMS-MWE-Sonnenenergie)", "transparent": true, "opacity": 0.86, "visible": true }]}; MpJsApi.addResetMenuEntry([stateObj, themedMap], resetCallback, {icon: "fas fa-sync fa-lg"}); -
staticAddons.MpJsApi.addSaveButton(callback, targetSelector, btnOpts){Object}
addons/mpJsApi/src/saveButton.js, line 37 -
Adds a saveButton to the MapViewer.
On button click, the callback function will be called with an array holding the current MapViewerState (array index 0) and the current themed map configuration with the external layers (array index 1) as its first argument. The second argument is a notify function accepting a string argument, to use the application specific notification API. If no callback is defined, a no-op function will be called.
The default targetSelector is#roota. should be overwritten if the button should not be placed within the application menu.
The button options can be overwritten, e.g. to apply custom styles. Please note that we do not provide any translations, as they should be handled by the calling instance. The class property will be completely overwritten, so make sure that all required classes (e.g. Bootstrap button classes) will be set explicitly by the calling instance, when setting the btnOpts.class property.Name Type Description callbackfunction Callback function to be triggered onClick targetSelectorString Selector for the button target btnOptsObject Object that contains the button options Returns:
The added save button markup element
Example
const saveCallback = (stateObjArr, msg) => {msg("Erfolgreich gespeichert")}; MpJsApi.addSaveButton(saveCallback, null, {text: ''}); -
staticAddons.MpJsApi.addSaveMenuEntry(callback, opts){Object}
addons/mpJsApi/src/saveButton.js, line 173 -
Adds a menu entry to the MapViewer's main menu in order to save the map state.
Similar to the functionAddons.MpJsApi.addSaveButtonbut instead of adding a button markup this creates the correct markup to add an entry to the MapViewer's main menu.
By clicking the menu entry the callback function will be called with an array holding the current MapViewerState (array index 0) and the current themed map configuration with the external layers (array index 1) as its first argument. The second argument is a notify function accepting a string argument, to use the application specific notification api. If no callback is defined, a no-op function will be called.
The options can be overwritten, e.g. to apply custom styles. Please note that we do not provide any translations, as they should be handled by the calling instance. The class property will be completely overwritten, so make sure that all required classes (e.g. Bootstrap classes) will be set explicitly by the calling instance, when setting the opts.class property.Name Type Description callbackfunction Callback function to be triggered on click optsObject Object that contains the options Returns:
The added savelimarkup element
Example
const saveCallback = (stateObjArr, msg) => {msg("Erfolgreich gespeichert")}; MpJsApi.addSaveMenuEntry(saveCallback, {icon: "fas fa-save fa-lg"}); -
staticAddons.MpJsApi.applyMapViewerState(state){void}
addons/configSwitcher/mapFunctions.js, line 70 -
Applies the given state object (extent and the layers) to the LGB Masterportal map viewer.
The state object has to be in the form as it is returned byAddons.MpJsApi.getMapViewerState.Name Type Description stateObject The map viewer state object Example
MpJsApi.applyMapViewerState({extent: [353813, 5800182, 381488, 5813993]}); -
staticAddons.MpJsApi.applyMapViewerState(state){void}
addons/mpJsApi/src/mapFunctions.js, line 69 -
Applies the given state object (extent and the layers) to the LGB Masterportal map viewer.
The state object has to be in the form as it is returned byAddons.MpJsApi.getMapViewerState.Name Type Description stateObject The map viewer state object Example
MpJsApi.applyMapViewerState({extent: [353813, 5800182, 381488, 5813993]}); -
staticAddons.MpJsApi.applyThemedMap(themedMapConf){void}
addons/mpJsApi/src/themedMaps.js, line 39 -
Applies the themed map ("Themenkarten") config object to the LGB Masterportal map viewer. The
layerspart of the config object has to be in the form as it is returned byAddons.MpJsApi.getExternalLayers.Name Type Description themedMapConfObject The JSON configuration for a themed map ("Themenkarte") Example
const tmConf = { "extent": [268579, 5672299, 493510, 5954804], // EPSG:25833 as default "layers": [{ "uuid": "99999-2222-11111", "url": "https://isk.geobasis-bb.de/ows/alkis_wms", "layers": "adv_alkis_gewaesser,adv_alkis_vegetation,adv_alkis_verkehr,adv_alkis_siedlung,adv_alkis_gebaeude,adv_alkis_flurstuecke", "legendURL": "http://isk.geobasis-bb.de/ows/legends/WMS-ALKIS_Farbe.png", "title": "Liegenschaftskataster (ab 1 : 5000)", "opacity": 0.8, "singleTile": false, "visible": false }, { "uuid": "99999-2222-22222", "url": "https://isk.geobasis-bb.de/ows/sonnenenergie_wms", "layers": "photovoltaik_kreise", "legendURL": "https://isk.geobasis-bb.de/ows/sonnenenergie_wms?VERSION=1.3.0&SERVICE=WMS&REQUEST=GetLegendGraphic&FORMAT=image/png&LAYER=photovoltaik_kreise&SLD_VERSION=1.1.0", "title": "Sonnenenergie im Land Brandenburg (WMS-MWE-Sonnenenergie)", "transparent": true, "opacity": 0.86, "tilesize": 512, "visible": true }] }; MpJsApi.applyThemedMap(tmConf); -
staticAddons.MpJsApi.changeLanguage(langCode){Promise}
addons/mpJsApi/src/i18n.js, line 30 -
Sets the given language by the lang code (e.g. "de" or "en") if it is defined in the Masterportal map viewer. Otherwise nothing is done. Functionality that depends on the
changeLanguagepromise being fullfilled should be placed into the callback of the promise.Name Type Description langCodeString The code of the language to activate Returns:
promise of the i18next.changeLanguage method.
Example
MpJsApi.changeLanguage('en'); -
staticAddons.MpJsApi.clearGeoJSONHighlights(layerName)
addons/mpJsApi/src/geoJson.js, line 2006 -
Entfernt alle gesetzten Highlight-Stile aus einem GeoJSON-Layer.
Name Type Description layerNamestring Der Name des GeoJSON-Layers. Example
MpJsApi.clearGeoJSONHighlights("Gemeinden"); -
staticAddons.MpJsApi.clearLastSearch(){Object}
addons/mpJsApi/src/search.js, line 323 -
Löscht die intern gespeicherte letzte Suche. Typische Use-Cases: - Suchkontext zurücksetzen - Test- oder Debug-Zustände bereinigen
Examples
// Beispiel 1: Letzte Suche löschen const res = MpJsApi.clearLastSearch(); console.log(res);// Beispiel 2: Danach schlägt repeatLastSearch fehl MpJsApi.clearLastSearch(); console.log(MpJsApi.repeatLastSearch()); -
staticAddons.MpJsApi.compareGeoJSONLayers(layerA, layerB){Object}
addons/mpJsApi/src/geoJson.js, line 2508 -
Vergleicht zwei GeoJSON-Layer oder Clusterlayer anhand ihrer Feature-Eigenschaften. Die Funktion liefert für beide Layer: - Anzahl der Features - gemeinsamen Extent der Features - Liste der vorhandenen Attributschlüssel Clusterlayer werden automatisch entpackt, so dass die enthaltenen Original-Features verglichen werden. Typische Use-Cases: - zwei Layer grob strukturell vergleichen - prüfen, ob zwei Layer ähnliche Attribute besitzen - Feature-Anzahl und räumliche Ausdehnung gegenüberstellen Hinweis: Die Funktion vergleicht keine Geometrien im mathematischen Sinn, sondern liefert einen strukturellen Überblick.
Name Type Description layerAstring | Object Erster Layer als ID oder Layer-Objekt. layerBstring | Object Zweiter Layer als ID oder Layer-Objekt. Returns:
Name Type Description ErgebnisobjektObject return.okboolean - Gibt an, ob der Vergleich erfolgreich war. [return.a]Object - Vergleichsdaten für Layer A. [return.b]Object - Vergleichsdaten für Layer B. return.a.countnumber - Anzahl der Features in Layer A. return.b.countnumber - Anzahl der Features in Layer B. return.a.extentArray.<number> | null - Extent von Layer A. return.b.extentArray.<number> | null - Extent von Layer B. return.a.keysArray.<string> - Attributschlüssel von Layer A. return.b.keysArray.<string> - Attributschlüssel von Layer B. [return.error]string - Fehlercode. Examples
// Beispiel 1: Zwei Layer per ID vergleichen const res = MpJsApi.compareGeoJSONLayers("LayerA", "LayerB"); console.log(res);// Beispiel 2: Zwei Rückgabeobjekte vergleichen const a = MpJsApi.addGeoJSONLayer(myGeoJson1, { layerName: "LayerA" }); const b = MpJsApi.addGeoJSONLayer(myGeoJson2, { layerName: "LayerB" }); const res = MpJsApi.compareGeoJSONLayers(a, b); console.log(res); -
async,staticAddons.MpJsApi.copyShareUrl(opts){Promise.<({ok: true, url:string}|{ok: false, error:string})>}
addons/mpJsApi/src/mapFunctions.js, line 189 -
Kopiert die aktuelle Share-URL in die Zwischenablage. Die Funktion verwendet bevorzugt `Radio.trigger("Util", "copyToClipboard", url)`. Falls dies nicht verfügbar ist, wird auf `navigator.clipboard.writeText(...)` zurückgegriffen. Typische Use-Cases: - Share-Link direkt in die Zwischenablage kopieren - LLM-/UI-Workflows: „Soll ich den Link direkt kopieren?“
Name Type Description optsObject optional Name Type Default Description simpleMapboolean false optional Wenn `true`, wird die SimpleMap-URL kopiert. Examples
// Beispiel 1: Normale Share-URL kopieren const res = await MpJsApi.copyShareUrl(); console.log(res);// Beispiel 2: SimpleMap-Share-URL kopieren const res = await MpJsApi.copyShareUrl({ simpleMap: true }); console.log(res); -
staticAddons.MpJsApi.countGeoJSONFeatures(layerInput){Object}
addons/mpJsApi/src/geoJson.js, line 2310 -
Zählt die Features eines GeoJSON-Layers oder Clusterlayers. Die Funktion akzeptiert entweder: - eine Layer-ID als String - oder ein Layer-Objekt bzw. Rückgabeobjekt mit `layerId` / `layer` Bei Clusterlayern werden die enthaltenen Original-Features automatisch entpackt und gezählt. Typische Use-Cases: - prüfen, wie viele Features aktuell in einem Layer liegen - Anzahl der Treffer nach dem Laden kontrollieren - Cluster- und Nicht-Clusterlayer einheitlich auswerten
Name Type Description layerInputstring | Object Layer-ID oder Layer-Objekt. Returns:
Name Type Description ErgebnisobjektObject return.okboolean - Gibt an, ob die Zählung erfolgreich war. return.layerIdstring | null - ID des Layers. return.isClusterboolean - `true`, wenn es sich um einen Clusterlayer handelt. return.countnumber - Anzahl der Features. [return.error]string - Fehlercode. Examples
// Beispiel 1: Features eines Layers per ID zählen const res = MpJsApi.countGeoJSONFeatures("geojson-layer-123"); console.log(res);// Beispiel 2: Features eines zurückgegebenen Clusterlayers zählen const result = MpJsApi.addGeoJSONLayerCluster(myGeoJson, { layerName: "ClusterLayer", clustering: true, clusterByAttribute: "postleitzahl" }); const count = MpJsApi.countGeoJSONFeatures(result); console.log(count); -
staticAddons.MpJsApi.deactivateGFITool(){void}
addons/mpJsApi/src/marker.js, line 685 -
Deactivates the get feature info tool
Example
MpJsApi.deactivateGFITool() -
staticAddons.MpJsApi.enableMarkerClick()
addons/mpJsApi/src/marker.js, line 637 -
Enable click on marker by adding singleclick listener to the map
Example
MpJsApi.enableMarkerClick() -
staticAddons.MpJsApi.enableMarkerHover()
addons/mpJsApi/src/marker.js, line 605 -
Enable hover by adding pointermove listener to the map
Example
MpJsApi.enableMarkerHover() -
staticAddons.MpJsApi.expandExtentByPercentage(extent, percentage){Array}
addons/mpJsApi/src/marker.js, line 728 -
Expands an extent by a given percentage in all directions.
Name Type Description extentArray The original extent [minX, minY, maxX, maxY]. percentagenumber The percentage by which to expand the extent (e.g., 0.15 for 15%). Returns:
expanded extent.
-
staticAddons.MpJsApi.exportDrawGeometries(){String}
addons/mpJsApi/src/drawImportExport.js, line 12 -
Returns the GeoJSON representation of the drawn geometries within the map viewer as string or null if nothing is drawn on the map.
Returns:
The GeoJSON representation of the drawn geometries
Example
const drawnGeomsAsGeoJsonText = MpJsApi.exportDrawGeometries(); -
staticAddons.MpJsApi.filterGeoJSONByAttribute(layerName, attributeKey, value)
addons/mpJsApi/src/geoJson.js, line 2044 -
Filtert einen GeoJSON-Layer nach einem bestimmten Attributwert. Nur Features, deren Attribut den gewünschten Wert (oder einen der Werte) enthält, bleiben sichtbar. Die anderen Features werden unsichtbar gemacht, indem ihnen ein leerer Stil zugewiesen wird.
Name Type Description layerNamestring Name des GeoJSON-Layers. attributeKeystring Name des Attributs, nach dem gefiltert wird. valuestring | number | Array.<string> | Array.<number> Ein einzelner Wert oder eine Liste von Werten, die erlaubt sind. Examples
// Nur Features mit "gem_name" = "Potsdam" anzeigen MpJsApi.filterGeoJSONByAttribute("Gemeinden", "gem_name", "Potsdam");// Nur Features mit "gem_name" in der Liste anzeigen MpJsApi.filterGeoJSONByAttribute("Gemeinden", "gem_name", ["Potsdam", "Nennhausen"]); -
staticAddons.MpJsApi.findContainingFeatures(point, features, opts){Object}
addons/mpJsApi/src/ogcApi.js, line 2246 -
Prüft, welche Features aus einer Featureliste einen gegebenen Punkt enthalten. Die Funktion ist vor allem für Polygon- und MultiPolygon-Geometrien gedacht. Sie verwendet die Geometrie des Features, um zu testen, ob ein Punkt innerhalb der Fläche liegt. Der Punkt muss als Koordinate im Format `[lon, lat]` in EPSG:4326 übergeben werden. Typische Anwendungsfälle: - Prüfen, in welcher Fläche eine Adresse liegt - Polygon-Feature zu einem Marker oder Kartenklick ermitteln - Punkt-in-Polygon-Test für OGC-Features Unterstützte Geometrietypen: - Polygon - MultiPolygon Andere Geometrietypen werden ignoriert.
Name Type Default Description pointArray.<number> Punktkoordinate `[lon, lat]` in EPSG:4326. featuresArray Array mit GeoJSON-Features oder OpenLayers-Features. optsObject {} optional Optionales Konfigurationsobjekt. Name Type Default Description firstOnlyboolean false optional Wenn `true`, wird nur der erste Treffer zurückgegeben. Returns:
Name Type Description ErgebnisobjektObject return.okboolean - Gibt an, ob die Prüfung erfolgreich war. return.countnumber - Anzahl der gefundenen Treffer. return.featuresArray - Gefundene Features, die den Punkt enthalten. return.idsArray - IDs der gefundenen Features. [return.first]Object | null - Erstes gefundenes Feature, falls vorhanden. Examples
// Beispiel: Punkt gegen Polygonfeatures prüfen const point = [12.41284, 52.40352]; const res = await MpJsApi.ogcGetFeatures( "https://ogc-api.geobasis-bb.de/basemap-bebb", "besondere_flaeche", { limit: 100, bbox: "map" } ); const hit = MpJsApi.findContainingFeatures(point, res.features); console.log(hit);// Beispiel: Adresse laden und prüfen, in welcher Fläche sie liegt const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const adr = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 1 }); const coord = MpJsApi.getFeatureCoordinates(adr.features[0]); const flaechen = await MpJsApi.ogcGetFeatures(BASE, "besondere_flaeche", { limit: 200, bbox: "map" }); const res = MpJsApi.findContainingFeatures(coord.coordinates, flaechen.features); console.log(res);// Beispiel: Nur ersten Treffer verwenden const res = MpJsApi.findContainingFeatures([12.4, 52.4], features, { firstOnly: true }); if (res.ok && res.first) { console.log("Erster Treffer:", res.first); } -
staticAddons.MpJsApi.findNearestFeature(point, features, opts){Object}
addons/mpJsApi/src/ogcApi.js, line 2535 -
Ermittelt das nächstgelegene Feature zu einem gegebenen Punkt. Die Funktion vergleicht einen Referenzpunkt `[lon, lat]` in EPSG:4326 mit einer Liste von Features und berechnet die Distanz zum jeweils repräsentativen Punkt des Features. Als Feature-Koordinate wird intern `MpJsApi.getFeatureCoordinates(feature)` verwendet. Dadurch kann die Funktion mit folgenden Geometrietypen arbeiten: - Point - LineString - Polygon - MultiPolygon Typische Anwendungsfälle: - nächstgelegene Adresse zu einem Kartenklick ermitteln - nächstgelegenes Objekt bestimmen - Fallback, wenn kein Polygon den Punkt direkt enthält - Ranking von Treffern nach Entfernung Die Distanz wird mittels **Haversine-Formel** berechnet und in **Metern** zurückgegeben.
Name Type Default Description pointArray.<number> Referenzpunkt `[lon, lat]` in EPSG:4326. featuresArray Array mit GeoJSON-Features oder OpenLayers-Features. optsObject {} optional Optionales Konfigurationsobjekt. Name Type Default Description maxDistancenumber null optional Maximale Entfernung in Metern. Wenn gesetzt, werden nur Treffer innerhalb dieser Distanz berücksichtigt. includeAllDistancesboolean false optional Wenn `true`, werden zusätzlich alle berechneten Distanzen in `items` zurückgegeben. Returns:
Name Type Description ErgebnisobjektObject return.ok Gibtboolean an, ob die Berechnung erfolgreich war. return.feature NächstgelegenesObject | null Feature oder `null`. return.id ID* des nächstgelegenen Features. return.distanceMeters Entfernungnumber | null in Metern zum nächstgelegenen Feature. return.featureCoordinates RepräsentativeArray.<number> | null Koordinate des nächstgelegenen Features. [return.items] ListeArray aller berechneten Distanzen (nur wenn `includeAllDistances=true`). --------------------------------------------------------- Konsolenbeispiele --------------------------------------------------------- Examples
Beispiel 1 – Nächstgelegene Adresse bestimmen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 50, bbox: "map" }); const point = [12.41284, 52.40352]; const nearest = MpJsApi.findNearestFeature(point, res.features); console.log(nearest);Beispiel 2 – Alle berechneten Distanzen anzeigen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 20, bbox: "map" }); const point = [12.41284, 52.40352]; const nearest = MpJsApi.findNearestFeature(point, res.features, { includeAllDistances: true }); console.table( nearest.items.map(x => ({ index: x.index, id: x.id, distanceMeters: Math.round(x.distanceMeters), geometryType: x.geometryType })) );Beispiel 3 – Nur Treffer innerhalb von 500 Metern const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 100, bbox: "map" }); const point = [12.41284, 52.40352]; const nearest = MpJsApi.findNearestFeature(point, res.features, { maxDistance: 500 }); console.log(nearest);Beispiel 4 – Nächstgelegenes Feature als HTML-Marker darstellen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 50, bbox: "map" }); const point = [12.41284, 52.40352]; const nearest = MpJsApi.findNearestFeature(point, res.features); if (nearest.ok && nearest.featureCoordinates) { const p = nearest.feature.properties || {}; const label = (p.strasse || "") + " " + (p.hausnummer || "") + ", " + (p.ort || ""); MpJsApi.addHTMLMarker(nearest.featureCoordinates, { id: "nearest-address", color: "blue", centerMap: false, popup: { content: `Nächstgelegene Adresse`, className: "api-html-popup" } }); }
${label}
Entfernung: ${Math.round(nearest.distanceMeters)} mBeispiel 5 – Adresse laden und nächstgelegene Fläche bestimmen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; // Adresse laden const adr = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 1 }); const coord = MpJsApi.getFeatureCoordinates(adr.features[0]); // Polygonfeatures laden const flaechen = await MpJsApi.ogcGetFeatures(BASE, "besondere_flaeche", { limit: 200, bbox: "map" }); // nächstgelegenes Polygon bestimmen const nearest = MpJsApi.findNearestFeature(coord.coordinates, flaechen.features); console.log(nearest); -
staticAddons.MpJsApi.fitToCurrentLayers(){Object|Object}
addons/mpJsApi/src/mapFunctions.js, line 682 -
Zoomt auf den gemeinsamen Extent aller aktuell sichtbaren Layer. Es werden rekursiv alle sichtbaren Leaf-Layer durchsucht und deren Extents zu einem gemeinsamen Extent kombiniert. Typische Use-Cases: - auf alle aktuell sichtbaren Layer zoomen - nach dem Aktivieren mehrerer Layer den gemeinsamen Ausschnitt anpassen
Examples
// Beispiel 1: Auf alle sichtbaren Layer fitten MpJsApi.fitToCurrentLayers();// Beispiel 2: Ergebnis prüfen console.log(MpJsApi.fitToCurrentLayers()); -
staticAddons.MpJsApi.freeTextSearch(searchText, opts){void}
addons/mpJsApi/src/search.js, line 109 -
Startet eine Freitextsuche und speichert sie als letzte Suche im Modul-Cache. Diese Funktion ist ein einfacher Komfort-Wrapper um `triggerSearch(...)`. Die Suchparameter werden zusätzlich intern gespeichert, damit sie später über `repeatLastSearch()` erneut ausgelöst werden können. Typische Use-Cases: - einfache Textsuche nach Orten, Straßen oder Objekten - Standardsuche für LLM-/UI-Workflows
Name Type Default Description searchTextstring Freitext, nach dem gesucht werden soll. optsObject {} optional Optionale Suchparameter wie bei `triggerSearch`. Examples
// Beispiel 1: Einfache Freitextsuche MpJsApi.freeTextSearch("Potsdam");// Beispiel 2: Freitextsuche mit Limit MpJsApi.freeTextSearch("Berlin", { limit: 5 }); -
async,staticAddons.MpJsApi.getConformance(baseUrl){Promise.<Object>}
addons/mpJsApi/src/ogcApi.js, line 1090 -
Lädt die Conformance-Klassen einer OGC-API. Die Funktion ruft den Endpunkt `/conformance` der OGC-API auf und liefert die unterstützten OGC-Konformitätsklassen zurück. Sie ist besonders nützlich, um vorab zu prüfen, welche Fähigkeiten ein OGC-Dienst unterstützt, z. B.: - OGC API Features Core - Queryables - Filter - Sortierung - weitere optionale Erweiterungen Typische Use-Cases: - Fähigkeiten einer unbekannten OGC-API prüfen - vor erweiterten Requests die API-Unterstützung testen - Fehlerdiagnose bei nicht unterstützten Funktionen
Name Type Description baseUrlstring Basis-URL der OGC-API. Returns:
Name Type Description ErgebnisobjektPromise.<Object> return.okboolean - Gibt an, ob die Anfrage erfolgreich war. [return.conformsTo]Array.<string> - Liste der unterstützten Conformance-Klassen. [return.error]string - Fehlercode bei fehlgeschlagenem Request. [return.detail]string - Zusatzinformation zum Fehler. Examples
// Beispiel 1: Conformance-Klassen laden const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetConformance(BASE); console.log(res);// Beispiel 2: Conformance-Klassen als Tabelle ausgeben const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetConformance(BASE); if (!res.ok) { console.error("Conformance konnte nicht geladen werden:", res); } else { console.table( res.conformsTo.map((uri, i) => ({ i, uri })) ); }// Beispiel 3: Vor Queryables prüfen, ob die API erreichbar ist const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const conf = await MpJsApi.ogcGetConformance(BASE); if (!conf.ok) { console.error(conf); } else { console.log("Anzahl unterstützter Klassen:", conf.conformsTo.length); } -
staticAddons.MpJsApi.getExternalLayerModels(){Array.<Object>}
addons/mpJsApi/src/themedMaps.js, line 84 -
Returns the external layer Backbone models of the LGB Masterportal map viewer.
.Returns:
Array of external layer Backbone models
Example
const externalLayerModels = MpJsApi.getExternalLayerModels(); -
staticAddons.MpJsApi.getExternalLayers(){Array.<Object>}
addons/mpJsApi/src/themedMaps.js, line 115 -
Returns the external layers of the LGB Masterportal map viewer.
The returned layer objects are of equivalent structure than the one, which is accepted byAddons.MpJsApi.applyThemedMapReturns:
Array of external layer configurations
Example
const externalLayers = MpJsApi.getExternalLayers(); -
async,staticAddons.MpJsApi.getFeatureById(baseUrl, collectionId, featureId, opts){Promise.<Object>}
addons/mpJsApi/src/ogcApi.js, line 1185 -
Lädt ein einzelnes Feature gezielt über seine ID. Die Funktion ruft den OGC-API-Endpunkt `/collections/{collectionId}/items/{featureId}` auf und liefert das angeforderte Feature zurück. Typische Use-Cases: - Detailansicht zu einem bekannten Feature laden - ein zuvor ausgewähltes Feature erneut gezielt abrufen - Treffer aus einer Trefferliste per `featureId` nachladen Wichtig: Die `featureId` ist normalerweise nicht vorab bekannt. Sie sollte in der Regel aus einer vorherigen Abfrage stammen, z. B. aus: - `getFeatures(...)` - `getFeaturesInMapExtent(...)` - `findAddress(...)`
Name Type Default Description baseUrlstring Basis-URL der OGC-API. collectionIdstring ID der Collection. featureIdstring | number ID des gewünschten Features. optsObject {} optional Optionales Konfigurationsobjekt. Name Type Default Description fstring "json" optional Ausgabeformat, standardmäßig `"json"`. Returns:
Name Type Description ErgebnisobjektPromise.<Object> return.okboolean - Gibt an, ob das Feature erfolgreich geladen wurde. [return.feature]Object - Das geladene Feature. [return.error]string - Fehlercode bei fehlgeschlagenem Request. [return.detail]string - Zusatzinformation zum Fehler. Examples
// Beispiel 1: Feature direkt über bekannte ID laden const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatureById(BASE, "adresse", 1); console.log(res);// Beispiel 2: Erst Trefferliste laden, dann erstes Feature per ID nachladen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const list = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 5, bbox: "map" }); if (!list.ok || !list.features?.length) { console.error("Keine Features gefunden:", list); } else { const featureId = list.features[0].id; const one = await MpJsApi.ogcGetFeatureById(BASE, "adresse", featureId); console.log(one); }// Beispiel 3: Feature-ID aus Auswahl nachladen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const list = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 10, bbox: "map" }); const picked = MpJsApi.ogcGetFeaturesByIndex(list.features, [0]); if (picked.ok && picked.features.length) { const detail = await MpJsApi.ogcGetFeatureById( BASE, "adresse", picked.features[0].id ); console.log(detail); } -
staticAddons.MpJsApi.getFeatureCoordinates(feature){Object}
addons/mpJsApi/src/ogcApi.js, line 2063 -
Extrahiert eine repräsentative Koordinate aus einem GeoJSON-Feature. Die Funktion liefert eine Punktkoordinate `[lon, lat]` im Koordinatensystem **EPSG:4326 (WGS84)** zurück. Diese Koordinate kann anschließend z. B. für Marker, Karten-Zentrierung oder Distanzberechnungen verwendet werden. Unterstützte Geometrietypen: | Geometrietyp | Rückgabe | |---------------|-----------| | Point | direkte Koordinate | | LineString | Mittelpunkt der Linie | | Polygon | erster Punkt des äußeren Rings | | MultiPolygon | erster Punkt des ersten Polygons | Die Funktion ist besonders nützlich, wenn ein LLM oder eine Anwendung ein beliebiges Feature in eine **darstellbare Punktposition** umwandeln muss (z. B. für Marker).
Name Type Description featureObject Ein GeoJSON-Feature (z. B. aus `ogcGetFeatures`). Returns:
Name Type Description ErgebnisobjektObject return.okboolean - Gibt an, ob Koordinaten erfolgreich extrahiert wurden. return.coordinatesArray.<number> - Koordinaten `[lon, lat]` in EPSG:4326. return.geometryTypestring - Geometrietyp des Features. Examples
// Beispiel: Koordinate eines Features ermitteln const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 1 }); const feature = res.features[0]; const coord = MpJsApi.getFeatureCoordinates(feature); console.log(coord);// Beispiel: Marker auf Feature setzen const coord = MpJsApi.getFeatureCoordinates(res.features[0]); if (coord.ok) { MpJsApi.addMarker(coord.coordinates, { id: "marker-1", color: "blue" }); }// Beispiel: HTML-Marker auf Feature setzen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 1 }); const feature = res.features[0]; const coord = MpJsApi.getFeatureCoordinates(feature); const props = feature.properties || {}; const label = (props.strasse || "") + " " + (props.hausnummer || "") + ", " + (props.ort || ""); if (coord.ok) { MpJsApi.addHTMLMarker(coord.coordinates, { id: "html-marker", color: "blue", centerMap: false, popup: { content: `${label}`, className: "api-html-popup" } }); }// Beispiel: Koordinate für weitere Geometrieoperationen verwenden const coord = MpJsApi.getFeatureCoordinates(feature); if (coord.ok) { console.log("Longitude:", coord.coordinates[0]); console.log("Latitude:", coord.coordinates[1]); } -
async,staticAddons.MpJsApi.getFeatures(baseUrl, collectionId, opts){Promise.<Object>}
addons/mpJsApi/src/ogcApi.js, line 704 -
Lädt Features aus einer OGC-API-Collection. Die Funktion ruft den OGC-API-Endpunkt `/collections/{collectionId}/items` auf und liefert die gefundenen Features als GeoJSON-FeatureCollection sowie als einfaches Feature-Array zurück. Unterstützt werden unter anderem: - BoundingBox-Filter (`bbox`) - aktueller Kartenausschnitt (`bbox: "map"`) - Zeitfilter (`datetime`) - Attributeinschränkung (`properties`) - Sortierung (`sortby`) - CQL2-Textfilter (`cql`) - einfache Query-Parameter (`filters`) - mehrseitige Requests über `next`-Links (`maxPages`) Typische Anwendungsfälle: - Features einer Collection laden - Adressen oder Flächen im aktuellen Kartenausschnitt abrufen - Datensätze filtern und anschließend weiterverarbeiten - Features direkt als Layer darstellen Hinweise: - Wenn `bbox: "map"` verwendet wird, wird automatisch der aktuelle Kartenausschnitt in EPSG:4326 bestimmt. - `bbox-crs` wird bewusst nicht gesetzt. - Pagination über OGC-`next`-Links wird bis `maxPages` verfolgt.
Name Type Default Description baseUrlstring Basis-URL der OGC-API. collectionIdstring ID der Collection. optsObject {} optional Optionales Konfigurationsobjekt. Name Type Default Description limitnumber 100 optional Maximale Anzahl Features pro Request. bboxArray.<number> | string | null null optional BoundingBox als Array `[minx, miny, maxx, maxy]` oder `"map"` für den aktuellen Kartenausschnitt. datetimestring | null null optional Optionaler OGC-Zeitfilter. propertiesArray.<string> | null null optional Liste gewünschter Attribute. sortbystring | null null optional Sortierparameter. cqlstring | null null optional CQL2-Textfilter. Wird als `filter` mit `filter-lang=cql2-text` gesendet. filtersObject | null null optional Einfache Zusatzparameter für den Request. maxPagesnumber 1 optional Maximale Anzahl abzufragender Seiten. fstring "json" optional Ausgabeformat der API. Returns:
Name Type Description ErgebnisobjektPromise.<Object> return.ok Gibtboolean an, ob der Request erfolgreich war. [return.fc] ErgebnisObject als GeoJSON-FeatureCollection. [return.features] EinfachesArray Array aller geladenen Features. [return.meta] MetadatenObject zur Abfrage. [return.meta.pages] Anzahlnumber geladener Seiten. [return.meta.next] Nächsterstring | null Link, falls vorhanden. [return.meta.baseUrl] Normalisiertestring Basis-URL. [return.meta.collectionId] Collection-IDstring der Abfrage. [return.error] Fehlercode.string [return.detail] Zusatzinformationstring zum Fehler. --------------------------------------------------------- Konsolenbeispiele --------------------------------------------------------- Examples
// Beispiel 1: Einfache Features laden const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 10 }); console.log(res);// Beispiel 2: Features im aktuellen Kartenausschnitt laden const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 200, bbox: "map" }); console.log(res);// Beispiel 3: Features direkt als Layer anzeigen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 200, bbox: "map" }); if (res.ok) { MpJsApi.addGeoJSONLayer( { type: "FeatureCollection", features: res.features }, { layerName: "OGC Adressen (map extent)", singleFeatureStyle: { type: "circle", radius: 5, fillColor: "#ff0000", strokeColor: "#ffffff", strokeWidth: 1 } } ); }// Beispiel 4: Features mit fester BoundingBox laden const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 50, bbox: [12.3, 52.3, 12.5, 52.5] }); console.log(res);// Beispiel 5: Nur bestimmte Attribute anfordern const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 20, properties: ["ort", "strasse", "hausnummer"] }); console.log(res);// Beispiel 6: Mit einfachem Filter arbeiten const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 50, bbox: "map", filters: { ort: "Brandenburg" } }); console.log(res);// Beispiel 7: Mehrseitige Abfrage erlauben const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 100, bbox: "map", maxPages: 3 }); console.log("Geladene Seiten:", res.meta?.pages); console.log("Anzahl Features:", res.features?.length);// Beispiel 8: Features nachgeladen und anschließend Auswahl treffen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 50, bbox: "map" }); const selected = MpJsApi.selectFeatures(res.features, "first 3", { asFeatureCollection: true }); console.log(selected);// Beispiel 9: Polygonfeatures laden const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "besondere_flaeche", { limit: 5 }); console.table( res.features.map((f, i) => ({ i, id: f.id, geometryType: f.geometry?.type })) );// Beispiel 10: Fehlerbehandlung const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "unbekannte_collection", { limit: 10 }); if (!res.ok) { console.error("OGC-Request fehlgeschlagen:", res.error, res.detail); } else { console.log(res.features); } -
staticAddons.MpJsApi.getFeaturesByIndex(features, indices){Object}
addons/mpJsApi/src/ogcApi.js, line 1378 -
Wählt ein oder mehrere Features aus einer vorhandenen Featureliste per Index aus. Die Funktion ist eine einfache Auswahlhilfe für Trefferlisten. Sie erwartet ein Feature-Array und einen einzelnen Index oder mehrere Indizes und gibt die passenden Features zurück. Typische Use-Cases: - Treffer 0, 3 und 5 aus einer Ergebnisliste auswählen - Nutzerwahl aus einer Konsole-Trefferliste umsetzen - Features vor einer Detailabfrage oder Darstellung eingrenzen Hinweis: Die Funktion arbeitet nur auf einem bereits vorhandenen Array von Features und lädt keine Daten nach.
Name Type Description featuresArray Featureliste, z. B. aus `ogcGetFeatures(...)`. indicesnumber | Array.<number> Einzelner Index oder Array mit Indizes. Returns:
Name Type Description ErgebnisobjektObject return.okboolean - Gibt an, ob die Auswahl verarbeitet wurde. return.countnumber - Anzahl der gefundenen Features. return.featuresArray - Liste ausgewählter Einträge mit `index`, `id` und `feature`. return.invalidIndicesArray.<number> - Ungültige Indizes. [return.error]string - Fehlercode. Examples
// Beispiel 1: Einen Treffer per Index auswählen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 10, bbox: "map" }); const picked = MpJsApi.ogcGetFeaturesByIndex(res.features, 0); console.log(picked);// Beispiel 2: Mehrere Treffer auswählen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 10, bbox: "map" }); const picked = MpJsApi.ogcGetFeaturesByIndex(res.features, [3, 6, 8]); console.log(picked);// Beispiel 3: Auswahl als Layer darstellen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 10, bbox: "map" }); const picked = MpJsApi.ogcGetFeaturesByIndex(res.features, [0, 1, 2]); if (picked.ok && picked.count > 0) { MpJsApi.addGeoJSONLayer( { type: "FeatureCollection", features: picked.features.map(x => x.feature) }, { layerName: "Ausgewählte Treffer" } ); }// Beispiel 4: Ungültige Indizes prüfen const picked = MpJsApi.ogcGetFeaturesByIndex(res.features, [0, 99, 100]); console.log("Ungültige Indizes:", picked.invalidIndices); -
staticAddons.MpJsApi.getFeaturesInMapExtent(baseUrl, collectionId, opts){Promise.<Object>}
addons/mpJsApi/src/ogcApi.js, line 1291 -
Lädt Features einer Collection für den aktuellen Kartenausschnitt. Die Funktion ist ein Komfort-Wrapper für `getFeatures(...)` und setzt automatisch `bbox: "map"`. Dadurch werden nur die Features geladen, die zum aktuellen Kartenausschnitt der Karte passen. Typische Use-Cases: - alle sichtbaren Adressen laden - sichtbare Flächen im aktuellen Ausschnitt abrufen - schnelle Konsolen-Tests bezogen auf die aktuelle Karte
Name Type Default Description baseUrlstring Basis-URL der OGC-API. collectionIdstring ID der Collection. optsObject {} optional Optionales Konfigurationsobjekt. Name Type Default Description limitnumber 100 optional Maximale Anzahl Features. datetimestring optional Optionaler Zeitfilter. propertiesArray.<string> optional Optional einzuschränkende Property-Liste. sortbystring optional Optionaler Sortierschlüssel. cqlstring optional Optionaler CQL2-Filter. filtersObject optional Optionale einfache Query-Parameter. maxPagesnumber 1 optional Maximale Anzahl Seiten. fstring "json" optional Ausgabeformat. Returns:
Name Type Description ErgebnisobjektPromise.<Object> von `getFeatures(...)` return.okboolean - Gibt an, ob die Anfrage erfolgreich war. [return.fc]Object - FeatureCollection. [return.features]Array - Geladene Features. [return.meta]Object - Metadaten zur Abfrage. [return.error]string - Fehlercode. [return.detail]string - Zusatzinformation zum Fehler. Examples
// Beispiel 1: Adressen im aktuellen Kartenausschnitt laden const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeaturesInMapExtent(BASE, "adresse", { limit: 100 }); console.log(res);// Beispiel 2: Sichtbare Adressen als Layer anzeigen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeaturesInMapExtent(BASE, "adresse", { limit: 100 }); if (!res.ok) { console.error(res); } else { MpJsApi.addGeoJSONLayer( { type: "FeatureCollection", features: res.features }, { layerName: "OGC Adressen (Map Extent)", singleFeatureStyle: { type: "circle", radius: 5, fillColor: "#ff0000", strokeColor: "#ffffff", strokeWidth: 1 } } ); }// Beispiel 3: Polygon-Features im aktuellen Ausschnitt laden const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeaturesInMapExtent(BASE, "besondere_flaeche", { limit: 20 }); console.log("Gefundene Flächen:", res.features?.length); -
staticAddons.MpJsApi.getLanguages(){Object}
addons/mpJsApi/src/i18n.js, line 13 -
Returns the defined languages in the LGB Masterportal map viewer as object mapping the lang code to the human readable form (e.g.
{de: "deutsch"}).Returns:
The object with supported languages
Example
const langs = MpJsApi.getLanguages(); -
staticAddons.MpJsApi.getLastSearch(){Object|null}
addons/mpJsApi/src/search.js, line 349 -
Gibt die zuletzt gespeicherte Suche aus dem internen Cache zurück. Die Funktion ist vor allem für Debugging, Telemetrie oder LLM-Workflows nützlich, um den aktuellen Suchkontext zu inspizieren.
Returns:
Suche oder `null`, wenn keine Suche gespeichert ist.
Examples
// Beispiel 1: Letzte Suche inspizieren MpJsApi.freeTextSearch("Potsdam", { limit: 5 }); console.log(MpJsApi.getLastSearch());// Beispiel 2: Nach Cache-Löschung ist kein Suchkontext mehr vorhanden MpJsApi.clearLastSearch(); console.log(MpJsApi.getLastSearch()); // null -
staticAddons.MpJsApi.getMapProjection(){Object|Object}
addons/mpJsApi/src/mapFunctions.js, line 778 -
Gibt die aktuelle Kartenprojektion zurück. Typischerweise ist dies ein String wie `"EPSG:25833"` oder `"EPSG:3857"`.
Examples
// Beispiel 1: Kartenprojektion ausgeben console.log(MpJsApi.getMapProjection());// Beispiel 2: Nur den EPSG-Code ausgeben const res = MpJsApi.getMapProjection(); if (res.ok) { console.log("Projektion:", res.projection); } -
staticAddons.MpJsApi.getMapViewerState(){Object}
addons/configSwitcher/mapFunctions.js, line 30 -
Returns the current state (extent, layers) of the LGB Masterportal map viewer.
Returns:
The map viewer state object
Example
const mvs = MpJsApi.getMapViewerState(); -
staticAddons.MpJsApi.getMapViewerState(){Object}
addons/mpJsApi/src/mapFunctions.js, line 30 -
return the current state (extent, layers) of the LGB Masterportal map viewer.
Returns:
The map viewer state object
Example
const mvs = MpJsApi.getMapViewerState(); -
staticAddons.MpJsApi.getMarkerAsPointCoords(){Array}
addons/mpJsApi/src/marker.js, line 120 -
Return all Marker Coords (Search, Coordinate query) in EPSG:4326
No Search Results => Return empty Array[]Returns:
returns an array with the coordinates or empty Array
Example
MpJsApi.getMarkerAsPointCoords(); -
staticAddons.MpJsApi.getMarkerAsPointLayer(){ol.layer.Vector}
addons/mpJsApi/src/marker.js, line 57 -
Return the marker vector layer containing all markers [Search, Coordinate query]. If the layer cannot be found, it will be created and added to the map.
Returns:
vector layer containing the marker features
-
staticAddons.MpJsApi.getMarkerCoords(){Array}
addons/mpJsApi/src/marker.js, line 100 -
Return all Marker Coords [extern] in EPSG:4326
Returns:
returns an array with the coordinates
Example
MpJsApi.getMarkerCoords(); -
staticAddons.MpJsApi.getMarkerLayer(){ol.layer.Vector}
addons/mpJsApi/src/marker.js, line 27 -
Return the marker vector layer containing all markers. If the layer cannot be found, it will be created and added to the map.
Returns:
vector layer containing the marker features
-
staticAddons.MpJsApi.getOlMap(){ol/Map}
addons/configSwitcher/mapFunctions.js, line 10 -
Returns the main OpenLayers map of the LGB Masterportal map viewer.
Returns:
The main OL map instance of the map viewer
Example
const olMap = MpJsApi.getOlMap(); -
staticAddons.MpJsApi.getOlMap(){ol/Map}
addons/mpJsApi/src/mapFunctions.js, line 10 -
return the main OpenLayers map of the LGB Masterportal map viewer.
Returns:
The main OL map instance of the map viewer
Example
const olMap = MpJsApi.getOlMap(); -
async,staticAddons.MpJsApi.getQueryables(baseUrl, collectionId, opts){Promise.<Object>}
addons/mpJsApi/src/ogcApi.js, line 415 -
Lädt die Queryables einer OGC-API-Collection. Die Funktion ruft den Endpunkt `/collections/{collectionId}/queryables` auf und liefert die vom Dienst unterstützten abfragbaren Attribute zurück. Falls der Queryables-Endpunkt nicht verfügbar ist, versucht die Funktion als Fallback ein vereinfachtes Schema aus Beispiel-Features zu erzeugen. In diesem Fall wird `inferred: true` zurückgegeben. Die Ergebnisse werden intern zwischengespeichert (Cache), damit wiederholte Aufrufe schneller beantwortet werden können. Typische Use-Cases: - herausfinden, welche Attribute filterbar sind - Eingaben für `filters` oder `cql` vorbereiten - LLM-/Agentenlogik für dynamische Formulare oder Abfragen
Name Type Default Description baseUrlstring Basis-URL der OGC-API. collectionIdstring ID der Collection. optsObject {} optional Optionales Konfigurationsobjekt. Name Type Default Description forceRefreshboolean false optional Wenn `true`, wird der Cache ignoriert und die Queryables neu vom Server geladen. Returns:
Name Type Description ErgebnisobjektPromise.<Object> return.ok Gibtboolean an, ob der Request erfolgreich war. [return.queryables] Queryables-SchemaObject oder abgeleitetes Schema. [return.cached] `true`,boolean wenn die Daten aus dem Cache stammen. [return.inferred] `true`,boolean wenn die Queryables nicht direkt geladen werden konnten und aus Beispiel-Features abgeleitet wurden. [return.error] Fehlercode.string [return.detail] Zusatzinformationstring zum Fehler. --------------------------------------------------------- Konsolenbeispiele --------------------------------------------------------- Examples
// Beispiel 1: Queryables einer Collection laden const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetQueryables(BASE, "adresse"); console.log(res);// Beispiel 2: Queryables-Eigenschaften als Tabelle ausgeben const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetQueryables(BASE, "adresse"); if (!res.ok) { console.error(res); } else { const props = res.queryables?.properties || {}; console.table( Object.keys(props).map((key, i) => ({ i, name: key, title: props[key]?.title || key, type: props[key]?.type || null })) ); }// Beispiel 3: Prüfen, ob Queryables aus Cache stammen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const first = await MpJsApi.ogcGetQueryables(BASE, "adresse"); const second = await MpJsApi.ogcGetQueryables(BASE, "adresse"); console.log("Aus Cache:", second.cached === true);// Beispiel 4: Queryables mit forceRefresh neu laden const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetQueryables(BASE, "adresse", { forceRefresh: true }); console.log(res);// Beispiel 5: Queryables für Filterlogik verwenden const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetQueryables(BASE, "adresse"); if (res.ok) { const props = Object.keys(res.queryables?.properties || {}); console.log("Filterbare Felder:", props); }// Beispiel 6: Fallback erkennen, falls Queryables nur abgeleitet wurden const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetQueryables(BASE, "adresse"); if (res.ok && res.inferred) { console.log("Queryables wurden aus Beispieldaten abgeleitet."); } -
staticAddons.MpJsApi.getSearchMeta(){Object|Object}
addons/mpJsApi/src/search.js, line 422 -
Gibt Metadaten zur letzten Suche zurück. Die Funktion fragt den DetailedSearch-Kanal nach Suchmetadaten ab. Welche Informationen enthalten sind, hängt von der Implementierung des DetailedSearch-Moduls ab. Typische Use-Cases: - Metadaten zur Suche inspizieren - Paging-/Status-Informationen auswerten - ergänzende UI-/LLM-Logik
Examples
// Beispiel 1: Suchmetadaten abrufen MpJsApi.triggerSearch("Potsdam", { limit: 5 }); console.log(MpJsApi.getSearchMeta());// Beispiel 2: Suchmetadaten nach abgeschlossener Suche abrufen const poll = setInterval(() => { const s = MpJsApi.getSearchSnapshot(); if (s.ok && !s.loading) { clearInterval(poll); console.log(MpJsApi.getSearchMeta()); } }, 300); -
staticAddons.MpJsApi.getSearchResults(){Object|Object}
addons/mpJsApi/src/search.js, line 469 -
Gibt die letzten Suchergebnisse als Array zurück. Die Funktion fragt den DetailedSearch-Kanal nach den aktuellen Suchergebnissen ab und normalisiert die Rückgabe defensiv zu einem Array. Typische Use-Cases: - Trefferliste nach abgeschlossener Suche auslesen - LLM-/UI-Workflows mit Auswahl eines Suchtreffers - Treffer anschließend für Marker, Layer oder Detailansichten verwenden
Examples
// Beispiel 1: Suchergebnisse abrufen MpJsApi.triggerSearch("Potsdam", { limit: 5 }); console.log(MpJsApi.getSearchResults());// Beispiel 2: Erste drei Treffer ausgeben const poll = setInterval(() => { const s = MpJsApi.getSearchSnapshot(); if (s.ok && !s.loading) { clearInterval(poll); const hits = MpJsApi.getSearchResults().hits || []; hits.slice(0, 3).forEach((h, i) => { console.log(`${i}: ${h.title} (${h.type_label || h.type})`); }); } }, 300); -
staticAddons.MpJsApi.getSearchSnapshot(){Object|Object}
addons/mpJsApi/src/search.js, line 528 -
Gibt einen kombinierten Snapshot des aktuellen Suchzustands zurück. Die Funktion fasst in einem Aufruf zusammen: - Ladezustand (`loading`) - Suchmetadaten (`meta`) - Trefferliste (`hits`) Sie ist besonders gut für Polling-Workflows geeignet, in denen auf Suchergebnisse gewartet und anschließend Treffer verarbeitet werden. Typische Use-Cases: - LLM-/UI-Workflow: Suche starten und auf Ergebnisse warten - konsolidierter Suchstatus in einem Aufruf
Examples
// Beispiel 1: Such-Snapshot direkt nach Suchstart prüfen MpJsApi.triggerSearch("Potsdam", { limit: 5 }); console.log(MpJsApi.getSearchSnapshot());// Beispiel 2: Polling-Workflow mit Trefferverarbeitung MpJsApi.triggerSearch("Potsdam", { limit: 5 }); const poll = setInterval(() => { const s = MpJsApi.getSearchSnapshot(); if (s.ok && !s.loading) { clearInterval(poll); const hits = s.hits || []; if (hits.length === 0) { console.log("Keine Treffer."); return; } hits.slice(0, 3).forEach((h, i) => { console.log(`${i}: ${h.title} (${h.type_label || h.type})`); }); } }, 300); -
staticAddons.MpJsApi.getShareUrl(opts){Object|Object}
addons/mpJsApi/src/mapFunctions.js, line 127 -
Gibt eine teilbare URL zurück, die den aktuellen Kartenzustand repräsentiert. Intern wird das SaveSelection-Tool über den Radio-Channel abgefragt: `Radio.request("SaveSelection", "getMapState")`. Optional kann eine SimpleMap-Variante erzeugt werden, bei der der Parameter `style=simple` an die URL angehängt bzw. gesetzt wird. Typische Use-Cases: - aktuellen Kartenzustand teilen - reproduzierbare Kartenansicht erzeugen - Share-Link für Nutzer oder LLM-Workflows bereitstellen
Name Type Description optsObject optional Name Type Default Description simpleMapboolean false optional Wenn `true`, wird `style=simple` zur URL hinzugefügt. Examples
// Beispiel 1: Normale Share-URL erzeugen const res = MpJsApi.getShareUrl(); console.log(res);// Beispiel 2: Share-URL für SimpleMap erzeugen const res = MpJsApi.getShareUrl({ simpleMap: true }); console.log(res.url); -
staticAddons.MpJsApi.getStatusSnapshot(){Object|Object}
addons/mpJsApi/src/mapFunctions.js, line 361 -
Gibt einen kombinierten Snapshot des aktuellen Kartenstatus zurück. Der Snapshot enthält: - `view`: aktuelle Kartenansicht (Center, Zoom, Extent, Projektion) - `state`: Layerzustände und Extent aus `getMapViewerState()` Diese Funktion ist ideal für Support-, Debug- und LLM-Workflows, wenn der gesamte Kartenstatus in einem Objekt benötigt wird.
Examples
// Beispiel 1: Kompletten Snapshot anzeigen const res = MpJsApi.getStatusSnapshot(); console.log(res);// Beispiel 2: Aktive Layer aus dem Snapshot lesen const res = MpJsApi.getStatusSnapshot(); if (res.ok) { const active = res.snapshot.state.layers.filter(l => l.isSelected); console.log("Aktive Layer:", active.length); } -
staticAddons.MpJsApi.getThemedMapConf(){Array.<Object>}
addons/mpJsApi/src/themedMaps.js, line 181 -
Returns a themed map ("Themenkarten") configuration object for the current map of the LGB Masterportal map viewer.
The external layers in the map viewer are stored in the "layers" section of the returned themed map config.
The returned object is equivalent to the one, which is accepted byAddons.MpJsApi.applyThemedMapReturns:
Array of external layer configurations
Example
const tmConf = MpJsApi.getThemedMapConf(); -
staticAddons.MpJsApi.getViewState(){Object|Object}
addons/mpJsApi/src/mapFunctions.js, line 251 -
Gibt den aktuellen Karten-View-Zustand zurück. Enthalten sind: - Kartenmittelpunkt (`center`) - Zoomlevel (`zoom`) - aktueller Extent (`extent`) - Projektion (`projection`) Die Funktion ist nützlich, wenn nur der aktuelle View-Zustand erklärt oder weiterverarbeitet werden soll.
Examples
// Beispiel 1: View-Zustand komplett anzeigen const res = MpJsApi.getViewState(); console.log(res);// Beispiel 2: Nur Projektion und Zoom ausgeben const res = MpJsApi.getViewState(); if (res.ok) { console.log("Projektion:", res.view.projection); console.log("Zoom:", res.view.zoom); } -
staticAddons.MpJsApi.getZoomLevel(){Object|Object}
addons/mpJsApi/src/mapFunctions.js, line 406 -
Gibt das aktuelle Zoomlevel der Karte zurück.
Examples
// Beispiel 1: Aktuelles Zoomlevel anzeigen console.log(MpJsApi.getZoomLevel());// Beispiel 2: Nur Zoomwert ausgeben const res = MpJsApi.getZoomLevel(); if (res.ok) { console.log("Zoom:", res.zoom); } -
staticAddons.MpJsApi.highlightAndZoomGeoJSONFeaturesByAttribute(layerName, attributeKey, values, highlightStyle, padding)
addons/mpJsApi/src/geoJson.js, line 2195 -
Hebt mehrere Features in einem GeoJSON-Layer hervor und zoomt automatisch auf deren gemeinsamen Extent.
Name Type Default Description layerNamestring Name des GeoJSON-Layers. attributeKeystring Attributname (z. B. "gem_name"). valuesArray.<string> | Array.<number> Liste der Attributwerte, die hervorgehoben werden sollen. highlightStyleObject | ol.style.Style Stildefinition oder OL-Style. paddingArray.<number> [50, 50, 50, 50] optional Optionaler Rand für den Zoom (oben, rechts, unten, links). Example
MpJsApi.highlightAndZoomGeoJSONFeaturesByAttribute("Gemeinden", "gem_name", ["Potsdam", "Cottbus"], { type: "polygon", fillColor: "#FFA500", fillOpacity: 0.5, strokeColor: "#000", strokeWidth: 2 }); -
staticAddons.MpJsApi.highlightGeoJSONFeature(layerName, attributeKey, attributeValue, style)
addons/mpJsApi/src/geoJson.js, line 1944 -
Hebt ein bestimmtes Feature in einem GeoJSON-Layer visuell hervor.
Name Type Description layerNamestring Name des Layers. attributeKeystring Attributname, nach dem gesucht wird. attributeValuestring | number Der gewünschte Attributwert. styleObject | ol.style.Style Stilobjekt oder Konfiguration für getSingleFeatureStyle. Example
MpJsApi.highlightGeoJSONFeature("Gemeinden", "gem_name", "Potsdam", { type: "polygon", fillColor: "#FFD700", strokeColor: "#000", strokeWidth: 2 }); -
staticAddons.MpJsApi.highlightGeoJSONFeaturesByAttribute(layerName, attributeKey, values, highlightStyle)
addons/mpJsApi/src/geoJson.js, line 2147 -
Hebt mehrere Features in einem GeoJSON-Layer visuell hervor, deren Attributwert mit einem oder mehreren Zielwerten übereinstimmt. Alle passenden Features erhalten einen individuellen Stil, der entweder als OpenLayers-Style-Objekt oder als Konfigurationsobjekt übergeben wird. Zuvor gesetzte Hervorhebungen werden automatisch entfernt.
Name Type Description layerNamestring Name des GeoJSON-Layers (z. B. "Gemeinden"). attributeKeystring Attributname, nach dem gefiltert wird (z. B. "gem_name"). valuesArray.<string> | Array.<number> Liste von Werten, die hervorgehoben werden sollen. highlightStyleObject | ol.style.Style Stil für die Hervorhebung. Entweder ein echtes OL-Style-Objekt oder ein Konfigurationsobjekt gemäß `getSingleFeatureStyle`. Examples
// Einfaches Beispiel: Zwei Gemeinden hervorheben MpJsApi.highlightGeoJSONFeaturesByAttribute("Gemeinden", "gem_name", ["Potsdam", "Berlin"], { type: "polygon", fillColor: "#FFA500", fillOpacity: 0.5, strokeColor: "#000", strokeWidth: 2 });// Komplexer Stil mit Label MpJsApi.highlightGeoJSONFeaturesByAttribute( "Gemeinden", "gem_name", ["Potsdam", "Nennhausen", "Cottbus"], { type: "polygon", fillColor: "#FFA500", fillOpacity: 0.4, strokeColor: "#000000", strokeWidth: 2, showLabel: true, labelField: "gem_name", font: "bold 14px Arial", textColor: "#000000", textStrokeColor: "#ffffff", textStrokeWidth: 2, labelOffsetY: -12 } );// Entfernen aller hervorgehobenen Features MpJsApi.clearGeoJSONHighlights("Gemeinden"); -
staticAddons.MpJsApi.highlightMarker(id, highlight, color, size)
addons/mpJsApi/src/marker.js, line 262 -
Highlights a marker for the given id on the map.
Name Type Description idnumber The id of the marker to highlight highlightboolean If true, highlight the Marker for the given id, unhighlight if false colorstring Optional color used for highlighting as hexcode sizenumber Optional marker size used for highlighting in px. Default: 40px. Example
MpJsApi.highlightMarker(123, true, "#ffff00", 60) -
staticAddons.MpJsApi.isSearchLoading(){Object|Object}
addons/mpJsApi/src/search.js, line 380 -
Gibt zurück, ob die Detailsuche aktuell noch lädt. Die Funktion fragt den DetailedSearch-Kanal nach dem Ladezustand ab. Sie eignet sich besonders für Polling-Workflows, in denen auf das Ende einer Suche gewartet wird.
Examples
// Beispiel 1: Ladezustand nach dem Start einer Suche prüfen MpJsApi.triggerSearch("Potsdam", { limit: 5 }); console.log(MpJsApi.isSearchLoading());// Beispiel 2: Polling auf Suchende const poll = setInterval(() => { const s = MpJsApi.isSearchLoading(); console.log(s); if (s.ok && !s.loading) { clearInterval(poll); } }, 300); -
async,staticAddons.MpJsApi.listCollections(baseUrl, opts){Promise.<Object>}
addons/mpJsApi/src/ogcApi.js, line 252 -
Lädt die verfügbaren Collections einer OGC-API. Die Funktion ruft den Endpunkt `/collections` der OGC-API auf und liefert eine normalisierte Liste der verfügbaren Collections zurück. Pro Collection werden unter anderem folgende Informationen zurückgegeben: - `id` - `title` - `description` - `extent` - `links` - `crs` Die Ergebnisse werden intern zwischengespeichert (Cache), damit wiederholte Aufrufe derselben Basis-URL schneller beantwortet werden können. Typische Use-Cases: - Collections einer unbekannten OGC-API erkunden - passende Collection für weitere Requests auswählen - LLM-/Agentenlogik vorbereiten
Name Type Default Description baseUrlstring Basis-URL der OGC-API. optsObject {} optional Optionales Konfigurationsobjekt. Name Type Default Description forceRefreshboolean false optional Wenn `true`, wird der Cache ignoriert und die Collection-Liste neu vom Server geladen. Returns:
Name Type Description ErgebnisobjektPromise.<Object> return.ok Gibtboolean an, ob der Request erfolgreich war. [return.baseUrl] Normalisiertestring Basis-URL. [return.collections] ListeArray der verfügbaren Collections. [return.cached] `true`,boolean wenn die Daten aus dem Cache stammen. [return.error] Fehlercode.string [return.detail] Zusatzinformationstring zum Fehler. --------------------------------------------------------- Konsolenbeispiele --------------------------------------------------------- Examples
// Beispiel 1: Collections laden const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcListCollections(BASE); console.log(res);// Beispiel 2: Collections als Tabelle anzeigen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcListCollections(BASE); if (!res.ok) { console.error(res); } else { console.table( res.collections.map((c, i) => ({ i, id: c.id, title: c.title })) ); }// Beispiel 3: Prüfen, ob Collections aus dem Cache stammen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const first = await MpJsApi.ogcListCollections(BASE); const second = await MpJsApi.ogcListCollections(BASE); console.log("Zweiter Aufruf aus Cache:", second.cached === true);// Beispiel 4: Collections mit forceRefresh neu laden const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcListCollections(BASE, { forceRefresh: true }); console.log(res);// Beispiel 5: Nach bestimmter Collection suchen const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcListCollections(BASE); if (res.ok) { const adresse = res.collections.find(c => c.id === "adresse"); console.log("Adresse-Collection:", adresse); } -
staticAddons.MpJsApi.ogcAddFeaturesAsLayer(baseUrl, collectionId, opts, layerCfg){Promise.<Object>}
addons/mpJsApi/src/ogcApi.js, line 2961 -
Alias für
Addons.MpJsApi.addFeaturesAsLayer. Lädt Features aus einer OGC-API und fügt sie direkt als GeoJSON-Layer zur Karte hinzu.Name Type Default Description baseUrlstring Basis-URL der OGC-API. collectionIdstring ID der Collection. optsObject {} optional Optionen für den Feature-Request. layerCfgObject {} optional Konfiguration des darzustellenden Layers. Returns:
vonAddons.MpJsApi.addFeaturesAsLayer.
-
staticAddons.MpJsApi.ogcGetConformance(baseUrl){Promise.<Object>}
addons/mpJsApi/src/ogcApi.js, line 2980 -
Alias für
Addons.MpJsApi.getConformance. Lädt die unterstützten Conformance-Klassen einer OGC-API.Name Type Description baseUrlstring Basis-URL der OGC-API. Returns:
vonAddons.MpJsApi.getConformance.
-
staticAddons.MpJsApi.ogcGetFeatureById(baseUrl, collectionId, featureId, opts){Promise.<Object>}
addons/mpJsApi/src/ogcApi.js, line 3008 -
Alias für
Addons.MpJsApi.getFeatureById. Lädt ein einzelnes Feature gezielt über seine ID.Name Type Default Description baseUrlstring Basis-URL der OGC-API. collectionIdstring ID der Collection. featureIdstring | number ID des gewünschten Features. optsObject {} optional Optionales Konfigurationsobjekt. Returns:
vonAddons.MpJsApi.getFeatureById.
-
staticAddons.MpJsApi.ogcGetFeatureByIndex(features, index){Object}
addons/mpJsApi/src/ogcApi.js, line 3056 -
Alias für
Addons.MpJsApi.getFeaturesByIndexzur Auswahl genau eines Features. Erwartet eine vorhandene Featureliste und einen einzelnen Index. Intern wirdAddons.MpJsApi.getFeaturesByIndexmit einem Einzelindex verwendet.Name Type Description featuresArray Featureliste, z. B. aus `ogcGetFeatures(...)`. indexnumber Einzelner Index des gewünschten Features. Returns:
auf Basis vonAddons.MpJsApi.getFeaturesByIndex.
-
staticAddons.MpJsApi.ogcGetFeatures(baseUrl, collectionId, opts){Promise.<Object>}
addons/mpJsApi/src/ogcApi.js, line 2933 -
Alias für
Addons.MpJsApi.getFeatures. Lädt Features aus einer OGC-API-Collection.Name Type Default Description baseUrlstring Basis-URL der OGC-API. collectionIdstring ID der Collection. optsObject {} optional Optionales Konfigurationsobjekt. Returns:
vonAddons.MpJsApi.getFeatures.
-
staticAddons.MpJsApi.ogcGetFeaturesByIndex(features, indices){Object}
addons/mpJsApi/src/ogcApi.js, line 3078 -
Alias für
Addons.MpJsApi.getFeaturesByIndex. Wählt ein oder mehrere Features aus einer vorhandenen Featureliste per Index aus.Name Type Description featuresArray Featureliste, z. B. aus `ogcGetFeatures(...)`. indicesnumber | Array.<number> Einzelner Index oder Array mit Indizes. Returns:
vonAddons.MpJsApi.getFeaturesByIndex.
-
staticAddons.MpJsApi.ogcGetFeaturesInMapExtent(baseUrl, collectionId, opts){Promise.<Object>}
addons/mpJsApi/src/ogcApi.js, line 3033 -
Alias für
Addons.MpJsApi.getFeaturesInMapExtent. Lädt Features einer Collection für den aktuellen Kartenausschnitt.Name Type Default Description baseUrlstring Basis-URL der OGC-API. collectionIdstring ID der Collection. optsObject {} optional Optionales Konfigurationsobjekt. Returns:
vonAddons.MpJsApi.getFeaturesInMapExtent.
-
staticAddons.MpJsApi.ogcGetQueryables(baseUrl, collectionId, opts){Promise.<Object>}
addons/mpJsApi/src/ogcApi.js, line 2908 -
Alias für
Addons.MpJsApi.getQueryables. Lädt die Queryables einer OGC-API-Collection.Name Type Default Description baseUrlstring Basis-URL der OGC-API. collectionIdstring ID der Collection. optsObject {} optional Optionales Konfigurationsobjekt. Returns:
vonAddons.MpJsApi.getQueryables.
-
staticAddons.MpJsApi.ogcListCollections(baseUrl, opts){Promise.<Object>}
addons/mpJsApi/src/ogcApi.js, line 2883 -
Alias für
Addons.MpJsApi.listCollections. Lädt die verfügbaren Collections einer OGC-API.Name Type Default Description baseUrlstring Basis-URL der OGC-API. optsObject {} optional Optionales Konfigurationsobjekt. Returns:
vonAddons.MpJsApi.listCollections.
-
staticAddons.MpJsApi.openDetailedSearch(searchText, opts){void}
addons/mpJsApi/src/search.js, line 259 -
Öffnet die Detailsuche und startet optional direkt eine Suche. Wenn kein Suchtext angegeben wird, wird standardmäßig ein Leerzeichen übergeben, damit die Detailsuche geöffnet werden kann. Typische Use-Cases: - Detailsuche gezielt öffnen - LLM-/UI-Workflow: zuerst Suchmaske öffnen, dann Ergebnisse beobachten
Name Type Default Description searchTextstring " " optional Optionaler Suchtext. optsObject {} optional Weitere Suchoptionen. Examples
// Beispiel 1: Detailsuche ohne konkreten Suchtext öffnen MpJsApi.openDetailedSearch();// Beispiel 2: Detailsuche direkt mit Suchtext öffnen MpJsApi.openDetailedSearch("Potsdam", { limit: 5 }); -
staticAddons.MpJsApi.rankFeaturesByDistance(point, features, opts){Object}
addons/mpJsApi/src/ogcApi.js, line 2782 -
Sortiert Features nach Entfernung zu einem Referenzpunkt. Die Funktion berechnet die Distanz zwischen einem Punkt `[lon, lat]` und einer Liste von Features und gibt eine nach Entfernung sortierte Liste zurück. Intern wird `MpJsApi.getFeatureCoordinates(feature)` verwendet, um eine repräsentative Koordinate pro Feature zu bestimmen. Unterstützte Geometrietypen: - Point - LineString - Polygon - MultiPolygon Typische Anwendungsfälle: - nächstgelegene Adressen finden - Features nach Distanz sortieren - „Top N“ nächste Objekte bestimmen - Ranking von Treffern Die Entfernung wird mit der **Haversine-Formel** berechnet und in **Metern** zurückgegeben.
Name Type Default Description pointArray.<number> Referenzpunkt `[lon, lat]` in EPSG:4326. featuresArray Array mit GeoJSON- oder OpenLayers-Features. optsObject {} optional Name Type Default Description limitnumber null optional Maximale Anzahl zurückgegebener Features. maxDistancenumber null optional Maximale Entfernung in Metern. Returns:
Name Type Description Object return.ok Gibtboolean an, ob die Berechnung erfolgreich war. return.items ListeArray der Features mit Distanzinformationen, sortiert nach Entfernung. return.count Anzahlnumber der zurückgegebenen Treffer. --------------------------------------------------------- Konsolenbeispiele --------------------------------------------------------- Examples
Beispiel 1 – Features nach Entfernung sortieren const BASE = "https://ogc-api.geobasis-bb.de/basemap-bebb"; const res = await MpJsApi.ogcGetFeatures(BASE, "adresse", { limit: 50, bbox: "map" }); const point = [12.41284, 52.40352]; const ranked = MpJsApi.rankFeaturesByDistance(point, res.features); console.table( ranked.items.map(x => ({ id: x.id, distanceMeters: Math.round(x.distanceMeters) })) );Beispiel 2 – Die 5 nächstgelegenen Adressen const ranked = MpJsApi.rankFeaturesByDistance(point, res.features, { limit: 5 }); console.log(ranked.items);Beispiel 3 – Nur Features im Umkreis von 500 m const ranked = MpJsApi.rankFeaturesByDistance(point, res.features, { maxDistance: 500 }); console.log(ranked);Beispiel 4 – Nächstgelegene Adresse als HTML Marker darstellen const ranked = MpJsApi.rankFeaturesByDistance(point, res.features, { limit: 1 }); const first = ranked.items[0]; if (first) { const p = first.feature.properties || {}; MpJsApi.addHTMLMarker(first.coordinates, { id: "nearest-address", color: "blue", centerMap: false, popup: { content: `${p.strasse || ""} ${p.hausnummer || ""}`, className: "api-html-popup" } }); }
${p.ort || ""}
Entfernung: ${Math.round(first.distanceMeters)} m -
staticAddons.MpJsApi.removeExternalLayers(){void}
addons/mpJsApi/src/themedMaps.js, line 157 -
Removes all external layers of the LGB Masterportal map viewer.
Example
MpJsApi.removeExternalLayers(); -
staticAddons.MpJsApi.removeMarker(id)
addons/mpJsApi/src/marker.js, line 315 -
Remove the marker for the given id.
Name Type Description idnumber The id of the marker to remove -
staticAddons.MpJsApi.repeatLastSearch(){Object|Object}
addons/mpJsApi/src/search.js, line 292 -
Wiederholt die zuletzt ausgelöste Suche. Die Funktion verwendet den internen Modul-Cache `_lastSearch`. Falls keine letzte Suche vorhanden ist, wird `ok:false` zurückgegeben. Typische Use-Cases: - letzte Suche erneut ausführen - UI-/LLM-Workflow nach Kartenänderungen wiederholen
Examples
// Beispiel 1: Letzte Suche wiederholen MpJsApi.freeTextSearch("Potsdam", { limit: 5 }); const res = MpJsApi.repeatLastSearch(); console.log(res);// Beispiel 2: Fehlerfall ohne vorherige Suche MpJsApi.clearLastSearch(); const res = MpJsApi.repeatLastSearch(); console.log(res); // { ok:false, error:"NO_LAST_SEARCH" } -
staticAddons.MpJsApi.resetGeoJSONFilter(layerName)
addons/mpJsApi/src/geoJson.js, line 2080 -
Hebt alle zuvor gesetzten Filter auf einem GeoJSON-Layer wieder auf. Alle Features werden wieder mit dem Standardstil angezeigt.
Name Type Description layerNamestring Name des Layers. Example
MpJsApi.resetGeoJSONFilter("Gemeinden"); -
staticAddons.MpJsApi.searchByCategory(searchText, searchCategory, opts){void}
addons/mpJsApi/src/search.js, line 178 -
Startet eine Suche innerhalb einer bestimmten Suchkategorie. Intern wird die gewünschte `searchCategory` gesetzt und die Suche zusätzlich als letzte Suche gespeichert. Typische Use-Cases: - Suche gezielt auf eine Fachkategorie einschränken - LLM-/UI-Workflows mit vorgewählter Suchdomäne
Name Type Default Description searchTextstring Freitext, nach dem gesucht werden soll. searchCategorystring Name der Suchkategorie. optsObject {} optional Weitere Suchoptionen. Examples
// Beispiel 1: Suche nur in einer Kategorie MpJsApi.searchByCategory("Potsdam", "strassendaten");// Beispiel 2: Kategorie-Suche mit Limit und Sortierung MpJsApi.searchByCategory("Brandenburg", "verwaltungsgrenzen", { limit: 8, sortBy: "relevance" }); -
staticAddons.MpJsApi.searchInCurrentExtent(searchText, opts){void}
addons/mpJsApi/src/search.js, line 142 -
Startet eine Suche, die auf den aktuellen Kartenausschnitt beschränkt ist. Intern wird `restrictToMapExtent: true` gesetzt und die Suche zusätzlich als letzte Suche gespeichert. Typische Use-Cases: - nur sichtbare Treffer im aktuellen Kartenausschnitt suchen - Suchergebnisse auf den gerade sichtbaren Kartenbereich begrenzen
Name Type Default Description searchTextstring Freitext, nach dem gesucht werden soll. optsObject {} optional Weitere Suchoptionen. Examples
// Beispiel 1: Suche nur im sichtbaren Kartenausschnitt MpJsApi.searchInCurrentExtent("Potsdam");// Beispiel 2: Suche im Kartenausschnitt mit Limit MpJsApi.searchInCurrentExtent("Bahnhof", { limit: 10 }); -
staticAddons.MpJsApi.searchSorted(searchText, sortOpts, opts){void}
addons/mpJsApi/src/search.js, line 221 -
Startet eine Suche mit expliziter Sortierung. Die Funktion kombiniert normalen Suchtext mit Sortieroptionen wie `sortBy` und `sortOrder` und speichert die Suche zusätzlich als letzte Suche. Typische Use-Cases: - Suchergebnisse alphabetisch sortieren - Suchergebnisse nach Relevanz oder Quelle ordnen
Name Type Default Description searchTextstring Freitext, nach dem gesucht werden soll. sortOptsObject {} optional Sortieroptionen. Name Type Description sortBystring optional Sortierkriterium, z. B. `"relevance"`, `"alphabetical"` oder `"source"`. sortOrderstring optional Sortierreihenfolge `"asc"` oder `"desc"`. optsObject {} optional Weitere Suchoptionen. Examples
// Beispiel 1: Suche alphabetisch sortieren MpJsApi.searchSorted("Potsdam", { sortBy: "alphabetical", sortOrder: "asc" });// Beispiel 2: Suche nach Relevanz absteigend MpJsApi.searchSorted("Berlin", { sortBy: "relevance", sortOrder: "desc" }, { limit: 10 }); -
staticAddons.MpJsApi.selectFeatures(features, selector, opts){Object}
addons/mpJsApi/src/ogcApi.js, line 1602 -
Hinweise: - Die Funktion arbeitet auf einer bereits vorhandenen Featureliste und lädt keine Daten nach. - Sie ist damit ideal als Zwischenschritt zwischen `ogcGetFeatures()` / `findAddress()` und Visualisierung oder Detailansicht. - Für detailgenaues Nachladen eines einzelnen Objekts kann anschließend `getFeatureById()` verwendet werden. - Wenn `where` und `sortBy` verwendet werden, beziehen sich `indices` auf die gefilterte/sortierte Arbeitsliste. Die Eigenschaft `originalIndices` referenziert dagegen die ursprüngliche Position im Eingangsarray.
Name Type Default Description featuresArray Array mit Features, z. B. aus `ogcGetFeatures()` oder `ogcGetFeaturesInMapExtent()`. selectornumber | Array | string | Object Auswahlregel für die Features. optsObject {} optional Optionales Konfigurationsobjekt. Name Type Default Description exactboolean false optional Verwendet bei einfachen `where`-Vergleichen exakte String-Vergleiche statt `includes`. caseInsensitiveboolean true optional Vergleicht Strings standardmäßig ohne Groß-/Kleinschreibung. dedupeboolean true optional Entfernt doppelte Treffer. failOnEmptyboolean false optional Gibt `ok:false` zurück, wenn keine Features ausgewählt wurden. asFeatureCollectionboolean false optional Liefert zusätzlich `fc` als GeoJSON-FeatureCollection zurück. requireCoordinatesboolean false optional Lässt nur Features mit nutzbaren Koordinaten zu. Returns:
Name Type Description ErgebnisobjektObject mit folgenden Eigenschaften: returns.okboolean - `true`, wenn die Auswahl erfolgreich verarbeitet wurde. [returns.mode]string - Modus der Auswahl (`"selector"` oder `"object"`). [returns.selector]* - Der übergebene Selektor. [returns.matchedCount]number - Anzahl der Features nach Vorfilterung (`where`, `geometryType`, `requireCoordinates`, Sortierung). returns.countnumber - Anzahl der tatsächlich ausgewählten Features. [returns.requestedCount]number - Anzahl der angefragten Indizes oder IDs. [returns.invalidIndices]Array - Ungültige Indizes, die ignoriert wurden. [returns.notFoundIds]Array - IDs, die nicht gefunden wurden. returns.indicesArray.<number> - Indizes innerhalb der Arbeitsliste nach Filter/Sortierung. returns.originalIndicesArray.<number> - Ursprüngliche Indizes im Eingangsarray `features`. returns.idsArray - IDs der ausgewählten Features. returns.featuresArray - Die ausgewählten Features. returns.itemsArray - Erweiterte Trefferliste mit `index`, `originalIndex`, `id` und `feature`. [returns.fc]Object - GeoJSON-FeatureCollection, wenn `opts.asFeatureCollection === true`. Examples
// Beispiel 1: Erstes Feature auswählen const sel = MpJsApi.selectFeatures(res.features, "first"); console.log(sel);// Beispiel 2: Mehrere Features per Index auswählen const sel = MpJsApi.selectFeatures(res.features, [3, 6, 8]); console.log(sel);// Beispiel 3: Bereich auswählen const sel = MpJsApi.selectFeatures(res.features, "2-5"); console.log(sel);// Beispiel 4: Erste fünf auswählen const sel = MpJsApi.selectFeatures(res.features, "top 5"); console.log(sel);// Beispiel 5: Features per ID auswählen const sel = MpJsApi.selectFeatures(res.features, { ids: [3, 6, 8] }); console.log(sel);// Beispiel 6: Nach Ort filtern und davon die ersten 3 auswählen const sel = MpJsApi.selectFeatures(res.features, { where: { ort: "Brandenburg" }, pick: "first 3" }); console.log(sel);// Beispiel 7: Erweiterter Filter mit Operatoren const sel = MpJsApi.selectFeatures(res.features, { where: { ort: {op: "exact", value: "Drebkau"}, strasse: {op: "startsWith", value: "Rotdorn"} }, pick: "first" }); console.log(sel);// Beispiel 8: Nach Straße sortieren und die ersten 5 auswählen const sel = MpJsApi.selectFeatures(res.features, { sortBy: "strasse", order: "asc", pick: "top 5" }); console.log(sel);// Beispiel 9: Nur Punktgeometrien mit Koordinaten auswählen const sel = MpJsApi.selectFeatures(res.features, { geometryType: "Point", pick: "all" }, { requireCoordinates: true }); console.log(sel);// Beispiel 10: Ergebnis direkt als GeoJSON-Layer anzeigen const sel = MpJsApi.selectFeatures(res.features, { where: { ort: "Brandenburg" }, pick: "first 3" }, { asFeatureCollection: true, failOnEmpty: true }); if (sel.ok) { MpJsApi.addGeoJSONLayer(sel.fc, { layerName: "Selektierte Features" }); }// Beispiel 11: Erstes selektiertes Feature direkt als Marker setzen const sel = MpJsApi.selectFeatures(res.features, "first", { requireCoordinates: true }); if (sel.ok && sel.features.length) { const c = sel.features[0].geometry?.coordinates; if (Array.isArray(c) && c.length >= 2) { MpJsApi.addMarker([c[0], c[1]], { id: "selected-feature", color: "blue" }); } } -
staticAddons.MpJsApi.setAddMarkerOnClick(active, callback)
addons/mpJsApi/src/marker.js, line 360 -
Toggles the add marker on map click mode
On map click, the callback function will be called with an array holding the clicked coordinates (EPSG:4326). If the the first argument (active) is false, the mode will be de-activated. The function ensures that the gfi tool is deactivated to prevent gfi click events.Name Type Description activeBoolean Flag to activate or deactive the add marker mode callbackfunction Callback function to be triggered on singleclick Example
const callback = (coordinate) => {console.log(coordinate)}; MpJsApi.setAddMarkerOnClick(true, callback); -
staticAddons.MpJsApi.setLayerVisible(layerName, visible)
addons/mpJsApi/src/geoJson.js, line 2257 -
Setzt die Sichtbarkeit eines Layers anhand seines Namens.
Name Type Description layerNamestring Der Name des Layers (z. B. "Gemeinden"). visibleboolean Sichtbarkeit setzen: true = anzeigen, false = ausblenden. Examples
// Layer ausblenden MpJsApi.setLayerVisible("Gemeinden", false);// Layer wieder einblenden MpJsApi.setLayerVisible("Gemeinden", true); -
staticAddons.MpJsApi.setScale(scale){Object|Object}
addons/mpJsApi/src/mapFunctions.js, line 529 -
Setzt den Kartenmaßstab direkt. Die Funktion triggert `Radio.trigger("MapView", "setScale", scale)`.
Name Type Description scalenumber | string Zielmaßstab. Examples
// Beispiel 1: Maßstab setzen MpJsApi.setScale(25000);// Beispiel 2: Ergebnis prüfen console.log(MpJsApi.setScale(10000)); -
staticAddons.MpJsApi.setZoomLevel(zoomLevel){Object|Object}
addons/mpJsApi/src/mapFunctions.js, line 439 -
Setzt das Zoomlevel der Karte direkt. Die Funktion verwendet direkt das OpenLayers-View-Objekt.
Name Type Description zoomLevelnumber Neues Zoomlevel. Examples
// Beispiel 1: Auf Zoomlevel 8 setzen MpJsApi.setZoomLevel(8);// Beispiel 2: Zoomlevel dynamisch setzen const z = 10; const res = MpJsApi.setZoomLevel(z); console.log(res); -
staticAddons.MpJsApi.showLayerTemporarily(layerName, ms){Object}
addons/mpJsApi/src/geoJson.js, line 2446 -
Blendet einen Layer für eine bestimmte Zeit ein und danach wieder aus. Die Funktion setzt die Sichtbarkeit des angegebenen Layers zunächst auf `true` und blendet ihn nach Ablauf der angegebenen Zeit automatisch wieder aus. Typische Use-Cases: - Layer kurz sichtbar machen, um Nutzer auf ihn aufmerksam zu machen - Ergebnislayer temporär hervorheben - Test- und Demo-Szenarien
Name Type Default Description layerNamestring Name des Layers. msnumber 5000 optional Sichtbarkeitsdauer in Millisekunden. Returns:
Name Type Description ErgebnisobjektObject return.okboolean - Gibt an, ob die Aktion erfolgreich ausgelöst wurde. [return.error]string - Fehlercode. Examples
// Beispiel 1: Layer für 5 Sekunden anzeigen const res = MpJsApi.showLayerTemporarily("Gemeinden"); console.log(res);// Beispiel 2: Layer für 2 Sekunden anzeigen const res = MpJsApi.showLayerTemporarily("Gemeinden", 2000); console.log(res); -
staticAddons.MpJsApi.toggleMarkerTooltip(id, visible)
addons/mpJsApi/src/marker.js, line 295 -
Toggle the visibility of a marker's tooltip for the given id.
Name Type Description idnumber The id of the marker whose tooltip should be toggled visibleboolean If true, show the tooltip for the given marker id, hide if false Example
MpJsApi.toggleMarkerTooltip(123, true) -
staticAddons.MpJsApi.triggerSearch(searchText, opts){void}
addons/mpJsApi/src/search.js, line 55 -
Triggers the search functionality within the LGB Masterportal map viewer. The function can be executed with a search string and an optional options object as function arguments. Following options can be set:
- searchCategory (String): The name of the search category to pre-filter the search results by - restrictToMapExtent (Boolean): True, if search should be restricted to the current map extent - openDetailSearch (Boolean): True, if the detailed search should be opened - sortBy ("relevance" | "alphabetical" | "source"): By which property results should be sorted - sortOrder ("asc" | "desc"): Sort order of search results - limit (Number): Number of search results per page - filters (Array[Array]): Filters (connected with AND) to apply to search in the form: [[filterProperty: [filterValue1, filterValue2]]] e.g.: [ ["keywords": ["keyword1"]], ["keywords": ["keyword2", "keyword3"]], // connected with OR ["types": ["netzknoten"]] ]Name Type Description searchTextString Text to search for optsObject optional Search options Example
const searchOpts = { searchCategory: "strassendaten", restrictToMapExtent: true, openDetailSearch: true, sortBy: "relevance", sortOrder: "desc", limit: 8, filters: [ ["keywords", ["keyword1"]], ["keywords", ["keyword2", "keyword3"]], ["types", ["netzknoten"]] ] }; MpJsApi.triggerSearch("Berlin", searchOpts); -
staticAddons.MpJsApi.updateMarker(id, newCoord){Array.<number>|null}
addons/mpJsApi/src/marker.js, line 893 -
Updates the position of an existing marker with the given id and returns the new coordinate in EPSG:4326.
Name Type Description idnumber | string The unique marker id newCoordArray.<number> The new coordinate to set (in EPSG:4326) Returns:
The new coordinate in EPSG:4326, or null if marker not found
Example
// Beispiel: Marker per Klick setzen oder verschieben let markerId = 9999; // Eindeutige Marker-ID const handleMarkerClick = (coord) => { const layer = MpJsApi.getMarkerLayer(); const existingFeature = layer.getSource().getFeatures().find(f => f.get("id") === markerId); let updatedCoord; if (existingFeature) { // Marker verschieben updatedCoord = MpJsApi.updateMarker(markerId, coord); console.log("Marker verschoben:", updatedCoord); } else { // Marker neu setzen MpJsApi.addMarker(coord, { id: markerId, color: "blue", address: `Marker bei ${coord[1].toFixed(5)}°, ${coord[0].toFixed(5)}°`, callback: ({ coordinates }) => { console.log("Marker hinzugefügt:", coordinates); } }); updatedCoord = coord; } }; // Klick-Modus aktivieren: MpJsApi.setAddMarkerOnClick(true, handleMarkerClick); // Klick-Modus später deaktivieren: MpJsApi.setAddMarkerOnClick(false); -
async,staticAddons.MpJsApi.updateMarkerToNearestAddress(lat, lon){Promise.<(Array.<number>|null)>}
addons/mpJsApi/src/marker.js, line 975 -
ToDo: url konfigurierbar Ermittelt die nächstgelegene Adresse zu den gegebenen Koordinaten (Reverse-Geocoding) über den Geobasis-Brandenburg-Dienst und verschiebt den Marker auf die gefundene Position.
Name Type Description latnumber Die geografische Breite (Latitude) in WGS84 (EPSG:4326). lonnumber Die geografische Länge (Longitude) in WGS84 (EPSG:4326). Returns:
Promise, das die neuen Koordinaten `[lon, lat]` zurückgibt, wenn eine Adresse gefunden wurde, andernfalls `null`.
Example
const newCoord = await MpJsApi.updateMarkerToNearestAddress(52.391, 13.065); console.log("Neuer Marker auf:", newCoord); -
staticAddons.MpJsApi.validateGeoJSON(geojson){Object}
addons/mpJsApi/src/geoJson.js, line 2396 -
Prüft, ob ein GeoJSON eine gültige FeatureCollection ist und von OpenLayers gelesen werden kann. Die Funktion validiert: - ob die Eingabe ein GeoJSON-Objekt oder JSON-String ist - ob `type === "FeatureCollection"` gesetzt ist - ob ein `features`-Array vorhanden ist - ob OpenLayers die Features erfolgreich parsen kann Typische Use-Cases: - GeoJSON vor dem Hinzufügen zur Karte prüfen - Benutzereingaben oder externe Daten validieren - Fehlerdiagnose bei defekten GeoJSON-Daten
Name Type Description geojsonstring | Object GeoJSON als Objekt oder JSON-String. Returns:
Name Type Description ErgebnisobjektObject return.okboolean - Gibt an, ob das GeoJSON gültig ist. [return.featureCount]number - Anzahl erfolgreich gelesener Features. [return.error]string - Fehlercode. [return.detail]string - Zusatzinformation zum Fehler. Examples
// Beispiel 1: GeoJSON-Objekt prüfen const res = MpJsApi.validateGeoJSON({ type: "FeatureCollection", features: [] }); console.log(res);// Beispiel 2: GeoJSON-String prüfen const geojsonStr = JSON.stringify({ type: "FeatureCollection", features: [ { type: "Feature", geometry: { type: "Point", coordinates: [13, 52] }, properties: { name: "Test" } } ] }); const res = MpJsApi.validateGeoJSON(geojsonStr); console.log(res); -
staticAddons.MpJsApi.zoomIn(){Object|Object}
addons/mpJsApi/src/mapFunctions.js, line 471 -
Zoomt die Karte um eine Stufe hinein.
Examples
// Beispiel 1: Eine Stufe hineinzoomen MpJsApi.zoomIn();// Beispiel 2: Ergebnis prüfen console.log(MpJsApi.zoomIn()); -
staticAddons.MpJsApi.zoomOnMarkerLayer(percentage)
addons/mpJsApi/src/marker.js, line 702 -
Zoom to Geometry/Layer - The BoundingBox is adjusted based on the provided coordinates to ensure all coordinates are visible. If a percentage is provided, the extent is expanded by that percentage. If no percentage is provided, the extent remains unchanged.
Name Type Description percentagenumber optional Optional. The percentage by which to expand the extent (e.g., 0.15 for 15%). Examples
MpJsApi.zoomOnMarkerLayer(); // Zoom without expandingMpJsApi.zoomOnMarkerLayer(0.15); // Zoom and expand extent by 15% -
staticAddons.MpJsApi.zoomOut(){Object|Object}
addons/mpJsApi/src/mapFunctions.js, line 498 -
Zoomt die Karte um eine Stufe heraus.
Examples
// Beispiel 1: Eine Stufe herauszoomen MpJsApi.zoomOut();// Beispiel 2: Ergebnis prüfen console.log(MpJsApi.zoomOut()); -
staticAddons.MpJsApi.zoomToCenter(center, zoomLevel){Object|Object}
addons/mpJsApi/src/mapFunctions.js, line 559 -
Zentriert die Karte auf eine Koordinate und setzt optional ein Zoomlevel.
Name Type Description centerArray.<number> Zielkoordinate. zoomLevelnumber optional Optionales Zoomlevel. Examples
// Beispiel 1: Nur auf Center setzen MpJsApi.zoomToCenter([368450, 5804230]);// Beispiel 2: Center setzen und auf Zoomlevel 9 gehen MpJsApi.zoomToCenter([368450, 5804230], 9); -
staticAddons.MpJsApi.zoomToExtent(extent){Object|Object}
addons/mpJsApi/src/mapFunctions.js, line 597 -
Zoomt direkt auf einen gegebenen Extent.
Name Type Description extentArray.<number> Extent im Format `[minX, minY, maxX, maxY]`. Examples
// Beispiel 1: Auf festen Extent zoomen MpJsApi.zoomToExtent([207593, 5590239, 528473, 6023259]);// Beispiel 2: Ergebnis prüfen console.log(MpJsApi.zoomToExtent([353813, 5800182, 381488, 5813993])); -
staticAddons.MpJsApi.zoomToGeoJSONFeature(layerName, attributeKey, attributeValue, padding, highlightStyle)
addons/mpJsApi/src/geoJson.js, line 1874 -
Zoomt auf ein einzelnes Feature innerhalb eines GeoJSON-Layers anhand eines Attributwerts. Diese Funktion sucht im angegebenen Layer nach einem Feature, das dem angegebenen Attributwert entspricht, zoomt die Karte auf dessen Geometrie und kann das Feature optional mit einem individuellen Stil hervorheben.
Name Type Default Description layerNamestring Der Name des Layers, in dem das Feature gesucht wird. attributeKeystring Der Attributschlüssel, nach dem gefiltert wird (z. B. "gem_name"). attributeValuestring | number Der gesuchte Wert innerhalb des Attributs. paddingArray.<number> [50, 50, 50, 50] optional Optionales Padding für die `fit`-Funktion ([top, right, bottom, left]) in Pixeln. highlightStyleObject | ol.style.Style null optional Optionaler Stil für die visuelle Hervorhebung des gefundenen Features. Kann entweder ein OL-Style-Objekt sein oder ein Konfigurationsobjekt wie in `getSingleFeatureStyle`. Examples
// Einfacher Zoom auf eine Gemeinde ohne Highlight MpJsApi.zoomToGeoJSONFeature("Gemeinden", "gem_name", "Potsdam");// Zoom mit individueller Hervorhebung MpJsApi.zoomToGeoJSONFeature("Gemeinden", "gem_name", "Potsdam", [50, 50, 50, 50], { type: "polygon", fillColor: "#FF0000", strokeColor: "#000000", strokeWidth: 3, showLabel: true, labelField: "gem_name", font: "bold 14px Arial", textColor: "#ffffff", textStrokeColor: "#000000", textStrokeWidth: 2, labelOffsetY: -14 }); -
staticAddons.MpJsApi.zoomToLayer(layerId){Object|Object}
addons/mpJsApi/src/mapFunctions.js, line 634 -
Zoomt auf den Extent eines Layers anhand seiner Layer-ID. Die Funktion prüft, ob der Layer existiert, eine Source besitzt und ob ein gültiger Extent verfügbar ist.
Name Type Description layerIdstring ID des Layers. Examples
// Beispiel 1: Auf Layer zoomen MpJsApi.zoomToLayer("dl1");// Beispiel 2: Ergebnis prüfen const res = MpJsApi.zoomToLayer("dl1"); console.log(res); -
staticAddons.MpJsApi.zoomToStateExtent(state){Object|Object}
addons/mpJsApi/src/mapFunctions.js, line 315 -
Zoomt auf den Extent eines gespeicherten Zustands. Unterstützt zwei Eingabeformen: - `{ extent: [...] }` - `{ view: { extent: [...] } }` Die Funktion ist nützlich, wenn nur der Kartenausschnitt eines gespeicherten Zustands wiederhergestellt werden soll, ohne Layerzustände zu verändern.
Name Type Description stateObject Zustandsobjekt mit `extent` oder `view.extent`. Examples
// Beispiel 1: Zoom auf gespeicherten MapViewerState const state = MpJsApi.getMapViewerState(); const res = MpJsApi.zoomToStateExtent(state); console.log(res);// Beispiel 2: Zoom auf Snapshot-Extent const snap = MpJsApi.getStatusSnapshot(); if (snap.ok) { MpJsApi.zoomToStateExtent(snap.snapshot); }
Events
-
mpjsapi-ready
addons/mpJsApi/mpJsApi.js, line 28 -
Will be fired as soon as the
MpJsApiobject is ready to use.