In our latest GeoMarvel Live demonstration, Harman Hassan showcased how to display a Mobile Map Package (MMPK) in .NET MAUI. MMPKs represent a specific feature within Esri’s suite of GIS tools and services. They are designed to package and distribute maps in a compact and efficient format that can be easily displayed on smartphones, tablets, and other mobile platforms. Before diving into the demonstration, it is important to understand the difference between Microsoft .NET, and .NET MAUI.
Microsoft .NET is a powerful and cross-platform framework used for creating a wide range of applications, including web, desktop, mobile, gaming, and IoT. It offers a consistent programming model and a rich set of tools, supporting multiple languages. .NET MAUI (Multi-platform App UI), on the other hand, is an advanced version of Xamarin that empowers developers to build cross-platform mobile apps using .NET. It enables code sharing across various platforms and leverages XAML and C# for seamless UI creation and logic implementation.
With .NET MAUI, developers can achieve improved performance, simplified project structure, and streamlined development, leading to enhanced code sharing and an exceptional multi-platform user experience.
Now, let’s focus on the process of displaying a mobile map package (MMPK) in .NET MAUI. To begin, developers must install the Esri ArcGIS Runtime MAUI package and the Esri ArcGIS Runtime toolkit for MAUI. These packages are essential for the task at hand. Once installed, the application needs to be configured accordingly, including passing an API key or authenticating with ArcGIS credentials.
To set up the display of the MMPK, specific actions are taken in both the main page XAML file and the main page XAML CS file. In the XAML file, the Esri UI namespace is set, allowing the call to the Esri UI control called “my map view” responsible for visualizing the map. This control is then wrapped within a grid for proper layout. In the CS file, necessary namespaces are imported, an initialization function (init) is created, and the path to the MMPK is specified.
The MMPK is added to the project, ensuring it is easily referenced. This involves placing the MMPK at the top level of the project and setting the appropriate build action to content. With these steps completed, a mobile map package variable, “Mahou MMPK,” is created to initialize a new instance of the mobile map package class. The content of the MMPK is then read, and the map within the “my map view” control is set to the first or default map.
Taking things a step further, users have the option to add a base map by providing an API key or authenticating with ArcGIS credentials. This additional step enhances the functionality and visual appeal of the application.
By harnessing the capabilities of Microsoft .NET and .NET MAUI, developers gain the ability to create versatile and cross-platform applications. Displaying a mobile map package in .NET MAUI involves a series of steps, including package installation, configuration, UI control setup, MMPK referencing, and optional base map additions. This process allows for the creation of highly functional and visually appealing applications that can be enjoyed seamlessly across multiple platforms.
Are you seeking professional support services for your organization? We offer a comprehensive range of services, from Mobile Application Development to Technical Consulting. Whether you require assistance in developing or need expert guidance for technical challenges, our team is dedicated to providing the highest level of support. Start a conversation today and let our team help take your organization to new heights!