Table of Contents

Class MapLibreMap

public class MapLibreMap : StackLayout
Inheritance
MapLibreMap

Fields

AttributionButtonGravityProperty

public static readonly BindableProperty AttributionButtonGravityProperty

Field Value

BindableProperty

AttributionButtonMarginsProperty

public static readonly BindableProperty AttributionButtonMarginsProperty

Field Value

BindableProperty

AttributionControlPositionProperty

Corner the attribution control is anchored to. Default BottomLeft.

public static readonly BindableProperty AttributionControlPositionProperty

Field Value

BindableProperty

CameraIdleCommandProperty

public static readonly BindableProperty CameraIdleCommandProperty

Field Value

BindableProperty

CameraMoveCommandProperty

public static readonly BindableProperty CameraMoveCommandProperty

Field Value

BindableProperty

CameraMoveStartedCommandProperty

public static readonly BindableProperty CameraMoveStartedCommandProperty

Field Value

BindableProperty

CameraTrackingChangedCommandProperty

public static readonly BindableProperty CameraTrackingChangedCommandProperty

Field Value

BindableProperty

CameraTrackingDismissedCommandProperty

public static readonly BindableProperty CameraTrackingDismissedCommandProperty

Field Value

BindableProperty

CompassGravityProperty

public static readonly BindableProperty CompassGravityProperty

Field Value

BindableProperty

CompassViewMarginsProperty

public static readonly BindableProperty CompassViewMarginsProperty

Field Value

BindableProperty

CustomAttributionProperty

Extra attribution text appended after source-derived attributions.

public static readonly BindableProperty CustomAttributionProperty

Field Value

BindableProperty

DidBecomeIdleCommandProperty

public static readonly BindableProperty DidBecomeIdleCommandProperty

Field Value

BindableProperty

GpsControlPositionProperty

Corner the GPS control is anchored to. Default TopRight.

public static readonly BindableProperty GpsControlPositionProperty

Field Value

BindableProperty

GpsFollowZoomModeProperty

How the GPS control picks the camera zoom when Follow mode engages. Default KeepCurrent.

public static readonly BindableProperty GpsFollowZoomModeProperty

Field Value

BindableProperty

GpsFollowZoomProperty

Zoom level applied when GpsFollowZoomMode is Fixed. Default 16.

public static readonly BindableProperty GpsFollowZoomProperty

Field Value

BindableProperty

ItemTemplateProperty

Bindable property for ItemTemplate.

public static readonly BindableProperty ItemTemplateProperty

Field Value

BindableProperty

ItemTemplateSelectorProperty

Bindable property for ItemTemplateSelector.

public static readonly BindableProperty ItemTemplateSelectorProperty

Field Value

BindableProperty

ItemsSourceProperty

Bindable property for ItemsSource.

public static readonly BindableProperty ItemsSourceProperty

Field Value

BindableProperty

LogoViewMarginsProperty

public static readonly BindableProperty LogoViewMarginsProperty

Field Value

BindableProperty

MapClickCommandProperty

public static readonly BindableProperty MapClickCommandProperty

Field Value

BindableProperty

MapLongClickCommandProperty

public static readonly BindableProperty MapLongClickCommandProperty

Field Value

BindableProperty

MapReadyCommandProperty

public static readonly BindableProperty MapReadyCommandProperty

Field Value

BindableProperty

MaxZoomProperty

public static readonly BindableProperty MaxZoomProperty

Field Value

BindableProperty

MinZoomProperty

public static readonly BindableProperty MinZoomProperty

Field Value

BindableProperty

MyLocationEnabledProperty

public static readonly BindableProperty MyLocationEnabledProperty

Field Value

BindableProperty

MyLocationRenderModeProperty

public static readonly BindableProperty MyLocationRenderModeProperty

Field Value

BindableProperty

MyLocationTrackingModeProperty

public static readonly BindableProperty MyLocationTrackingModeProperty

Field Value

BindableProperty

NavigationControlPositionProperty

Corner the navigation control is anchored to. Default TopRight.

public static readonly BindableProperty NavigationControlPositionProperty

Field Value

BindableProperty

RotateGesturesEnabledProperty

