Map API methods (selected)
The MapLibre component wraps MapLibre GL JS 6.11.2. Key methods:
Style and terrain
SetStyle(OneOf<JsonObject, string>, SetStyleOptions?)— pass{ Diff = true }for incremental style updates (style.loadfires); supports bulk transactionsNativeMap— rawmaplibregl.MapJS handle for calling unwrapped MapLibre GL JS methodsAddControl(type, position?, options?)— returns control handle forHasControl/RemoveControl;optionsgo to the control constructor (e.g.FullscreenControlOptions.Pseudo)GetStyleAsJsonElement()— typed style readGetStyleUrl()— style URL, ornullfor object styles (MapLibre 6.8+)SetFontFaces/GetFontFaces— stylefont-facesfor complex scripts (MapLibre 6.7+); also onStyleSpecification.FontFacesSetTerrain(TerrainSpecification?),SetSky,SetLightSetPaintProperty,SetLayoutProperty,SetGlobalStateProperty
GeoJSON
SetSourceData/SetSourceDataAsJson/SetSourceDataAsync— await MapLibresetData()Promise (v6)UpdateSourceData/UpdateSourceDataAsync— awaitupdateData()Promise (nowaitForCompletionflag)GetGeoJsonDataAsync,GetGeoJsonBoundsAsync,GetClusterOptionsAsync,SetClusterOptionsAsync
Camera and time
CalculateAnchoredCameraOptions(AnchoredCameraOptions)— camera options that place an anchor at a screen point (MapLibre 6.11+)SetTransformConstrain/TransformConstrainparameter on the componentSetTransformRequest— customize tile/glyph/sprite HTTP requests from C#; returnTransformRequestResultwith only the MapLibreRequestParametersfields you need (url, optionalheaders,credentials,referrerPolicy, etc.)- Prefer JS-only transform policy for tile hot path
SetEventedParent— bubble events to another map by itsMapIdTimeControlSetNow,TimeControlRestoreNow,TimeControlIsFrozen(top-levelsetNow/restoreNow/isTimeFrozenin MapLibre 6)
Query
QueryRenderedFeatures/QuerySourceFeatures— returnIFeature[]QueryRenderedLayerFeatures— typedLayerFeatureFeature[]withlayermetadata
Layers
HasLayer,HasSource,GetLayerAsLayer,GetSourceAsSourceSetLayerZoomRange,MoveLayer(id, beforeId?)GetFilter— returnsJsonElement?;GetGlobalStatePropertySetPitch,SetRoll,SetPadding,SetMaxBounds(LngLatBounds?),SetMaxZoom,SetMinZoom,SetMaxPitch,SetMinPitch,SetRenderWorldCopies,SetVerticalFieldOfViewFillExtrusionLayerLayout.FillExtrusionRoundedCornerDistance(MapLibre 6.2+);SymbolLayerLayout.SymbolHeightOffset/SymbolHeightAnchor(MapLibre 6.6+)SetGlyphs,SnapToNorth,TriggerRepaintsloton baseLayer;CustomLayerstyle model
Custom layers
AddCustomLayer(layerId, CustomLayerOptions, CustomLayerHandler, beforeId?)—OnRender/OnPrerenderreceivemodelViewProjectionMatrix(16 floats) from MapLibre 6CustomRenderMethodInput
Images / raster
SetMissingStyleImageResolver— supply missing sprite/style images (MapLibre 6+; replaces resolving viaOnStyleImageMissing+AddImage)UpdateImageSourceAsync(URL) /UpdateImageSourceWithImageAsync(decoded bitmap, MapLibre 6.1+)SetRasterPremultiplyAlphaAsyncSetSourceWarpAsync/GetSourceWarpAsync(ImageSourceWarp, MapLibre 6.5+)
Container
SetContainer(element)— pass anHTMLElementfrom another window (iframe) before first render.
Map options (selected)
ZoomLevelsToOverscale(JSONzoomLevelsToOverscale; MapLibre 6 default is4)RotateSpeed,PitchSpeed,AnisotropicFilterPitch,TerrainSkirtLength,AroundCenter- WebGL2 is required (WebGL1 path removed in MapLibre 6)
Default style
MapOptions.Style defaults to MapStyle.OpenStreetMap.Standard.ToStylePayload().
Events
AddListener<T>,AddOnceListener<T>— generic subscriptions; optionalthrottleMsfor high-frequency events; returnsListenerwith workingRemove().RemoveAllListeners(eventName?)— detach all listeners on this map.- Convenience:
OnClick,OnContextMenu,OnDblClick,OnMouseDown/OnMouseUp/OnMouseEnter/OnMouseLeave,OnMoveStart/OnMove/OnMoveEnd, cameraOnRotate*/OnPitch*/OnRoll*,OnBoxZoom*,OnWebGlContext*,OnWheel,OnRender, … - Event payloads use the base types
MapDataEvent,MapMoveEvent, andMapZoomEvent. MapEvent.GetOriginalDomEvent()for typed DOM fields fromoriginalEvent- Use
MapEventNamesfor event name constants.
Marker and Popup
- Marker
Opacity/OpacityWhenCoveredaccept string or number - See event listeners doc for Marker/Popup handles