Search code examples
google-mapsblazorblazor-hybrid

How to display an interactive map on a page of a .NET 6 Blazor Hybrid application?


It looks like cross-platform maps for .NET 7 MAUI are built in, but is there any way to get maps working on .NET 6?

I know I can use the IMap and IGeolocation interfaces to open the device's maps application with some relevant coordinates, or calculate distances between locations, but I'd like to display a map directly on the page. I'd also want to interact with features such as adding pins and geofences. I've looked around but I'm unable to find a solution.


Solution

  • A solution I found was GeoBlazor. It is an open-source package that displays a map with many functionalities. Unfortunately, it requires a subscription to ArcGIS API, which you have to pay for if your usage goes outside their free tier.

    However, I realized something that should have been obvious - as long as there is an API, I can use any service, such as Google maps, across all the platforms.

    Thankfully, a third-party service won't be necessary anymore as .NET MAUI will have cross-platform maps built in starting from .NET 7.