public static readonly BindableProperty RotateGesturesEnabledProperty

Field Value

BindableProperty

ScrollGesturesEnabledProperty

public static readonly BindableProperty ScrollGesturesEnabledProperty

Field Value

BindableProperty

ShowAttributionControlProperty

Show an always-visible attribution overlay (OSM requires this). Attributions are collected from all loaded TileJSON sources plus CustomAttribution. Default true.

public static readonly BindableProperty ShowAttributionControlProperty

Field Value

BindableProperty

ShowGpsControlProperty

Show the GPS tracking control overlay (3-state location button + bearing reset). Default true.

public static readonly BindableProperty ShowGpsControlProperty

Field Value

BindableProperty

ShowNavigationControlsProperty

Show zoom-in, zoom-out and compass/reset-north buttons. Default true.

public static readonly BindableProperty ShowNavigationControlsProperty

Field Value

BindableProperty

StyleLoadedCommandProperty

public static readonly BindableProperty StyleLoadedCommandProperty

Field Value

BindableProperty

StyleUrlProperty

public static readonly BindableProperty StyleUrlProperty

Field Value

BindableProperty

TiltGesturesEnabledProperty

public static readonly BindableProperty TiltGesturesEnabledProperty

Field Value

BindableProperty

TrackCameraPositionProperty

public static readonly BindableProperty TrackCameraPositionProperty

Field Value

BindableProperty

UiScaleProperty

Extra multiplier applied to the platform pixel ratio (display density) when the native map is created. Default 1.0. Everything sized in style pixels — text, icons, circles, line widths — scales by it, so apps can honour the OS font-scale / accessibility setting (which MapLibre otherwise ignores), e.g. by setting it to the system font scale on Android. Read once at platform-view creation; changing it on a live map has no effect.

public static readonly BindableProperty UiScaleProperty

Field Value

BindableProperty

UserLocationUpdateCommandProperty

public static readonly BindableProperty UserLocationUpdateCommandProperty

Field Value

BindableProperty

ZoomGesturesEnabledProperty

public static readonly BindableProperty ZoomGesturesEnabledProperty

Field Value

BindableProperty

Properties

AttributionButtonGravity

public int AttributionButtonGravity { get; set; }

Property Value

int

AttributionButtonMargins

public int?[]? AttributionButtonMargins { get; set; }

Property Value

int?[]

AttributionControlPosition

Corner the attribution control is anchored to. When multiple controls share a corner they stack (navigation, then GPS, then attribution).

public MapControlCorner AttributionControlPosition { get; set; }

Property Value

MapControlCorner

CameraIdleCommand

public ICommand? CameraIdleCommand { get; set; }

Property Value

ICommand

CameraMoveCommand

public ICommand? CameraMoveCommand { get; set; }

Property Value

ICommand

CameraMoveStartedCommand

public ICommand? CameraMoveStartedCommand { get; set; }

Property Value

ICommand

CameraTrackingChangedCommand

public ICommand? CameraTrackingChangedCommand { get; set; }

Property Value

ICommand

CameraTrackingDismissedCommand

public ICommand? CameraTrackingDismissedCommand { get; set; }

Property Value

ICommand

CompassGravity

public int CompassGravity { get; set; }

Property Value

int

CompassViewMargins

public int?[]? CompassViewMargins { get; set; }

Property Value

int?[]

CustomAttribution

public string? CustomAttribution { get; set; }

Property Value

string

DidBecomeIdleCommand

public ICommand? DidBecomeIdleCommand { get; set; }

Property Value

ICommand

GpsControlPosition

Corner the GPS control is anchored to. When multiple controls share a corner they stack (navigation, then GPS, then attribution).

public MapControlCorner GpsControlPosition { get; set; }

Property Value

MapControlCorner

GpsFollowZoom

Zoom level applied when GpsFollowZoomMode is Fixed. Default 16.

public double GpsFollowZoom { get; set; }

Property Value

double

GpsFollowZoomMode

How the GPS control picks the camera zoom when Follow mode engages (the on-map GPS button, or the first fix while following). KeepCurrent preserves the historical behaviour; Accuracy zooms so the fix's accuracy circle is comfortably visible; Fixed always uses GpsFollowZoom. Later fixes never change the zoom, so a manual pinch zoom sticks.

