Class MapLibreMap
- Namespace
- MapLibreNative.Maui.Handlers
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
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
CameraIdleCommand
public ICommand? CameraIdleCommand { get; set; }
Property Value
CameraMoveCommand
public ICommand? CameraMoveCommand { get; set; }
Property Value
CameraMoveStartedCommand
public ICommand? CameraMoveStartedCommand { get; set; }
Property Value
CameraTrackingChangedCommand
public ICommand? CameraTrackingChangedCommand { get; set; }
Property Value
CameraTrackingDismissedCommand
public ICommand? CameraTrackingDismissedCommand { get; set; }
Property Value
CompassGravity
public int CompassGravity { get; set; }
Property Value
CompassViewMargins
public int?[]? CompassViewMargins { get; set; }
Property Value
- int?[]
CustomAttribution
public string? CustomAttribution { get; set; }
Property Value
DidBecomeIdleCommand
public ICommand? DidBecomeIdleCommand { get; set; }
Property Value
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
GpsFollowZoom
Zoom level applied when GpsFollowZoomMode is Fixed. Default 16.
public double GpsFollowZoom { get; set; }
Property Value
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
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
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
LogoViewMargins
public int?[]? LogoViewMargins { get; set; }
Property Value
- int?[]
MapClickCommand
public ICommand? MapClickCommand { get; set; }
Property Value
MapLongClickCommand
public ICommand? MapLongClickCommand { get; set; }
Property Value
MapReadyCommand
public ICommand? MapReadyCommand { get; set; }
Property Value
MaxZoom
public float MaxZoom { get; set; }
Property Value
MinZoom
public float MinZoom { get; set; }
Property Value
MyLocationEnabled
public bool MyLocationEnabled { get; set; }
Property Value
MyLocationRenderMode
public int MyLocationRenderMode { get; set; }
Property Value
MyLocationTrackingMode
public int MyLocationTrackingMode { get; set; }
Property Value
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
RotateGesturesEnabled
public bool RotateGesturesEnabled { get; set; }
Property Value
ScrollGesturesEnabled
public bool ScrollGesturesEnabled { get; set; }
Property Value
ShowAttributionControl
public bool ShowAttributionControl { get; set; }
Property Value
ShowGpsControl
public bool ShowGpsControl { get; set; }
Property Value
ShowNavigationControls
public bool ShowNavigationControls { get; set; }
Property Value
StyleLoadedCommand
public ICommand? StyleLoadedCommand { get; set; }
Property Value
StyleUrl
public string StyleUrl { get; set; }
Property Value
TiltGesturesEnabled
public bool TiltGesturesEnabled { get; set; }
Property Value
TrackCameraPosition
public bool TrackCameraPosition { get; set; }
Property Value
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
UserLocationUpdateCommand
public ICommand? UserLocationUpdateCommand { get; set; }
Property Value
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
ZoomGesturesEnabled
public bool ZoomGesturesEnabled { get; set; }
Property Value
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
layerNamestringsourceNamestringbelowLayerIdstringsourceLayerstringpropertiesCircleLayerPropertiesminZoomfloatmaxZoomfloatenableInteractionbool
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
layerNamestringsourceNamestringbelowLayerIdstringsourceLayerstringpropertiesFillExtrusionLayerPropertiesminZoomfloatmaxZoomfloatenableInteractionbool
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
layerNamestringsourceNamestringbelowLayerIdstringsourceLayerstringpropertiesFillLayerPropertiesminZoomfloatmaxZoomfloatenableInteractionbool
AddGeoJsonSource(string, FeatureCollection)
public void AddGeoJsonSource(string sourceName, FeatureCollection collection)
Parameters
sourceNamestringcollectionFeatureCollection
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
layerNamestringsourceNamestringbelowLayerIdstringpropertiesHeatmapPropertiesminZoomfloatmaxZoomfloat
AddImageSource(string, string, LatLngQuad?)
public void AddImageSource(string sourceName, string imageUri, LatLngQuad? coordinates)
Parameters
sourceNamestringimageUristringcoordinatesLatLngQuad
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
layerNamestringsourceNamestringbelowLayerIdstringsourceLayerstringpropertiesLineLayerPropertiesminZoomfloatmaxZoomfloatenableInteractionbool
AddRasterDemSource(string, string?, string[]?, int, int, int)
public void AddRasterDemSource(string sourceName, string? tileUrl, string[]? tileUrlTemplates, int tileSize, int minZoom, int maxZoom)
Parameters
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
layerNamestringsourceNamestringbelowLayerIdstringpropertiesRasterLayerPropertiesminZoomfloatmaxZoomfloat
AddRasterSource(string, string?, string[]?, int, int, int)
public void AddRasterSource(string sourceName, string? tileUrl, string[]? tileUrlTemplates, int tileSize, int minZoom, int maxZoom)
Parameters
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
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
layerNamestringsourceNamestringbelowLayerIdstringsourceLayerstringpropertiesSymbolLayerPropertiesminZoomfloatmaxZoomfloatenableInteractionbool
AddVectorSource(string, string?, string[]?, int, int)
public void AddVectorSource(string sourceName, string? tileUrl, string[]? tileUrlTemplates, int minZoom, int maxZoom)
Parameters
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
LatLngToScreenPoint(double, double)
Converts a geographic coordinate to a screen point (physical pixels).
public (double X, double Y) LatLngToScreenPoint(double latitude, double longitude)
Parameters
Returns
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
Returns
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
Returns
RemoveLayer(string)
Removes a layer previously added to the style. No-op if it does not exist.
public void RemoveLayer(string layerId)
Parameters
layerIdstring
RemoveSource(string)
Removes a source previously added to the style. No-op if it does not exist.
public void RemoveSource(string sourceName)
Parameters
sourceNamestring
RemoveSpriteImage(string)
Remove a sprite image previously registered with AddSpriteImage(string, int, int, byte[], float, bool).
public void RemoveSpriteImage(string imageId)
Parameters
imageIdstring
SetGeoJsonSource(string, FeatureCollection)
Replaces the GeoJSON data of an existing source.
public void SetGeoJsonSource(string sourceName, FeatureCollection collection)
Parameters
sourceNamestringcollectionFeatureCollection
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>?