Maps in .Net Maui

Squires,Steven 20 Reputation points
2024-02-26T18:47:51.5566667+00:00

My question is simple, should I be using Google Maps or Azure Maps in my mobile app at this point? Also, where is the best documentation or video archive for adding a map to my "cross platform" application? Has anyone provided an example that covers ALL the available platforms, because I am always running into Nuget issues at this point.

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
587 questions
{count} votes

Accepted answer
  1. rbrundritt 15,231 Reputation points Microsoft Employee
    2024-02-26T22:54:49.1533333+00:00

    Well, it really depends on the type of map application you are creating. If you simply need a flat map with a couple of pins and limited customizations, then leveraging the native map controls built into each mobile platform makes sense as that scenario generally fall under the free usage limits of those platforms. Documentation on this approach with .NET Maui can be found here: https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/map?view=net-maui-8.0 Note that you don't have to use the geocoding/routing services of those platforms, you can use REST services from other platforms as well if desired. Azure Maps does have native map controls for Android and iOS. There is also the native Windows map control that uses the same data as Azure Maps for roads/satellite imagery, but also has 3D map capabilities if needed (https://blog.verslu.is/maui/windows-maps-dotnet-maui/). You can use these in a .NET Maui app but would need to write code for each platform. The Android and iOS SDK's are nearly identical so code reuse can be done, but you would need to create bindings for this controls (I don't believe there are any out in the wild currently, I could be wrong): https://learn.microsoft.com/en-us/xamarin/ios/platform/binding-objective-c/
    https://learn.microsoft.com/en-us/xamarin/android/platform/binding-java-library/ That said, if you want to create a complex map app with a lot of customizations native map APIs are often tougher to work with and don't have as many features as web-based map controls. If you look at any map platform, their web SDK's have a ton more features than their native SDKs. The Azure Maps Web SDK uses WebGL for rendering, so it uses native rendering capabilities and to be honest, you can often get better performance from a web-based map control than most native ones due to the lightweight nature of web maps. It's also usually a lot faster to develop with a web map than a native one, assuming you have web development experience. Embedding a web map into a .NET Maui WebView is fairly easy, and you can use interop to communicate between JavaScript and C#. I've used this approach with many of the largest companies in the world to create rich map apps quickly. In fact I'm creating an app at the moment that has a rich 3D environment more detailed than Microsoft flight simulator and am using a web based map control as the rendering engine ad am able to run this on a low powered device. I'm using Cesium JS 3D web map control with a ton of custom data. You could use the Azure Maps Web SDK, or some other web map control with Azure Maps data. If you go the web route, I recommend using this library: https://github.com/Eilon/MauiHybridWebView as it has a lot more interop capabilities.

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 55,601 Reputation points
    2024-02-26T23:04:43+00:00

    The best user experience is the native maps app:

    • IOS - apple maps
    • Android - google maps

    as suggested just use the native sdk.

    1 person found this answer helpful.
    0 comments No comments