public GpsFollowZoomMode GpsFollowZoomMode { get; set; }

Property Value

GpsFollowZoomMode

IsStyleLoaded

true once the map's style has finished loading (the StyleLoaded event has fired at least once). Declarative overlay elements use this to materialise immediately when they are added after the map is already ready.

public bool IsStyleLoaded { get; }

Property Value

bool

ItemTemplate

The template used to create an overlay element for each item in ItemsSource. The template must produce a MapOverlayElement.

public DataTemplate? ItemTemplate { get; set; }

Property Value

DataTemplate?

ItemTemplateSelector

Selects a template per item. Set this instead of (not in addition to) ItemTemplate when items need different overlay templates.

public DataTemplateSelector? ItemTemplateSelector { get; set; }

Property Value

DataTemplateSelector?

ItemsSource

A collection of model objects rendered as declarative overlay elements. Each item is materialised via ItemTemplate (or ItemTemplateSelector) into a MapOverlayElement (e.g. a Pin) whose BindingContext is the item. If the source implements INotifyCollectionChanged, additions and removals are tracked automatically. Mirrors Microsoft.Maui.Controls.Maps.Map.ItemsSource.

public IEnumerable? ItemsSource { get; set; }

Property Value

IEnumerable

LogoViewMargins

public int?[]? LogoViewMargins { get; set; }

Property Value

int?[]

MapClickCommand

public ICommand? MapClickCommand { get; set; }

Property Value

ICommand

MapLongClickCommand

public ICommand? MapLongClickCommand { get; set; }

Property Value

ICommand

MapReadyCommand

public ICommand? MapReadyCommand { get; set; }

Property Value

ICommand

MaxZoom

public float MaxZoom { get; set; }

Property Value

float

MinZoom

public float MinZoom { get; set; }

Property Value

float

MyLocationEnabled

public bool MyLocationEnabled { get; set; }

Property Value

bool

MyLocationRenderMode

public int MyLocationRenderMode { get; set; }

Property Value

int

MyLocationTrackingMode

public int MyLocationTrackingMode { get; set; }

Property Value

int

NavigationControlPosition

Corner the navigation control is anchored to. When multiple controls share a corner they stack (navigation, then GPS, then attribution).

public MapControlCorner NavigationControlPosition { get; set; }

Property Value

MapControlCorner

RotateGesturesEnabled

public bool RotateGesturesEnabled { get; set; }

Property Value

bool

ScrollGesturesEnabled

public bool ScrollGesturesEnabled { get; set; }

Property Value

bool

ShowAttributionControl

public bool ShowAttributionControl { get; set; }

Property Value

bool

ShowGpsControl

public bool ShowGpsControl { get; set; }

Property Value

bool

ShowNavigationControls

public bool ShowNavigationControls { get; set; }

Property Value

bool

StyleLoadedCommand

public ICommand? StyleLoadedCommand { get; set; }

Property Value

ICommand

StyleUrl

public string StyleUrl { get; set; }

Property Value

string

TiltGesturesEnabled

public bool TiltGesturesEnabled { get; set; }

Property Value

bool

TrackCameraPosition

public bool TrackCameraPosition { get; set; }

Property Value

bool

UiScale

Extra multiplier applied to the platform pixel ratio at map creation (scales all style-pixel sizes: text, icons, circles, line widths). Default 1.0. Set before the map is displayed — read once when the platform view is created.

public double UiScale { get; set; }

Property Value

double

UserLocationUpdateCommand

public ICommand? UserLocationUpdateCommand { get; set; }

Property Value

ICommand

VisibleRegion

The map region currently visible on screen, as a MapSpan. Refreshed whenever the camera becomes idle and null until the map has rendered its first frame. Mirrors Microsoft.Maui.Controls.Maps.Map.VisibleRegion.

public MapSpan? VisibleRegion { get; }

Property Value

MapSpan

ZoomGesturesEnabled

public bool ZoomGesturesEnabled { get; set; }

Property Value

bool

Methods

