Methods
(static) bundleOgcRequests(featureInfoUrls, stringify, bundleParams)
This joins/bundles a given set of (typically WMS GetFeatureInfo) requests by the base URL. E.g. it merges the following two requests:
http://maps.bvb.de?SERVICE=WMS&REQUEST=GetFeatureInfo&LAYERS=Shinji http://maps.bvb.de?SERVICE=WMS&REQUEST=GetFeatureInfo&LAYERS=Kagawa
to
http://maps.bvb.de?SERVICE=WMS&REQUEST=GetFeatureInfo&LAYERS=Shinji,Kagawa
Parameters:
Name | Type | Description |
---|---|---|
featureInfoUrls |
Array | An array of requests to bundle. |
stringify |
Boolean | Whether to stringify the output or not. If set to false an object keyed by the base URL and valued by the combined requests params will be returned. |
bundleParams |
Array | An array of query params to bundle, default is to ['LAYERS', 'QUERY_LAYERS', 'STYLES']. |
- Source:
(static) createValidGetCapabilitiesRequest(url, service, version) → {String}
Creates a valid GetCapabilitiesRequest out of the given URL by checking if SERVICE, REQUEST and VERSION are set.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
url |
String | The URL to validate. |
|
service |
String | WMS | The service to set. Default is to 'WMS'. |
version |
String | 1.3.0 | The version to set. Default is to '1.3.0'. |
- Source:
Returns:
The validated URL.
- Type
- String
(static) getBasePath(url) → {String}
Returns the base path of an URL.
Parameters:
Name | Type | Description |
---|---|---|
url |
String | The URL to obtain the base path from. |
- Source:
Returns:
The base path.
- Type
- String
(static) getQueryParam(url, key) → {String}
Returns the value of the given query param of the provided URL. If not found, undefined will be returned.
Parameters:
Name | Type | Description |
---|---|---|
url |
String | The URL to get the query params from. |
key |
String | The key to get the value from. |
- Source:
Returns:
The query param value.
- Type
- String
(static) getQueryParams(url) → {Object}
Returns the query params of a given URL as object.
Parameters:
Name | Type | Description |
---|---|---|
url |
String | The URL to get the query params from. |
- Source:
Returns:
The query params of the given URL.
- Type
- Object
(static) hasQueryParam(url, key) → {Boolean}
Checks if a given URL has the provided query parameter present.
Parameters:
Name | Type | Description |
---|---|---|
url |
String | The URL to check. |
key |
String | The query parameter to check. |
- Source:
Returns:
Whether the parameter is present or not.
- Type
- Boolean
(static) isValid(url, opts) → {Boolean}
Checks if a given URL is valid. Implementation based on https://www.npmjs.com/package/validator.
Parameters:
Name | Type | Description |
---|---|---|
url |
String | The URL to validate. |
opts |
Object | The validation |
- Source:
Returns:
Whether the URL is valid or not.
- Type
- Boolean
(static) joinQueryParams(params1, params2, keys) → {Object}
Joins some query parameters (defined by keys
) of two query objects and
returns the joined query parameters.
var params1 = {FOO: 'foo,bar', BAZ: 'baz', HUMPTY: '1'};
var params2 = {FOO: 'pupe,pape', BAZ: 'baz', DUMPTY: '42'};
var keys = ['FOO'];
var joined = this.joinQueryParams(params1, params2, keys);
// joined is now
// {FOO: 'foo,bar,pupe,pape', BAZ: 'baz', HUMPTY: '1'};
Parameters:
Name | Type | Description |
---|---|---|
params1 |
Object | The first object with parameters, where certain
keys might have values that are joined with |
params2 |
Object | The second object with parameters, where certain
keys might have values that are joined with |
keys |
Array | The keys which we will consider for joining. Others will be taken from the first object with parameters. |
- Source:
Returns:
The joined query parameters.
- Type
- Object
(static) objectToRequestString(object) → {String}
Transforms an object into a string containing requestParams (without leading questionmark).
Parameters:
Name | Type | Description |
---|---|---|
object |
Object | An object containing kvp for the request. e.g. {height:400, width:200} |
- Source:
Returns:
The kvps as a requestString. e.g. 'height=400&width=200'
- Type
- String
(static) read(url) → {URL}
Returns an object representation of an URL.
Parameters:
Name | Type | Description |
---|---|---|
url |
String | The URL to read in. |
- Source:
Returns:
The parsed URL object.
- Type
- URL
(static) write(urlObj) → {String}
Returns a string representation of an URL object.
Parameters:
Name | Type | Description |
---|---|---|
urlObj |
URL | The URL object to write out. |
- Source:
Returns:
The stringified URL.
- Type
- String