Spatial Selection
Information about map objects can be queried and displayed using the spatial selection and the result center. In contrast to Popups, the information can be queried not only at a specific location, but also in a larger area, which can be defined by the user, for example by drawing a rectangle.
Data sources
Required bundle: agssearch
The following map services can be used for the search:
-
ArcGIS Map or Feature Layer
-
OGC Web Feature Services (WFS)
-
GeoJSON layer
-
CSV layer
The respective layer must support the Query
operation.
Automatic registration
To use all layers visible in the map for the spatial selection, activate automatic registration and set the value selection
in the useIn
parameter, as shown in the following example:
{
"agssearch": {
"AutoStoreRegistration": {
"componentEnabled": true,
"useIn": [
"search",
"selection"
]
}
}
}
The title and the names of the attributes are taken from the respective layer and used for display in the user interface.
Manual registration
With the following configuration, layers used in the map can be registered for spatial selection:
{
"agssearch": {
"AGSStore": [
{
"id": "store01",
"title": "Gemeinden in Deutschland (MapServer Layer)",
"layerId": "grenzen/0",
"useIn": [
"selection"
]
},
{
"id": "store02",
"title": "Gemeinden in Deutschland (Feature Layer)",
"layerId": "gemeindelayer",
"useIn": [
"selection"
]
},
{
"id": "store03",
"title": "Kindertagesstätten (WFS)",
"layerId": "kitas_wfs_layer",
"useIn": [
"selection"
]
},
{
"id": "store04",
"title": "Erdbeben (GeoJSON Layer)",
"layerId": "earthquakes_geojson",
"useIn": [
"selection"
]
},
{
"id": "store05",
"title": "Erdbeben (CSV Layer)",
"layerId": "earthquakes_csv",
"useIn": [
"selection"
]
}
]
},
"map-init": {
"Config": {
"map": {
"layers": [
{
"id": "grenzen",
"type": "AGS_DYNAMIC",
"url": "https://services.conterra.de/arcgis/rest/services/common/grenzen/MapServer",
"sublayers": [
{
"id": 0,
"title": "Gemeinden"
}
]
},
{
"id": "gemeindelayer",
"url": "https://services.conterra.de/arcgis/rest/services/common/grenzen/FeatureServer/0",
"type": "AGS_FEATURE"
},
{
"id": "kitas_wfs_layer",
"type": "WFS",
"url": "https://www.stadt-muenster.de/ows/mapserv706/kitaserv",
"name": "ms:kitas01"
},
{
"id": "earthquakes_geojson",
"type": "GEOJSON",
"url": "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson"
},
{
"id": "earthquakes_csv",
"type": "CSV",
"url": "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_week.csv"
}
]
}
}
}
}
Alternatively, the URL of a layer can be defined independently of the reference to a map configuration:
{
"agssearch": {
"AGSStore": [
{
"id": "store01",
"title": "Gemeinden in Deutschland",
"url": "https://services.conterra.de/arcgis/rest/services/common/grenzen/MapServer/0",
"useIn": [
"selection"
]
},
{
"id": "store02",
"title": "Gemeinden in Deutschland (Feature Layer)",
"url": "https://services.conterra.de/arcgis/rest/services/common/grenzen/FeatureServer/0",
"useIn": [
"selection"
]
},
{
"id": "store03",
"title": "Kindertagesstätten (WFS)",
"url": "https://www.stadt-muenster.de/ows/mapserv706/kitaserv",
"name": "ms:kitas01",
"type": "wfs",
"useIn": [
"selection"
]
},
{
"id": "store04",
"title": "Erdbeben (GeoJSON Layer)",
"url": "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson",
"type": "geojson",
"useIn": [
"selection"
]
},
{
"id": "store05",
"title": "Erdbeben (CSV Layer)",
"url": "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_week.csv",
"type": "csv",
"useIn": [
"selection"
]
}
]
}
}
Tools for spatial selection
Default Tool
Required bundles: selection-ui
, result-ui
Add the tool with the ID selection-ui-tool
to a toolset to add the default tool for selecting objects from one or more layers to an app.
Data sources defined using automatic registration or link to a map layer are hidden when the corresponding map layer is disabled. Data sources defined with their URL are always usable.
The user can draw a point, a rectangle or a polygon as selection geometry in the map. This starts a spatial selection on the objects of all selected data sources. All selected objects are displayed in the result center and highlighted in the map.
For more information on how to customize the way objects are highlighted in the map, see the bundle documentation . |
To customize the behavior of the tool presented above, use the following configuration:
preselectSources
-
Determines whether the available data sources are to be selected when the window is opened.
Allowed values:
all
selects all data sources
none
does not select a data source
disabled
lets you open and close the window without changing the selection made by the user.
Default:
all
activateSelectionMethod
-
Determines whether the first selection method is to be activated when the window is opened.
Default:
true
closeOnSelection
-
Determines whether the window is to be closed after a selection.
Default:
true
selectionMethods
-
Determines which selection methods are offered to the user.
Allowed values:
rectangle, point, polygon
Default:["*"]
{
"selection-ui": {
"Config": {
"preselectSources": "all",
"activateSelectionMethod": true,
"closeOnSelection": true,
"selectionMethods": [
"*"
]
}
}
}
For more information about configuration, see the bundle documentation . |
Tools for individual layers
Required bundles: selection-tools
, result-ui
The bundle selection-tools
lets you configure dedicated selection tools, in which a data source is directly connected to a geometry tool.
{
"selection-tools": {
"Config": {
"tools": [
{
"id": "selectCountries",
"selectionMethod": "point",
"selectionOptions": {
"clickTolerance": 10
},
"sourceId": "countries",
"iconClass": "icon-map-selection"
}
]
}
}
}
For more information about configuration, see the bundle documentation . |