Class: HTTPProvider

.xyz.maps.providers. HTTPProvider

new HTTPProvider(config, defaultConfig)

Remote HTTP tile provider.
Parameters:
Name Type Description
config here.xyz.maps.providers.HTTPProvider.Options configuration of the provider
defaultConfig Object

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 for requesting tiles.

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.

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

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) → {Array.<here.xyz.maps.providers.FeatureProvider.Feature>}

Gets features from provider layer.

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.

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.

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 for requesting tiles.
Type:
String
Inherited From:

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:

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

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

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) → {Array.<here.xyz.maps.providers.FeatureProvider.Feature>}

Gets features from provider layer.
Parameters:
Name Type Description
ids Array.<string> | string array of object ids
Inherited From:
Returns:
Type:
Array.<here.xyz.maps.providers.FeatureProvider.Feature>

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
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.
Returns:
map of key value pairs. the key represents the header name

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
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.
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.

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

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.

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.