new TileLayer()
Layers
Parameters:
Type | Description |
---|---|
here.xyz.maps.layers.TileLayer.Options |
Classes
Members Summary
-
id :string
-
Layer id, identifier of the Layer.
-
margin :number
-
default tile margin in pixel
-
max :number
-
maximum zoom level.
-
min :number
-
minimum zoom level.
-
name :string
-
Layer name
Methods Summary
-
addEventListener(type, callback, context)
-
add event listener to layer, valid events: "featureAdd", "featureRemove", "featureCoordinatesChange", "clear", "styleGroupChange", "styleChange", and "viewportReady"
-
addFeature(feature, stylegroup) → {here.xyz.maps.providers.FeatureProvider.Feature}
-
Add a feature to layer.
-
getCachedTile(quadkey) → {here.xyz.maps.providers.TileProvider.Tile}
-
get cached tile by quadkey.
-
getProvider() → {here.xyz.maps.providers.TileProvider}
-
Get provider of this layer.
-
getStyle() → {here.xyz.maps.layers.TileLayer.TileLayerStyle}
-
Get current layer style.
-
getStyleGroup(feature, level) → {Array.<here.xyz.maps.layers.TileLayer.Style>}
-
Get style of the feature.
-
getTile(quadkey, cb) → {here.xyz.maps.providers.TileProvider.Tile}
-
Get a tile by quad key. tile and layer itself are returned in callback function if it is given.
-
pointerEvents(active) → {Boolean}
-
enable or disable pointer events for all features of layer.
-
removeEventListener(type, callback, context)
-
remove event listener to layer, valid events: "featureAdd", "featureRemove", "featureCoordinatesChange", "clear", "styleGroupChange", "styleChange", and "viewportReady"
-
removeFeature(feature)
-
Remove feature from layer.
-
search(options) → {Array.<here.xyz.maps.providers.FeatureProvider.Feature>}
-
Search for feature in layer.
-
setFeatureCoordinates(feature, coordinates)
-
Modify coordinates of a feature in layer.
-
setMargin(margin)
-
Set tile margin in pixel.
-
setStyle(layerstyle, keepCustomStyles)
-
Set layer with given style.
-
setStyleGroup(feature, styleGroup)
-
Set StyleGroup the feature should be rendered with.
Pass styleGroup = false|null to hide the feature.
If no styleGroup is passed, custom feature style will be cleared and layer default style will be set.
Members Details
-
id :string
-
Layer id, identifier of the Layer.
Type:
- string
-
margin :number
-
default tile margin in pixel
Type:
- number
-
max :number
-
maximum zoom level.
Type:
- number
-
min :number
-
minimum zoom level.
Type:
- number
-
name :string
-
Layer name
Type:
- string
Methods Details
-
addEventListener(type, callback, context)
-
add event listener to layer, valid events: "featureAdd", "featureRemove", "featureCoordinatesChange", "clear", "styleGroupChange", "styleChange", and "viewportReady"
Parameters:
Name Type Argument Description type
String callback
function context
Object <optional>
-
addFeature(feature, stylegroup) → {here.xyz.maps.providers.FeatureProvider.Feature}
-
Add a feature to layer.
Parameters:
Name Type Argument Description feature
here.xyz.maps.providers.FeatureProvider.Feature the feature to be added to layer stylegroup
Array.<here.xyz.maps.layers.TileLayer.Style> <optional>
Returns:
featureExample:
layer.addFeature({ geometry: { coordinates: [[-122.49373, 37.78202, 0], [-122.49263, 37.78602, 0]], type: "LineString" }, type: "Feature" },[ {zIndex:0, type:"Line", stroke:"#DDCB97", "strokeWidth":18} ])
-
getCachedTile(quadkey) → {here.xyz.maps.providers.TileProvider.Tile}
-
get cached tile by quadkey.
Parameters:
Name Type Description quadkey
String Returns:
-
getProvider() → {here.xyz.maps.providers.TileProvider}
-
Get provider of this layer.
Returns:
-
getStyle() → {here.xyz.maps.layers.TileLayer.TileLayerStyle}
-
Get current layer style.
Returns:
-
getStyleGroup(feature, level) → {Array.<here.xyz.maps.layers.TileLayer.Style>}
-
Get style of the feature.
Parameters:
Name Type Argument Description feature
here.xyz.maps.providers.FeatureProvider.Feature the feature to get style level
number <optional>
feature style at this specific zoomlevel Returns:
style group for rendering this feature.- Array.<here.xyz.maps.layers.TileLayer.Style>
Type:
-
getTile(quadkey, cb) → {here.xyz.maps.providers.TileProvider.Tile}
-
Get a tile by quad key. tile and layer itself are returned in callback function if it is given.
Parameters:
Name Type Argument Description quadkey
number cb
function <optional>
callback function Returns:
-
pointerEvents(active) → {Boolean}
-
enable or disable pointer events for all features of layer.
Parameters:
Name Type Argument Description active
Boolean <optional>
Returns:
active- Boolean
Type:
-
removeEventListener(type, callback, context)
-
remove event listener to layer, valid events: "featureAdd", "featureRemove", "featureCoordinatesChange", "clear", "styleGroupChange", "styleChange", and "viewportReady"
Parameters:
Name Type Argument Description type
String callback
function context
Object <optional>
-
removeFeature(feature)
-
Remove feature from layer.
Parameters:
Name Type Description feature
here.xyz.maps.providers.FeatureProvider.Feature the feature to be removed from layer -
search(options) → {Array.<here.xyz.maps.providers.FeatureProvider.Feature>}
-
Search for feature in layer.
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>
Raduis 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. Returns:
array of features- Array.<here.xyz.maps.providers.FeatureProvider.Feature>
Type:
Examples:
//searching by id: layer.search({id: 1058507462}) //or: layer.search({ids: [1058507462, 1058507464]})
//searching by point and radius: layer.search({ point: {longitude: 72.84205, latitude: 18.97172}, radius: 100 })
//searching by Rect: layer.search({ rect: {minLon: 72.83584, maxLat: 18.97299, maxLon: 72.84443, minLat: 18.96876} })
//remote search: layer.search({ rect: {minLon: 72.83584, maxLat: 18.97299, maxLon: 72.84443, minLat: 18.96876}, remote: true, // force layer 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 features are not found in cache. } })
-
setFeatureCoordinates(feature, coordinates)
-
Modify coordinates of a feature in layer.
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], , , , ]. -
setMargin(margin)
-
Set tile margin in pixel.
Parameters:
Name Type Description margin
Integer -
setStyle(layerstyle, keepCustomStyles)
-
Set layer with given style.
Parameters:
Name Type Argument Default Description layerstyle
here.xyz.maps.layers.TileLayer.TileLayerStyle keepCustomStyles
boolean <optional>
false keep and reuse custom set styles via layer.setStyleGroup(...) -
setStyleGroup(feature, styleGroup)
-
Set StyleGroup the feature should be rendered with.
Pass styleGroup = false|null to hide the feature.
If no styleGroup is passed, custom feature style will be cleared and layer default style will be set.Parameters:
Name Type Description feature
here.xyz.maps.providers.FeatureProvider.Feature the feature to set style styleGroup
Array.<here.xyz.maps.layers.TileLayer.Style> | false | null