AddCircleLayer(string, string, string?, string?, CircleLayerProperties, float, float, bool)

public void AddCircleLayer(string layerName, string sourceName, string? belowLayerId, string? sourceLayer, CircleLayerProperties properties, float minZoom = 0, float maxZoom = 0, bool enableInteraction = false)

Parameters

layerName string
sourceName string
belowLayerId string
sourceLayer string
properties CircleLayerProperties
minZoom float
maxZoom float
enableInteraction bool

AddFillExtrusionLayer(string, string, string?, string?, FillExtrusionLayerProperties, float, float, bool)

public void AddFillExtrusionLayer(string layerName, string sourceName, string? belowLayerId, string? sourceLayer, FillExtrusionLayerProperties properties, float minZoom = 0, float maxZoom = 0, bool enableInteraction = false)

Parameters

layerName string
sourceName string
belowLayerId string
sourceLayer string
properties FillExtrusionLayerProperties
minZoom float
maxZoom float
enableInteraction bool

AddFillLayer(string, string, string?, string?, FillLayerProperties, float, float, bool)

public void AddFillLayer(string layerName, string sourceName, string? belowLayerId, string? sourceLayer, FillLayerProperties properties, float minZoom = 0, float maxZoom = 0, bool enableInteraction = false)

Parameters

layerName string
sourceName string
belowLayerId string
sourceLayer string
properties FillLayerProperties
minZoom float
maxZoom float
enableInteraction bool

AddGeoJsonSource(string, FeatureCollection)

public void AddGeoJsonSource(string sourceName, FeatureCollection collection)

Parameters

sourceName string
collection FeatureCollection

AddHeatmapLayer(string, string, string?, HeatmapProperties, float, float)

public void AddHeatmapLayer(string layerName, string sourceName, string? belowLayerId, HeatmapProperties properties, float minZoom = 0, float maxZoom = 0)

Parameters

layerName string
sourceName string
belowLayerId string
properties HeatmapProperties
minZoom float
maxZoom float

AddImageSource(string, string, LatLngQuad?)

public void AddImageSource(string sourceName, string imageUri, LatLngQuad? coordinates)

Parameters

sourceName string
imageUri string
coordinates LatLngQuad

AddLineLayer(string, string, string?, string?, LineLayerProperties, float, float, bool)

public void AddLineLayer(string layerName, string sourceName, string? belowLayerId, string? sourceLayer, LineLayerProperties properties, float minZoom = 0, float maxZoom = 0, bool enableInteraction = false)

Parameters

layerName string
sourceName string
belowLayerId string
sourceLayer string
properties LineLayerProperties
minZoom float
maxZoom float
enableInteraction bool

AddRasterDemSource(string, string?, string[]?, int, int, int)

public void AddRasterDemSource(string sourceName, string? tileUrl, string[]? tileUrlTemplates, int tileSize, int minZoom, int maxZoom)

Parameters

sourceName string
tileUrl string
tileUrlTemplates string[]
tileSize int
minZoom int
maxZoom int

AddRasterLayer(string, string, string?, RasterLayerProperties, float, float)

public void AddRasterLayer(string layerName, string sourceName, string? belowLayerId, RasterLayerProperties properties, float minZoom = 0, float maxZoom = 0)

Parameters

layerName string
sourceName string
belowLayerId string
properties RasterLayerProperties
minZoom float
maxZoom float

AddRasterSource(string, string?, string[]?, int, int, int)

public void AddRasterSource(string sourceName, string? tileUrl, string[]? tileUrlTemplates, int tileSize, int minZoom, int maxZoom)

Parameters

sourceName string
tileUrl string
tileUrlTemplates string[]
tileSize int
minZoom int
maxZoom int

AddSpriteImage(string, int, int, byte[], float, bool)

Register a named sprite image for use with icon-image in SymbolLayers. rgba must be width × height × 4 bytes of premultiplied RGBA.

public void AddSpriteImage(string imageId, int width, int height, byte[] rgba, float pixelRatio = 1, bool sdf = false)

Parameters

imageId string
width int
height int
rgba byte[]
pixelRatio float
sdf bool

AddSymbolLayer(string, string, string?, string?, SymbolLayerProperties, float, float, bool)

