Skip to main content
GuidesAPI ReferenceExamplesFAQ

Markers

|

A marker is a visual element placed at a geographic location to indicate a point of interest. Markers can be icons, polylines, or polygons representing temporary or user-defined locations, waypoints, or annotations.

Markers contain basic metadata like position, title, and description. The map does not include markers by default—you must create and add them.


Create Markers

Create markers using one of these methods:

  • Default: Marker() - Creates a basic marker object
  • Coordinates: Marker.fromCoordinates(List<Coordinates> coordinates) - Creates a marker with specified coordinates
  • Circle area: Marker.fromCircleArea(Coordinates centerCoords, double radius) - Creates a circular marker
  • Ellipse area: Marker.fromCircleRadii({required Coordinates centerCoords, required double horizRadius, required double vertRadius}) - Creates an elliptical marker
  • Rectangle area: Marker.fromRectangle(Coordinates topLeft, Coordinates bottomRight) - Creates a rectangular marker
  • Geographic area: Marker.fromArea(GeographicArea area) - Creates a marker from a geographic area
danger

Creating a marker does not automatically display it on the map. Set its coordinates and attach it to the map. See Display markers for instructions.


Marker Structure

Markers contain multiple coordinates organized into parts. Without a specified part, coordinates are added to the default part (index 0). Each part renders differently based on marker type.

Marker Types

Three marker types are available:

  • 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)

Markers provide methods for adding, updating, and deleting coordinates or parts.

Rendering Options

Markers render using default settings or custom options:

  • Image icon
  • Polyline with associated images at each point
  • Polygon with specific colors and fill
Point markers
Polyline marker
Polygon marker

Customize Markers

Markers offer extensive customization options:

  • Colors - Modify fill color, contour color, and text color
  • Sizes - Adjust line width, label size, and margins
  • Labels and positioning - Define labeling modes, reposition labels, and adjust alignment
  • Grouping behavior - Configure how markers group when in proximity
  • Icons - Customize icons for individual markers or groups, including image fit and alignment
  • Textures - Apply unique textures to polylines and polygons

MarkerSketches are predefined collections in the view. Each marker type has a collection, and each element has different render settings.


Interaction with Markers

Select Markers

Markers are selectable by default. User interactions like taps identify markers programmatically using the cursorSelectionMarkers method of GemView.

Tip

When hovering over a grouped marker cluster, cursorSelectionMarkers returns the MarkerMatch of the group head marker. See Marker Clustering for details.

The result is a list of matches containing:

  • Marker type
  • Marker collection
  • Marker index in the collection
  • Part index inside the marker

Search Markers

Markers are not searchable.

Calculate Routes

Markers are not designed for route calculation.

Tip

For route calculation, create a landmark using the marker's coordinates and a representative name.


MarkerCollection

The MarkerCollection class holds markers of the same type and style.

Structure and Operations

NameTypeDescription
idintRetrieves the collection's unique ID.
clear()voidDeletes all markers from the collection.
add(Marker marker, {int index = -1})voidAdds a marker to the collection at a specific index (default is the end of the collection).
indexOf(Marker marker)intReturns the index of a given marker in the collection.
delete(int index)voidDeletes a marker from the collection by index.
areaRectangleGeographicAreaThe geographic area enclosing all markers in the collection.
getMarkerAt(int index)MarkerReturns the marker at a specific index or an empty marker if the index is invalid.
getMarkerById(int id)MarkerRetrieves a marker by its unique ID.
getPointsGroupHead(int id)MarkerRetrieves the head of a points group for a given marker ID.
getPointsGroupComponents(int id)List<Marker>Retrieves the components of a points group by its ID.
nameStringThe name of the marker collection.
sizeintReturns the number of markers in the collection.
typeMarkerTypeRetrieves the type of the marker collection.

Create MarkerCollection

Create a marker collection:

MarkerCollection markerCollection = MarkerCollection(
markerType: MarkerType.point,
name: "myCollection"
);

Usage

Display markers on the map by adding collections to the map's MapViewMarkerCollections. Each collection holds multiple markers of the same type for organized management and rendering.