New to Telerik UI for .NET MAUI? Start a free 30-day trial

Getting Started with the .NET MAUI Map

This guide provides the information you need to start using the Telerik UI for .NET MAUI Map by adding the control to your project.

At the end, you will achieve the following result.

.NET MAUI Map Getting Started

Prerequisites

Before adding the Map, you need to:

  1. Set up your .NET MAUI application.

  2. Download Telerik UI for .NET MAUI.

  3. Install Telerik UI for .NET MAUI.

The Map is rendered through the SkiaSharp graphics library.

Define the Control

  1. When your .NET MAUI application is set up, you are ready to add a Map control to your page.

    <telerik:RadMap x:Name="map" AutomationId="map">
      <telerik:RadMap.Layers>
          <telerik:ShapefileLayer>
              <telerik:ShapefileLayer.Reader>
                  <telerik:MapShapeReader x:Name="reader"/>
              </telerik:ShapefileLayer.Reader>
          </telerik:ShapefileLayer>
      </telerik:RadMap.Layers>
    </telerik:RadMap>
    
  2. Add the following namespace:

     xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
    
  3. RadMap uses .shp files that contain the coordinates of the shapes that will be drawn by the map and an optional .dbf file for each .shp file with additional attributes of the shapes.

    You need to assign the .shp file containing the data through the Source property of the MapShapeReader like this:

    var assembly = this.GetType().Assembly;
    var source = MapSource.FromResource("SDKBrowserMaui.Examples.MapControl.world.shp", assembly);
    this.reader.Source = source;
    

    In the example the .shp file is loaded as an EmbeddedResource, other options can be used as well, please check them in the ShapefileLayer topic.

Additional Resources

See Also

In this article