public void AddSymbolLayer(string layerName, string sourceName, string? belowLayerId, string? sourceLayer, SymbolLayerProperties properties, float minZoom = 0, float maxZoom = 0, bool enableInteraction = false)

Parameters

layerName string
sourceName string
belowLayerId string
sourceLayer string
properties SymbolLayerProperties
minZoom float
maxZoom float
enableInteraction bool

AddVectorSource(string, string?, string[]?, int, int)

public void AddVectorSource(string sourceName, string? tileUrl, string[]? tileUrlTemplates, int minZoom, int maxZoom)

Parameters

sourceName string
tileUrl string
tileUrlTemplates string[]
minZoom int
maxZoom int

GetVisibleRegion()

Reads the map's currently visible region on demand. Returns null when the handler is not connected or the map is not yet ready.

public MapSpan? GetVisibleRegion()

Returns

MapSpan

LatLngToScreenPoint(double, double)

Converts a geographic coordinate to a screen point (physical pixels).

public (double X, double Y) LatLngToScreenPoint(double latitude, double longitude)

Parameters

latitude double
longitude double

Returns

(double X, double Y)

QueryRenderedFeaturesInBox(double, double, double, double, string?)

Returns GeoJSON of rendered features within the given screen-space box.

public string? QueryRenderedFeaturesInBox(double x1, double y1, double x2, double y2, string? layerIds = null)

Parameters

x1 double
y1 double
x2 double
y2 double
layerIds string

Returns

string

QueryRenderedFeaturesInBox(double, double, double, string?)

Returns GeoJSON of rendered features within a box centred on (cx, cy) with thresholdPx pixels on each side, optionally filtered to layerIds.

public string? QueryRenderedFeaturesInBox(double cx, double cy, double thresholdPx = 5, string? layerIds = null)

Parameters

cx double
cy double
thresholdPx double
layerIds string

Returns

string

RemoveLayer(string)

Removes a layer previously added to the style. No-op if it does not exist.

public void RemoveLayer(string layerId)

Parameters

layerId string

RemoveSource(string)

Removes a source previously added to the style. No-op if it does not exist.

public void RemoveSource(string sourceName)

Parameters

sourceName string

RemoveSpriteImage(string)

Remove a sprite image previously registered with AddSpriteImage(string, int, int, byte[], float, bool).

public void RemoveSpriteImage(string imageId)

Parameters

imageId string

SetGeoJsonSource(string, FeatureCollection)

Replaces the GeoJSON data of an existing source.

public void SetGeoJsonSource(string sourceName, FeatureCollection collection)

Parameters

sourceName string
collection FeatureCollection

Events

CameraIdle

public event EventHandler? CameraIdle

Event Type

EventHandler?

CameraMove

public event EventHandler? CameraMove

Event Type

EventHandler?

CameraMoveStarted

public event EventHandler<CameraMoveStartedEventArgs>? CameraMoveStarted

Event Type

EventHandler<CameraMoveStartedEventArgs>?

CameraTrackingChanged

public event EventHandler<CameraTrackingChangedEventArgs>? CameraTrackingChanged

Event Type

EventHandler<CameraTrackingChangedEventArgs>?

CameraTrackingDismissed

public event EventHandler? CameraTrackingDismissed

Event Type

EventHandler?

DidBecomeIdle

public event EventHandler? DidBecomeIdle

Event Type

EventHandler?

MapClick

public event EventHandler<MapClickEventArgs>? MapClick

Event Type

EventHandler<MapClickEventArgs>?

MapLongClick

public event EventHandler<MapClickEventArgs>? MapLongClick

Event Type

EventHandler<MapClickEventArgs>?

MapReady

public event EventHandler<MapReadyEventArgs>? MapReady

Event Type

EventHandler<MapReadyEventArgs>?

StyleLoaded

public event EventHandler<StyleLoadedEventArgs>? StyleLoaded

Event Type

EventHandler<StyleLoadedEventArgs>?

UserLocationUpdate

public event EventHandler<UserLocationUpdateEventArgs>? UserLocationUpdate

Event Type

EventHandler<UserLocationUpdateEventArgs>?