Properties of a ClusterFeature.
The isCluster
, clusterSize
, and zoom
properties are automatically populated for each cluster feature.
Custom properties aggregation for clusters can be achieved by defining custom property creation and aggregation functions using the createProperties and aggregateProperties options.
Additional custom properties of the cluster feature.
The size of the cluster, i.e., the number of features it contains.
Indicates if the feature is a cluster.
The zoom level at which the cluster was formed.
The Color is an RGBA color value representing RED, GREEN, and BLUE light sources with an optional alpha channel. Colors can be specified in the following ways:
Defines a geographical rectangle. The values of a GeoJSONBBox array are "[west: number, south: number, east: number, north: number]"
A GeoJSON Geometry coordinate is a array of coordinates. The array must contain two or three elements [longitude, latitude, altitude?] / [x, y, z?].
A StyleExpression is a JSON array representing an expression that returns the desired value for a specific style property. It is particularly useful for data-driven styling in map or UI components.
The structure of a StyleExpression is as follows:
The type of the value that the expression returns.
A StyleExpression is a JSON array representing an expression that returns the desired value for a specific style property. Below are the possible operators and their descriptions, along with examples.
ref
: References another expression by name.["ref", "otherExpression"]
get
: Retrieves a property from the input data. The third optional operand specifies the input data from which to retrieve the property. If not provided, it defaults to feature.properties
.
The property name can also be a global map context variable:
$zoom
: The current zoom level.
$layer
: The name of the datasource layer.
$geometryType
: The type of the current feature geometry ("line", "point", "polygon").
$id
: The ID of the current feature.
Example: ["get", "propertyName"]
// Retrieves propertyName
from feature.properties
.
Example with input data: ["get", "propertyName", { custom: "data" }]
// Retrieves propertyName
from the specified input data.
Example with global map context variable: ["get", "$zoom"]
// Retrieves the current zoom level.
+
: Adds two numbers.["+", 2, 3]
// Outputs: 5-
: Subtracts the second number from the first.["-", 5, 3]
// Outputs: 2*
: Multiplies two numbers.["*", 2, 3]
// Outputs: 6/
: Divides the first number by the second.["/", 6, 3]
// Outputs: 2%
: Computes the remainder of dividing the first number by the second.["%", 5, 2]
// Outputs: 1floor
: Rounds down a number to the nearest integer.["floor", 4.7]
// Outputs: 4min
: Returns the smallest number.["min", 1, 2, 3]
// Outputs: 1max
: Returns the largest number.["max", 1, 2, 3]
// Outputs: 3all
: Returns true if all conditions are true.["all", true, true]
// Outputs: trueany
: Returns true if any condition is true.["any", true, false]
// Outputs: true!
: Negates a boolean value.["!", true]
// Outputs: false!has
: Checks if a property does not exist.["!has", "propertyName"]
has
: Checks if a property exists.["has", "propertyName"]
none
: Returns true if no conditions are true.["none", false, false]
// Outputs: true==
: Checks if two values are equal.["==", 2, 2]
// Outputs: true!=
: Checks if two values are not equal.["!=", 2, 3]
// Outputs: true>
: Checks if the first value is greater than the second.[" >", 3, 2]
// Outputs: true>=
: Checks if the first value is greater than or equal to the second.[" >=", 3, 3]
// Outputs: true<=
: Checks if the first value is less than or equal to the second.["<=", 2, 2]
// Outputs: true<
: Checks if the first value is less than the second.["<", 2, 3]
// Outputs: true^=
: Checks if a string starts with a given substring.["^=", "hello", "he"]
// Outputs: true$=
: Checks if a string ends with a given substring.["$=", "hello", "lo"]
// Outputs: truesplit
: Splits a string by a delimiter.["split", "a,b,c", ","]
// Outputs: ["a", "b", "c"]to-string
: Converts a value to a string.["to-string", 123]
// Outputs: "123"concat
: Concatenates multiple strings.["concat", "hello", " ", "world"]
// Outputs: "hello world"regex-replace
: Replaces parts of a string matching a regex.["regex-replace", "hello world", "world", "there"]
// Outputs: "hello there"slice
: Extracts a section of a string.["slice", "hello", 0, 2]
// Outputs: "he"at
: Gets the character at a specified index in a string.["at", "hello", 1]
// Outputs: "e"length
: Gets the length of a string.["length", "hello"]
// Outputs: 5case
: Evaluates conditions in order and returns the corresponding result for the first true condition.["case", ["==", 1, 1], "one", ["==", 2, 2], "two", "default"]
// Outputs: "one"step
: Returns a value from a step function based on input.["step", 3, "small", 5, "medium", 10, "large"]
// Outputs: "small"match
: Returns a value based on matching input values.["match", "a", "a", 1, "b", 2, 0]
// Outputs: 1literal
: Returns a literal value.["literal", [1, 2, 3]]
// Outputs: [1, 2, 3]lookup
: Finds an entry in a table that matches the given key values. The entry with the most matching keys is returned.
If multiple entries match equally, one of them is returned.
If no match is found, the default entry (if any) is returned. If no default entry is defined, null is returned.lookupTable
should be an array of objects, each with a keys
member and an attributes
member:keys
: An object containing key-value pairs used for matching.attributes
: An object containing the attributes to be returned when a match is found.{
"definitions": {
"lookupTable": [ "literal", [
{ "keys": { "country": "US" }, "attributes": { "population": 331000000 } },
{ "keys": { "country": "US", "state": "CA" }, "attributes": { "population": 39500000 } },
{ "keys": {}, "attributes": { "population": 7800000000 } } // Default entry
]]
}
}
// This example looks up the population for the state of California in the United States from the `lookupTable`.
["lookup", { "country": "US", "state": "CA" }, ["ref", "lookupTable"]] // Outputts: `{ "population": 39500000 }`.
number
: Converts a value to a number.["number", "123"]
// Outputs: 123boolean
: Converts a value to a boolean.["boolean", "true"]
// Outputs: trueto-number
: Converts a value to a number.["to-number", "123"]
// Outputs: 123to-boolean
: Converts a value to a boolean.["to-boolean", "true"]
// Outputs: truezoom
: Returns the current zoom level.["zoom"]
// Outputs: current zoom levelinterpolate
: Interpolates between values based on zoom level.["interpolate", ["linear"], ["zoom"], 10, 1, 15, 10]
Example:
const expression: StyleExpression = ["==", ["get", "property"], "value"];
In this example, "=="
is the operator, and ["get", "property"]
and "value"
are the operands.
Operators can include logical, arithmetic, string manipulation, and other types of operations, which are evaluated to determine the final value of the style property.
A StyleValueFunction is a function that returns the desired value for the respective style property. It's especially useful for data driven styling.
A StyleZoomRange is a Map<number,any> with zoomlevel as its keys and the value for the respective Style Property at the respective zoomlevel. Values for intermediate zoom levels are interpolated linearly.
WebMercator projection utilities.
Detailed Information about the build.
Generated using TypeDoc
XYZ Maps JS: Core
XYZ Maps is an experimental and work in progress open-source map editor written in TypeScript/JavaScript. The core module of XYZ Maps provides the most basic functionality and is used by all other modules of xyz-maps. Main functionalities of the module are: DataProviders, TileLayers, Geometric Classes and Styling definitions.
Links
Installation
Install XYZ Map Core by using
# install using npm npm install @here/xyz-maps-core
or
# install using yarn yarn add @here/xyz-maps-core
Example Usage:
Create a MVTLayer
import {MVTLayer} from '@here/xyz-maps-core'; // create a MVT Layer const myLayer = new MVTLayer({ remote: { url: 'https://xyz.api.here.com/tiles/osmbase/512/all/{z}/{x}/{y}.mvt?access_token=' + YOUR_ACCESS_TOKEN tileSize : 512 }, min: 1, max: 20 }) // and add it to the map display display.addLayer(myLayer);
Start developing
Install node module dependencies
yarn install
In case yarn is not installed already: install yarn
watch for source code changes and build dev version
yarn run watch-dev
Builds are located in located in
./dist/
Other
build dev version once
yarn run build-dev
(located in packages/*/dist/)build release version only
yarn run build-release
(minified...)License
Copyright (C) 2019-2022 HERE Europe B.V.
This project is licensed under the Apache License, Version 2.0 - see the LICENSE file for details