services

Available for:Map Panel

Managing Services

Geospatial Portal SDK provides a way to manage services used in the Consumer Portal.

Consumer Portal API allows to register and find already defined Search Services.

Methods

Name Summary
add

registers and initializes the map service (currently only search services are available through this API)

find

Finds map service object

Examples

Basic instrumentation for registering new Search Services:

gsp.services.add({
      definitionName: "CustomSearch",
      name: "Sample Search Service",
      customSearchHandler: function handler() { console.log("Placeholder for custom handler!"); }
   },
   function (result) {
      console.log("Placeholder for callback operation.");
   },
   function (result) {
      console.log("Placeholder for errback operation.");
   }
);

They can be used either in UI or API mode, which is set by the activeSearchHandle parameter.

gsp.services.add({
      definitionName: "SearchBackend",
      url: "http://sample.url.to.backend",
      key: "ID",
      ash: "ui"
   },
   function (result) {
      console.log("Placeholder for callback operation.");
  }
);

Methods • Details

add(config, callback, errback) → {void}

Available for:Map Panel

registers and initializes the map service (currently only search services are available through this API)

Parameters

Name Type Description
config Object
{
 "definitionName": String,
 "url": String,
 "name": String,
 "customSearchHandler": function,
 "searchLegendEntryName": String,
 "application": String,
 "filters": Object,
 "key": String,
 "enabled": Boolean,
 "ash": Boolean
}

Configuration options

definitionName

Definition Name of the service (WMPSSearch, SearchBackend, ApolloCatalog, CustomSearch, WFSSearch)

url optional

URL of the search service (required for WMPSSearch, SearchBackend, ApolloCatalog)

name optional

Display name of the search service

customSearchHandler optional

method handling custom search (required for CustomSearch).

searchLegendEntryName optional

Display name of the search results legend entry. Inherited from service name if not specified

application optional

Defines WMPS application name (required for WMPSSearch)

filters optional

WMPS search filters (required for WMPSSerach)

key optional

KEY for backend search (required for SearchBackend)

enabled optional

Default value: true.

Indicates that service is enabled to search from the very beginning

ash optional

Default value: "api".

Indicates to which active search handle new service will be added ("api" or "ui")

callback function optional

callback executed if operation succeeds

result

Result object

result.success

Always true

result.msId

Map Service ID

errback function optional

callback executed if operation fails

result

Result object

result.success

Always false

result.message optional

additional information

Returns

TypeDescription
void

find(config, callback, errback) → {void}

Available for:Map Panel

Finds map service object

Parameters

Name Type Description
config Object
{
 "mapServiceId": String,
 "url": String,
 "ash": Boolean
}

Configuration options

mapServiceId optional

Service Id

url optional

URL (One of URL or mapServiceId should be provided)

ash optional

Default value: "api".

Indicates in which active search handle searchables will be looked for (default "api" or "ui")

callback function optional

function that will be executed on results object

result

undefined

result.success

Always success

result.services

list of Service objects

result.ids

list of IDs of Service objects

errback function optional

callback executed if operation fails

result

Failure information

result.success

Always false

result.message optional

additional information

Returns

TypeDescription
void