Skip to main content

Basic map

The Mobile Maps SDK examples require that you first complete the initial project set-up.

Add a map to your application. Right out of the box, the map displays geographic boundaries, street names, road data, and more. The map can be then be styled, moved, and rotated.

Basic map

BaseLayer.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="TrimbleMaps.MapSDK.Sample.BaseLayer"
             Title="BaseLayer" xmlns:TrimbleMaps="clr-namespace:TrimbleMaps.Controls.Forms;assembly=TrimbleMaps.MapsSDK" >
    <ContentPage.Content>
        <TrimbleMaps:MapView
            x:Name="Map"
            ShowUserLocation="true"
            UserLocationTracking="None"
            ZoomMaxLevel="21"
            CompassEnabled="True"
            CompassFadeFacingNorth="False"
            />
    </ContentPage.Content>
</ContentPage>

BaseLayer.xaml.cs

using TrimbleMaps.Controls.Forms;

namespace TrimbleMaps.MapSDK.Sample
{
    public partial class BaseLayer : ContentPage
    {
        public BaseLayer()
        {
            InitializeComponent();
            Setup();
        }

        private void Setup()
        {
            Map.Center = new TrimbleMaps.MapsSDK.LatLng(40.7135, -74.0066);
            Map.ZoomMinLevel = 10;
            Map.MapStyle = MapStyle.MOBILE_DAY;
        }
    }
}
Last updated February 4, 2025.