Class: SpaceProvider

.xyz.maps.providers. SpaceProvider

new SpaceProvider(config, preprocessor)

GeoSpace provider
Parameters:
Name Type Description
config here.xyz.maps.providers.SpaceProvider.Options configuration of the provider
preprocessor function function to be called after this provider is ready.

Extends

Classes

Options

Members Summary

id :String

Provider id.

level :Integer

provider request tiles at this zoomlevel.

margin :Integer

default tile margin.

name :String

Provider name.

url :String

url of the provider, it points to end point of geospace service.

Methods Summary

addEventListener()

Add event listener to provider, valid events: "featureAdd", "featureRemove", "featureCoordinatesChange", "clear" and "error"

addFeature(feature) → {here.xyz.maps.providers.FeatureProvider.Feature|Array.<here.xyz.maps.providers.FeatureProvider.Feature>}

Adds a feature to layer.

all() → {Array.<here.xyz.maps.providers.FeatureProvider.Feature>}

Gets all features currently stored in provider.

cancel(quadkey)

Cancel a tile request.

clear(bbox)

Clear features in bounding box. clear all if bounding box is not given.

commit(data, onSuccess, onError)

Commit modified features to the backend

config(cfg) → {here.xyz.maps.providers.SpaceProvider}

set config for provider.

createTile(quadkey) → {here.xyz.maps.providers.TileProvider.Tile}

create tile.

exists(feature) → {here.xyz.maps.providers.FeatureProvider.Feature}

Validate if a feature is in cache, returns true if the object exists.

getCachedTile(quadkey) → {here.xyz.maps.providers.TileProvider.Tile}

get cached tile by quadkey.

getCachedTilesOfBBox(bbox, level) → {Array.<here.xyz.maps.providers.TileProvider.Tile>}

get cached tile by bounding box.

getFeature(id) → {here.xyz.maps.providers.FeatureProvider.Feature}

Gets a feature from provider.

getFeatures(ids, options) → {Array.<here.xyz.maps.providers.FeatureProvider.Feature>}

Get features from provider.

getFeatureUrl(layer, feature) → {String}

Get url feature requests.

getHeader(name)

Get a specific request-header being added to all requests handled by provider.

getHeaders()

Get the request-headers being added to all requests handled by provider.

getLayerUrl(layer) → {String}

Get url for layer requests.

getParam(name)

Get a specific request-parameter that's being added by provider to all requests.

getParams()

Get the request-parameter being added by provider to all requests.

removeEventListener()

Remove event listener from provider, valid events: "featureadd", "featureRemove", "featureCoordinatesChange", "clear" and "error"

removeFeature(feature)

Remove feature from layer provider.

search(options) → {Array.<here.xyz.maps.providers.RemoteTileProvider.Feature>}

Search for feature in provider.

setFeatureCoordinates(feature, coordinates)

Modify coordinates of a feature.

setHeader(name, value)

Set request-header that should be added to all request handled by provider.

setHeaders(map)

Set request-headers that should be added to all request handled by provider.

setMargin(margin)

set tile margin.

setParam(name, value)

Set a specific request-parameter that should be added to all request handled by provider.

setParams(map)

Set request-parameters that should be added to all request handled by provider.

setPropertySearch(property, operator, value)

Sets result filtering based on properties search in Hub backend.
https://www.here.xyz/api/devguide/propertiessearch/
After setting the property search, the provider will clear all features and data will be
requested from hub using the property search filter.
The response will contain only the features matching all conditions in the query.
If function is called without arguments all filters will be cleared.

setPropertySearch(propertySearchMap)

Sets result filtering based on properties search in Hub backend.
https://www.here.xyz/api/devguide/propertiessearch/
After setting the property search, the provider will clear all features and data will be
requested from hub using the property search filter.
The response will contain only the features matching all conditions in the query.
If propertySearchMap is set to null or none is passed all previous set filters will be cleared.

setTags(tags)

Set tags to filtering results based on tags in Hub backend.
After setting tags, provider will clear all features and data will be
requested from hub including the new tag filter.

Members Details

id :String

Provider id.
Type:
String
Inherited From:

level :Integer

provider request tiles at this zoomlevel.
Type:
Integer
Inherited From:

margin :Integer

default tile margin.
Type:
Integer
Inherited From:

name :String

Provider name.
Type:
String
Inherited From:

url :String

url of the provider, it points to end point of geospace service.
Type:
String

Methods Details

addEventListener()

Add event listener to provider, valid events: "featureAdd", "featureRemove", "featureCoordinatesChange", "clear" and "error"
Inherited From:

addFeature(feature) → {here.xyz.maps.providers.FeatureProvider.Feature|Array.<here.xyz.maps.providers.FeatureProvider.Feature>}

Adds a feature to layer.
Parameters:
Name Type Description
feature here.xyz.maps.providers.FeatureProvider.Feature | Array.<here.xyz.maps.providers.FeatureProvider.Feature>
Inherited From:
Returns:
feature
Type:
here.xyz.maps.providers.FeatureProvider.Feature | Array.<here.xyz.maps.providers.FeatureProvider.Feature>
Example:
provider.addFeature({
 geometry: {
     coordinates: [[-122.159958,37.76620, 0],[-122.169958,37.76620, 0]],
     type: "LineString"
 },
 type: "Feature"
})
 

