Markers
A marker is a visual representation (such as an icon or a geometry, like a polyline or polygon) placed at a specific geographic location on a map to indicate an important point of interest, event, or location.
Markers can represent temporary or user-specified points on the map, such as user-defined locations, waypoints, or temporary annotations. While they are often represented by icons, they can also take the form of more complex geometries, like lines or shapes, depending on the context or requirements.
Markers typically contain only basic metadata, such as their position, title, or description, without extensive associated details.
By default, the map does not include any visual elements categorized as markers. Users have the ability to create and add markers to the map as needed.
Instantiating Markers
Markers can be instantiated via:
- Default Initialization :
Marker()creates a basic marker object. - With CoordinatesList :
Marker(coordinates: CoordinatesList)initializes a marker at specified geographic coordinates - With Coordinates and radius in meters :
Marker(coordinates: Coordinates, radius: Int)creates a circular marker centered at the given coordinates with a defined radius. - With Coordinates, horizontal radius, and vertical radius in meters :
Marker(coordinates: Coordinates, horizRadius: Int, vertRadius: Int)creates a rectangle marker centered at the specified coordinates with defined horizontal and vertical radii.
Creating a marker does not automatically display it on the map. Ensure you set its coordinates and attach it to the desired map. Refer to the Display markers guide for detailed instructions.
Types of Markers
There are 3 types of markers:
- Point markers (each part is a group of points - array of coordinates)
- Polyline markers (each part is a polyline - array of coordinates)
- Polygon markers (each part is a polygon - array of coordinates)
The marker has methods for managing and manipulating markers on a map, including operations such as adding, updating, and deleting coordinates or parts.
A marker can be rendered in multiple ways on the map, either through default settings or user-specified rendering options:
- An image icon
- A polygon drawn with custom collors for border and shape.
- A polyline having an associated image at each point
Customization options
Markers offer extensive customization options through MarkerRenderSettings class and MarkerCollectionRenderSettings, enabling developers to tailor their appearance and behavior. Customizable features include:
- Colors: Modify the fill color, contour color, and text color to match the desired style.
- Sizes: Adjust dimensions such as line width, label size, and margins to fit specific requirements.
- Labeling and Positioning: Define custom labeling modes, reposition item or group labels, and adjust the alignment of labels and images relative to geographic coordinates.
- Grouping Behavior: Configure how multiple markers are grouped when located in proximity.
- Icons: Customize icons for individual markers or groups, including options for image fit and alignment.
- Polyline and Polygon Textures: Apply unique textures to polylines and polygons for enhanced visualization.
Interaction with Markers
Selecting markers
Markers are selectable by default, meaning user interactions, such as taps or clicks, can identify specific markers programmatically (e.g., through the function mapview.cursorSelectionMarkers()).
When cursor is hovering over a grouped marker cluster, the mapview.cursorSelectionMarkers() method will return the MarkerMatchList with a group head marker. See more about group head markers at Marker Clustering.
The result is a MarkerMatchList. The MarkerMatch item contains detailed information about the match:
- the matched
marker: Marker - the marker's
type: EMarkerMatchType - the matched marker's
index: Intin collection - the matched
markerCollection: MarkerCollectionof the marker - the matched marker's
segment: Int - the matched position
coordinates: Coordinates - the
distance: Intfrom the matched position to the cursor position in meters
Searching markers
Markers are not searchable.
Calculating route with marker
Markers are not designed for route calculation.
To enable route calculation and navigation, create a new landmark using the relevant coordinates of the marker and a representative name and use that object for routing.
Marker
| Name | Type | Description |
|---|---|---|
id | Long | Unique identifier for the marker. |
name | String | Name of the marker. |
type | EMarkerType | Type of the marker (Point, Polyline, Polygon). |
area | RectangleGeographicArea | The geographic area covered by the marker. |
partCount | Int | Number of parts in the marker. |
getCoordinates() | CoordinatesList | Returns the coordinates of the marker. |
setCoordinates(coordinates: CoordinatesList) | Unit | Sets the coordinates of the marker. |
set(center: Coordinates, radius: Int) | Unit | Sets the marker as a circle with the specified center and radius in meters. |
set(center: Coordinates, horizontalRadius: Int, verticalRadius: Int) | Unit | Sets the marker as an ellipse with the specified center and horizontal/vertical radii in meters. |
set(corner1: Coordinates, corner2: Coordinates) | Unit | Sets the marker as a rectangle defined by two corner coordinates. |
add(coordinates: Coordinates, index: Int, part: Int) | Unit | Adds coordinates to the marker at the specified index and part. |
add(latitude: Double, longitude: Double, index: Int, part: Int) | Unit | Adds coordinates to the marker using latitude and longitude values at the specified index and part. |
MarkerCollection
The MarkerCollection class is the main collection holding markers. All the markers within a collection have the same type and are styled in the same way.
| Name | Type | Description |
|---|---|---|
name | String | The name of the marker collection. |
size | Int | Returns the number of markers in the collection. |
type | EMarkerType | Retrieves the type of the marker collection. |
area | RectangleGeographicArea | The geographic area enclosing all markers in the collection. |
markers | ArrayList<Marker>? | The list of markers in the collection. |
add(marker:Marker,index:Int) | Unit | Adds a marker to the collection at a specific index (default is the end of the collection). |
del(index: Int) | Unit | Deletes a marker from the collection by index. |
clear() | Unit | Deletes all markers from the collection. |
getMarkerAt(index:Int) | Marker | Returns the marker at a specific index or an empty marker if the index is invalid. |
getMarkerById(markerId:Long) | Marker | Retrieves a marker by its unique ID. |
getPointsGroupHead(groupId:Long) | Marker | Retrieves the head of a points group for a given marker ID. |
getPointsGroupComponents(groupId:Long) | ArrayList<Marker>? | Retrieves the components of a points group by its ID. |
save(buffer: DataBuffer) | Int | Serializes the collection and adds it to a DataBuffer. |


