Skip to content

tuyen-vuduc/mapbox-maui

Repository files navigation

Mapbox for MAUI

A dedicated library and starting sample for integrating Mapbox into your MAUI application.

Installation

Install-Package Mapbox.Maui --version 11.1.0-alpha01

Integrate into your project

Please check out my step-by-step blog post for more details.

How to run the examples

Prerequisites

  • Visual Studio for Mac or Visual Studio for Windows
  • .NET 7.0.306
  • .NET workloads for iOS, Android, MAUI

Steps

  • 1/ Generate/grab MAPBOX_DOWNLOADS_TOKEN from your Mapbox account page

  • 2/ Android: Put it into your local ~/.gradle/gradle.properties

echo "MAPBOX_DOWNLOADS_TOKEN=YOUR_MAPBOX_DOWNLOADS_TOKEN" >> ~/.gradle/gradle.properties
  • 3/ Make a copy of MapboxMauiQs.props.template
    • Name it MapboxMauiQs.props
    • Replace YOUR_MAPBOX_DOWNLOADS_TOKEN with yours in MapboxMauiQs.props file
  • 4/ Grab mapbox_access_token from your Mapbox account page
    • Make a copy of MauiProgram.dev.cs.template
    • Name it MauiProgram.dev.cs
    • Replace YOUR_MAPBOX_ACCESS_TOKEN with yours in MauiProgram.dev.cs file

Files with ignored

  • 5/ Run the solution

Ported Examples

# Example Ported (18/66)
1 AddMarkersSymbol OK
2 AddOneMarkerSymbol OK
3 AdvancedViewportGestures
4 AnimateGeoJSONLine
5 AnimateImageLayer
6 AnimateLayer
7 AnimatedMarker OK
8 BasicLocationPulsing
9 BasicMap OK
10 BuildingExtrusions OK
11 CameraAnimation
12 CameraAnimators
13 CircleAnnotation OK
14 ColorExpression
15 Custom2DPuck
16 Custom3DPuck
17 CustomLayer
18 CustomLocationProvider
19 CustomPointAnnotation OK
20 CustomStyleURL OK
21 DataDrivenSymbols
22 DataJoin
23 DebugMap OK
24 DistanceExpression
25 ExternalVectorSource
26 FeatureState
27 FeaturesAtPoint
28 FrameViewAnnotations
29 Globe
30 GlobeFlyTo
31 HeatmapLayerGlobe
32 IconSizeChange OK
33 LargeGeoJSONPerformance
34 LayerPosition
35 LineAnnotation OK
36 LineGradient
37 LiveData
38 Localization
39 MultipleGeometries OK
40 NavigationSimulator
41 OfflineManager OK
42 OfflineRegionManager
43 PitchAndDistance
44 PointAnnotationClustering OK
45 PointClustering
46 PolygonAnnotation OK
47 RasterTileSource
48 ResizableImage
49 RestrictCoordinateBounds
50 SceneKit N/A
51 ShowHideLayer
52 SkyLayer OK
53 SnapshotterCoreGraphics
54 Snapshotter
55 SpinningGlobe
56 StoryboardMapView N/A
57 SwitchStyles
58 SymbolClustering OK
59 Terrain OK
60 TrackingMode
61 ViewAnnotationAnimation
62 ViewAnnotationBasic
63 ViewAnnotationMarker
64 ViewAnnotationWithPointAnnotation
65 Viewport
66 VoiceOverAccessibility

NOTE: A handy command to generate a new example

dotnet cake -- --name SymbolClustering --index 58 --group Annotations --title "Add Cluster Symbol Annotations" --subtitle "Show fire hydrants in Washington DC area in a cluster using a symbol layer."

Features

GestureSettings

# Android iOS Aligned
1 rotateEnabled rotateEnabled YES
2 scrollEnabled panEnabled NOPE
3 scrollMode panMode NOPE
4 simultaneousRotateAndPinchToZoomEnabled simultaneousRotateAndPinchZoomEnabled NOPE
5 doubleTouchToZoomOutEnabled doubleTouchToZoomOutEnabled YES
6 doubleTapToZoomInEnabled doubleTapToZoomInEnabled YES
7 focalPoint focalPoint YES
8 pitchEnabled pitchEnabled YES
9 quickZoomEnabled quickZoomEnabled YES
10 pinchScrollEnabled pinchScrollEnabled YES
11 pinchToZoomEnabled N/A NOPE, pinchEnabled & pinchZoomEnabled
12 pinchToZoomDecelerationEnabled N/A NOPE
13 rotateDecelerationEnabled N/A NOPE
14 scrollDecelerationEnabled N/A NOPE
15 increaseRotateThresholdWhenPinchingToZoom N/A NOPE
16 increasePinchToZoomThresholdWhenRotating N/A NOPE
17 zoomAnimationAmount N/A NOPE
18 N/A pinchEnabled NOPE
19 N/A pinchZoomEnabled NOPE
20 N/A panDecelerationFactor NOPE

NOTES

  1. Failed to delete .gradle folder Due to Java process not killed gratefully.
taskkill -F -im java.exe
  1. Xamarin.Build.Download Xamarin.Build.Download is a tool to help download artifacts from remote URL to avoid embedding the native artifacts within the NuGet package with advantages
  • Very thin and lightweight NuGet package
  • Avoid any license viloation if the owner of the native lib doesn't want us to redistribute their lib

The downloaded artifact will be located at

  • MacOS: ~/Library/Caches/XamarinBuildDownload
  • Windows: %USERPROFILE%/AppData/Local/XamarinBuildDownloadCache
  1. Kill all .NET processes
taskkill -F -im dotnet.exe

Maintainer

This project is maintained by tuyen-vuduc in his spare time and/or when requested.

If you find this project is helpful and benefit your work/business, please give it a star, become a sponsor of the project and/or buy him a coffee.

"Buy Me A Coffee"

LICENSE

This library is release under The BSD 3-Clause License. You are freely to use and make changes. However, this license doesn't override the license from Mapbox.