all() → {Array.<here.xyz.maps.providers.FeatureProvider.Feature>}

Gets all features currently stored in provider.
Inherited From:
Returns:
Type:
Array.<here.xyz.maps.providers.FeatureProvider.Feature>

cancel(quadkey)

Cancel a tile request.
Parameters:
Name Type Description
quadkey string | here.xyz.maps.providers.TileProvider.Tile quadkey of the tile or the tile to cancel request
Inherited From:

clear(bbox)

Clear features in bounding box. clear all if bounding box is not given.
Parameters:
Name Type Argument Description
bbox Array.<number> <optional>
bounding box array: [minLon, minLat, maxLon, maxLat]
Inherited From:

commit(data, onSuccess, onError)

Commit modified features to the backend
Parameters:
Name Type Argument Description
data Object the data to commit to the backend
Properties
Name Type Description
put here.xyz.maps.providers.FeatureProvider.Feature | Array.<here.xyz.maps.providers.FeatureProvider.Feature> features that should be created or updated
remove here.xyz.maps.providers.FeatureProvider.Feature | Array.<here.xyz.maps.providers.FeatureProvider.Feature> features that should be removed
onSuccess function <optional>
callback function on success
onError function <optional>
callback function on error
Inherited From:

config(cfg) → {here.xyz.maps.providers.SpaceProvider}

set config for provider.
Parameters:
Name Type Description
cfg here.xyz.maps.providers.SpaceProvider.Options
Returns:
Type:
here.xyz.maps.providers.SpaceProvider

createTile(quadkey) → {here.xyz.maps.providers.TileProvider.Tile}

create tile.
Parameters:
Name Type Description
quadkey String
Inherited From:
Returns:
created tile
Type:
here.xyz.maps.providers.TileProvider.Tile

exists(feature) → {here.xyz.maps.providers.FeatureProvider.Feature}

Validate if a feature is in cache, returns true if the object exists.
Parameters:
Name Type Description
feature Object Object literal containing "id" property.
Inherited From:
Returns:
return feature if it is found, otherwise undefined
Type:
here.xyz.maps.providers.FeatureProvider.Feature

getCachedTile(quadkey) → {here.xyz.maps.providers.TileProvider.Tile}

get cached tile by quadkey.
Parameters:
Name Type Description
quadkey String
Inherited From:
Returns:
Type:
here.xyz.maps.providers.TileProvider.Tile

getCachedTilesOfBBox(bbox, level) → {Array.<here.xyz.maps.providers.TileProvider.Tile>}

get cached tile by bounding box.
Parameters:
Name Type Argument Description
bbox Array.<Number> array of coordinates in order: [minLon, minLat, maxLon, maxLat]
level Integer <optional>
get tiles at specified level
Inherited From:
Returns:
array of tiles
Type:
Array.<here.xyz.maps.providers.TileProvider.Tile>

getFeature(id) → {here.xyz.maps.providers.FeatureProvider.Feature}

Gets a feature from provider.
Parameters:
Name Type Description
id string object id
Inherited From:
Returns:
Type:
here.xyz.maps.providers.FeatureProvider.Feature

getFeatures(ids, options) → {Array.<here.xyz.maps.providers.FeatureProvider.Feature>}

Get features from provider.
Parameters:
Name Type Argument Description
ids Array.<String> Array of ids, which will be returned by the functions
options Object <optional>
Properties
Name Type Argument Description
remote Boolean <optional>
force search function to do remote search.
onload Funtion <optional>
callback function to return objects.
Inherited From:
Returns:
array of features
Type:
Array.<here.xyz.maps.providers.FeatureProvider.Feature>

getFeatureUrl(layer, feature) → {String}

Get url feature requests.
Parameters:
Name Type Argument Description
layer Array.<String> layer id
feature Object <optional>
feature id
Inherited From:
Returns:
feature url
Type:
String

getHeader(name)

Get a specific request-header being added to all requests handled by provider.
Parameters:
Name Type Description
name string The name of header to retrieve
Inherited From:
Returns:
value of the request header or null if the header does not exist

getHeaders()

Get the request-headers being added to all requests handled by provider.
Inherited From:
Returns:
map of key value pairs. the key represents the header name

getLayerUrl(layer) → {String}

Get url for layer requests.
Parameters:
Name Type Description
layer String layer id
Inherited From:
Returns:
url to layer
Type:
String

getParam(name)

Get a specific request-parameter that's being added by provider to all requests.
Parameters:
Name Type Description
name string The name of parameter to retrieve
Inherited From:
Returns:
value of the request parameter or null if the parameter does not exist

getParams()

Get the request-parameter being added by provider to all requests.
Inherited From:
Returns:
map of key value pairs. the key represents the parameter name

removeEventListener()

