Search
Overview
The search for spatial objects such as addresses, POIs or parcels is a central function in many apps.
The bundle omnisearch
provides an interface that is optimized for use on desktop and mobile devices and offers a central input field for the search.
Several other bundles can provide data sources for searches without having to provide a graphical interface.
If more than one data source is available, the user can choose between them.
Interface
Required Bundles: omnisearch
, at least one data source bundle
Live Configuration
Zooming to a result
When a search result is selected, the view is zoomed to the bounding box of the found object, if it is a line or polygon.
Point objects are zoomed to a preconfigured scale of the found object. This is defined as follows:
{
"omnisearch": {
"ZoomHandler": {
"scale": 1000
}
}
}
Optionally, zooming to a fixed scale is possible for line or polygon objects. This requires the following configuration:
{
"omnisearch": {
"ZoomHandler": {
"scale": 1000,
"fixedScale": true
}
}
}
It is possible to set different scales for different data sources. The respective ID defines a mapping of data source and scale.
{
"omnisearch": {
"ZoomHandler": {
"scaleByStore": {
"store01": 5000,
"store02": 25000
}
}
}
}
Display of a result
Search results are displayed in the map depending on their geometry: A Marker for points and a geometry highlighting for lines and areas. The representation can be changed by configuration.
Symbols are defined according to the Esri Symbol Definition .
To configure 3D symbols, the postfix -3d
must be appended to the geometry type.
The following configuration shows the default values for each type:
{
"omnisearch": {
"DrawHandler": {
"_symbolTable": {
"point": {
"url": "resource('images/mapMarker.png')",
"width": 37,
"height": 36,
"xoffset": 4,
"yoffset": 16,
"type": "esriPMS"
},
"polyline": {
"color": [
10,
10,
10,
255
],
"style": "esriSLSSolid",
"type": "esriSLS",
"width": 1.3
},
"polygon": {
"type": "esriSFS",
"style": "esriSFSSolid",
"color": [
125,
205,
234,
100
],
"outline": {
"type": "esriSLS",
"style": "esriSLSSolid",
"color": [
10,
10,
10,
255
],
"width": 1
}
},
"point-3d": {
"url": "resource('images/mapMarker.png')",
"width": 37,
"height": 36,
"xoffset": 4,
"yoffset": 16,
"type": "esriPMS"
},
"polyline-3d": {
"color": [
10,
10,
10,
255
],
"style": "esriSLSSolid",
"type": "esriSLS",
"width": 1.3
},
"polygon-3d": {
"type": "esriSFS",
"style": "esriSFSSolid",
"color": [
125,
205,
234,
100
],
"outline": {
"type": "esriSLS",
"style": "esriSLSSolid",
"color": [
10,
10,
10,
255
],
"width": 1
}
}
}
}
}
}
For more information about configuration, refer to the bundle documentation . |
Data sources
ArcGIS Map or Feature Layer
Required Bundle: agssearch
Live Configuration (for automatic registration)
ArcGIS Map or Feature layers supporting the query
operation can be used as data sources.
Automatic registration
If the automatic registration is active and the parameter useIn
contains the value omnisearch
, all ArcGIS map and feature layers visible in the map are used for the search.
The displayField
from the metadata of the service is used for the search.
The title of the layer and its description are also requested from the service.
This configuration can be done in the manual configuration as follows:
{
"agssearch": {
"AutoStoreRegistration": {
"componentEnabled": true,
"useIn": [
"omnisearch",
"selection"
]
}
}
}
Manual registration
With the following configuration, layers used in the map can be registered for the search:
{
"agssearch": {
"AGSStore": [
{
"id": "store01",
"title": "Gemeinden in Deutschland (MapServer Layer)",
"layerId": "grenzen/0",
"useIn": [
"omnisearch"
],
"omniSearchSearchAttr": "g_name",
"omniSearchDefaultLabel": "Enter search term...",
"omniSearchPageSize": 20
},
{
"id": "store02",
"title": "Gemeinden in Deutschland (Feature Layer)",
"layerId": "gemeindelayer",
"useIn": [
"omnisearch"
],
"omniSearchSearchAttr": "g_name",
"omniSearchDefaultLabel": "Enter search term...",
"omniSearchPageSize": 20
}
]
},
"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"
}
]
}
}
}
}
Alternatively, the URL of the 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",
"omniSearchSearchAttr": "g_name",
"omniSearchDefaultLabel": "Enter search term...",
"omniSearchPageSize": 20
}
]
}
}
The following options are available for configuring the data sources:
Name | Beschreibung |
---|---|
|
Name of the attribute on which the search is performed. This must be of type String. If it is omitted, the display field of the layer is used. |
|
Name of the attribute whose value is used for the result list.
If omitted, the value of the attribute |
|
A custom string to display the results. Several attributes can be combined. Sample:
|
|
Number of results in the result list per page. |
|
Placeholder for the data source in the search dialog. |
|
Display order for multiple data sources. The higher the value, the higher up the data source is displayed. |
|
If the value is set to |
For more information about configuration, refer to the bundle documentation . |
ArcGIS Locator
Required Bundle: locator-store
Live Configuration
ArcGIS geocoding services can be used to search for addresses or POIs. The Esri World Geocoding Service is a search service that provides information for many countries . In Germany, for example, it is possible to search for addresses by house number.
By configuration the search can be restricted to individual countries and/or categories (for example addresses, cities, POIs). By means of so-called views , a finer restriction to certain geographical areas can be made. You can offer differently configured searches or views in one app.
Name | Description |
---|---|
|
Title of the store. |
|
Description of the store. |
|
Placeholder for the data source in the search dialog. |
|
URL to an ESRI Geolocation Service. If empty, the World Geocoding Service is used. |
|
Default value is an empty string. Limits the returned suggestions to values in a particular country. Supported values include the ISO 3166-1 2-digit country code or the ISO 3166-1 3-digit country code. See Esri documentation . |
|
Default value is an empty array. A place or address type that can be used to filter suggested results. See Esri documentation . |
{
"locator-store": {
"Config": {
"title": "Address or place search",
"description": "Find addresses or places.",
"omniSearchDefaultLabel": "Address or place...",
"url": "@@locator.service.url@@",
"countryCode": "DEU",
"categories": [
"City",
"District"
]
}
}
}
For more information about configuration, refer to the bundle documentation . |