Read more detailed information in the referenced API documentation:
createServiceLayer API referenceTo Check responses from GRAPHICS_MAP_LAYER open your Dev-console and have a look at the events in the console (In the data attribute, you will see the getFeatureAttribute event).
IDs of object in current map extent
Exported objects from selection tool
Current map extent
To use the function as seen in the example, use following code:
function postEvent(functionName, detail) {
const integrationElement = document.getElementById('mapIntegrationElement').contentWindow
if(integrationElement){
integrationElement.postMessage({functionName: functionName, detail: detail}, "*")
}
}
[...]
const parameter = {
"id": "serviceTest",
"serviceUrl": "https://geodienste.sachsen.de/wms_geosn_hist/guest?Service=WMS&Request=GetCapabilities&Version=1.3.0",
"type": "WMS"
}
postEvent("CREATE_SERVICE_LAYER", parameter)
[...]
// Example filter request
postEvent("filterObjects", {query: "Name like 'Polygon%'", layerId: "serviceTest_graphic"});
// Delete service layer
postEvent("DELETE_SERVICE_LAYER", { id: "serviceTest_graphic"});
Some examples for different services:
// AGS_DYNAMIC example
{
"id": "serviceTest",
"serviceUrl": "https://geodienste.sachsen.de/ags-relay/ArcGISServer/guest/arcgis/rest/services/geosn/wms_geosn_uvb/MapServer/",
"type": "AGS_DYNAMIC",
"layers": [
{
"id": 0,
"title": "Landesgrenze"
},
{
"id": 2,
"title": "Landkreise"
},
{
"id": 4,
"title": "Gemeinde",
"query": "INSPIRE.auAdmUnitS.BESCHRIFTUNG like 'Stadt%'"
}
]
}
// AGS_FEATURE example
{
id: "serviceTest",
serviceUrl: "https://geodienste.sachsen.de/ags-relay/ArcGISServer/guest/arcgis/rest/services/geosn/wms_geosn_uvb/MapServer/0",
query: "Name like 'Stadt%'",
type: "AGS_FEATURE",
}
// WMS example
{
"id": "serviceTest",
"serviceUrl": "https://geodienste.sachsen.de/wms_geosn_hist/guest?Service=WMS&Request=GetCapabilities&Version=1.3.0",
"type": "WMS"
}
// Simple Graphics example
{
"id":"serviceTest_graphic_simple",
"type":"graphic",
"objectIDField":"OBJECTID",
"query":"OBJECTID >= 1",
"symbol":{
"type":"simple",
"symbol":{
"type":"simple-marker",
"size":20,
"color":"blue",
"outline":{
"width":0.5,
"color":"white"
}
}
},
"graphics":[
{
"geometry":{
"type":"point",
"x":405647,
"y":5662584.5,
"spatialReference":{
"wkid":25833
}
},
"attributes":{
"OBJECTID":1,
"SampleAttribute":"This is a sample attribute",
"Aother Attribute":"This is another attribute"
}
}
]
}
//GRAPHICS_MAP_LAYER example
{
"id":"serviceTest_graphic_extended",
"type":"GRAPHICS_MAP_LAYER",
"setPostMessage":true,
"setCursorStyleToPointer": true,
"features":[
{
"minScale":30000000,
"maxScale":20000,
"geometry":{
"type":"polygon",
"rings":[
[
[
367939.84820288554,
5676371.935282625
],
[
400960.71046377334,
5676371.935282625
],
[
400960.71046377334,
5657415.514355077
],
[
367939.84820288554,
5657415.514355077
],
[
367939.84820288554,
5676371.935282625
]
]
],
"spatialReference":{
"wkid":25833
}
},
"symbol":{
"type":"simple-fill",
"color":[
226,
119,
40
],
"width":1
},
"attributes":{
"OBJECTID":1,
"Name":"Polygon Test",
"Owner":"Sachsen",
"otherTestValue":1337
},
"maptipTemplate":{
"content":"Name: {Name}
Fläche: {otherTestValue}m²
"
}
},
{
"minScale":30000000,
"maxScale":20000,
"geometry":{
"type":"point",
"x":391482.5,
"y":5645873.5,
"spatialReference":{
"wkid":25833
}
},
"symbol":{
"type":"simple-marker",
"color":[
226,
119,
40
],
"size":10
},
"attributes":{
"OBJECTID":2,
"Name":"Point Test",
"Owner":"Sachsen",
"otherTestValue":1000,
"someOtherAttributeWhichIsOnylHere":"Hello world"
},
"popupTemplate":{
"title":"{Name}",
"content":[
{
"type":"fields",
"fieldInfos":[
{
"fieldName":"Name"
},
{
"fieldName":"Owner"
},
{
"fieldName":"otherTestValue"
},
{
"fieldName":"someOtherAttributeWhichIsOnylHere"
}
]
}
]
}
}
]
}