Remove event listener from provider, valid events: "featureadd", "featureRemove", "featureCoordinatesChange", "clear" and "error"
Inherited From:

removeFeature(feature)

Remove feature from layer provider.
Parameters:
Name Type Description
feature here.xyz.maps.providers.FeatureProvider.Feature | Array.<here.xyz.maps.providers.FeatureProvider.Feature>
Inherited From:
Search for feature in provider.
Parameters:
Name Type Description
options Object
Properties
Name Type Argument Description
id String <optional>
Object id.
ids Array.<String> <optional>
Array of object ids.
point here.xyz.maps.geo.Point <optional>
Center point of the circle for search
radius number <optional>
Radius of the circle in meters, it is used in "point" search.
rect here.xyz.maps.geo.Rect | Array.<number> <optional>
Rect object is either an array: [minLon, minLat, maxLon, maxLat] or Rect object defining rectangle to search in.
remote Boolean <optional>
Force the provider to do remote search if objects are not found in cache.
onload function <optional>
callback function of search.
onerror function <optional>
callback function for errors.
Inherited From:
Returns:
array of features
Type:
Array.<here.xyz.maps.providers.RemoteTileProvider.Feature>
Examples:
//searching by id:
provider.search({id: 1058507462})
//or:
provider.search({ids: [1058507462, 1058507464]})
//searching by point and radius:
provider.search({
 point: {longitude: 72.84205, latitude: 18.97172},
 radius: 100
})
//searching by Rect:
provider.search({
 rect:  {minLon: 72.83584, maxLat: 18.97299, maxLon: 72.84443, minLat: 18.96876}
})
//remote search:
provider.search({
 rect:  {minLon: 72.83584, maxLat: 18.97299, maxLon: 72.84443, minLat: 18.96876},
 remote: true, // force provider to do remote search if feature/search area is not cached locally
 onload: function(e){
  // search result is only return in this callback function if no features is found in cache.
 }
})
 

setFeatureCoordinates(feature, coordinates)

Modify coordinates of a feature.
Parameters:
Name Type Description
feature here.xyz.maps.providers.FeatureProvider.Feature
coordinates Array.<Array> | Array.<number> new coordinates of the feature, it is either array of coordinates: [longitude, latitude, z] or array of coordinate arrays: [ [longitude, latitude, z], [longitude, latitude, z], , , , ].
Inherited From:

setHeader(name, value)

Set request-header that should be added to all request handled by provider.
Parameters:
Name Type Description
name string The name of the header whose value is to be set.
value string The value to set as the body of the header.
Inherited From:

setHeaders(map)

Set request-headers that should be added to all request handled by provider.
Parameters:
Name Type Description
map string Map of key value pairs. the key represents the header name
Inherited From:

setMargin(margin)

set tile margin.
Parameters:
Name Type Description
margin Integer in pixel
Inherited From:

setParam(name, value)

Set a specific request-parameter that should be added to all request handled by provider.
Parameters:
Name Type Description
name string The name of the parameter whose value is to be set.
value string | Array.<string> | undefined The value(s) of the parameter. If undefined is set parameter get's cleared/removed.
Inherited From:

setParams(map)

Set request-parameters that should be added to all request handled by provider.
Parameters:
Name Type Description
map string A map of key value pairs. the key represents the parameter name. Possible value types are string, string[] or undefined. If undefined is used parameter get's cleared/removed.
Inherited From:

setPropertySearch(property, operator, value)

Sets result filtering based on properties search in Hub backend.
https://www.here.xyz/api/devguide/propertiessearch/
After setting the property search, the provider will clear all features and data will be
requested from hub using the property search filter.
The response will contain only the features matching all conditions in the query.
If function is called without arguments all filters will be cleared.
Parameters:
Name Type Description
property string the name of property
operator string the operator used
value string | number | boolean the value to be matched
Example:
// response will only contain features that have a property called 'name' with 'FirstName' as it's value
 provider.setPropertySearch('name','=','FirstName')
 

setPropertySearch(propertySearchMap)

Sets result filtering based on properties search in Hub backend.
https://www.here.xyz/api/devguide/propertiessearch/
After setting the property search, the provider will clear all features and data will be
requested from hub using the property search filter.
The response will contain only the features matching all conditions in the query.
If propertySearchMap is set to null or none is passed all previous set filters will be cleared.
Parameters:
Name Type Argument Description
propertySearchMap string <optional>
A Map of which the keys are the property names and its values are Objects defining the operator ( '=', '!=', '>', '>=', '<', '<=' ) and the value to be matched.
Examples:
// set multiple conditions
 // provider will only contain features that have a property called name with the value Max OR Peter
 // AND a property called age with value less than 32
 provider.setPropertySearch({
     'name': {
         operator: '=',
         value: ['Max','Petra']
     },
     'age': {
         operator: '<',
         value: 32
     }
 })

 
// clear previous set filters
 provider.setPropertySearch(null)

setTags(tags)

Set tags to filtering results based on tags in Hub backend.
After setting tags, provider will clear all features and data will be
requested from hub including the new tag filter.
Parameters:
Name Type Description
tags string | Array.<string>