maui-maps

Map guidance for .NET MAUI using Microsoft.Maui.Controls.Maps. Covers adding the map control, pins, polygons, polylines, geocoding, Google Maps API key configuration, and platform setup, including map initialization, reverse geocoding, and setting map regions. Applicable to adding maps, map controls, pins, polygons, polylines, geocoding, and Google Maps API key configuration. Not for obtaining device GPS coordinates (use maui-geolocation), custom drawn overlays (use maui-graphics-drawing), or location-permission-only handling (use maui-permissions).

Last repository push
GitHub Stars
181
Forks
21
Issues / PRs
1

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "maui-maps" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-5f8690d26ffcfd76232890abda66a8f8a341138205e0d31addce2d1b0ce49d26. Verify the upstream source and version against https://github.com/davidortinau/maui-skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Map guidance for .NET MAUI using Microsoft.Maui.Controls.Maps. Covers adding the map control, pins, polygons, polylines, geocoding, Google Maps API key configuration, and platform setup, including map initialization, reverse geocoding, and setting map regions. Applicable to adding maps, map controls, pins, polygons, polylines, geocoding, and Google Maps API key configuration. Not for obtaining device GPS coordinates (use maui-geolocation), custom drawn overlays (use maui-graphics-drawing), or location-permission-only handling (use maui-permissions).

0 Downloads

Introduction source: third_party · davidortinau · 0.0.1 Reference

SkillPi interpretation

Tasks
`Microsoft.Maui.Controls.Maps.Map` conflicts with `Microsoft.Maui.ApplicationModel.Map`. This causes confusing compile errors.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: maui-maps
description: >
  Guidance for adding map controls, pins, polygons, polylines, geocoding,
  Google Maps API key configuration, and platform setup in .NET MAUI apps
  using Microsoft.Maui.Controls.Maps.
  USE FOR: "add map", "map control", "map pins", "polygons on map", "polylines",
  "geocoding", "Google Maps API key", "Microsoft.Maui.Controls.Maps", "map setup",
  "reverse geocoding", "map region".
  DO NOT USE FOR: getting device GPS coordinates (use maui-geolocation),
  custom drawing overlays (use maui-graphics-drawing), or location permissions only (use maui-permissions).

.NET MAUI Maps

Common gotchas

Issue Fix
Map is blank on Android Google Maps API key missing or wrong in AndroidManifest.xml
Map crashes on startup .UseMauiMaps() not called in MauiProgram.cs
Map type ambiguous Conflicts with Microsoft.Maui.ApplicationModel.Map — add namespace alias
Map doesn't show on Windows Windows has no native support — must use CommunityToolkit.Maui.Maps
User location dot missing IsShowingUser="True" set but location permission not granted
Android 11+ can't launch external map app Missing <queries> for geo scheme in manifest

⚠️ Name conflict — always alias

Microsoft.Maui.Controls.Maps.Map conflicts with Microsoft.Maui.ApplicationModel.Map. This causes confusing compile errors.

// ✅ Correct — explicit alias
using Map = Microsoft.Maui.Controls.Maps.Map;
<!-- ✅ Correct — namespace prefix in XAML -->
xmlns:maps="clr-namespace:Microsoft.Maui.Controls.Maps;assembly=Microsoft.Maui.Controls.Maps"
<maps:Map ... />

<!-- ❌ Wrong — bare <Map> is ambiguous -->
<Map ... />

Platform setup pitfalls

Android — API key must be inside <application>

<!-- ✅ Correct -->
<application ...>
  <meta-data android:name="com.google.android.geo.API_KEY"
             android:value="YOUR_GOOGLE_MAPS_KEY" />
</application>

<!-- ❌ Outside <application> — key is silently ignored -->

⚠️ Also required: Google Play Services version meta-data and <queries> for geo scheme on API 30+ (see references/maps-api.md).

iOS / Mac Catalyst

⚠️ Without NSLocationWhenInUseUsageDescription in Info.plist, location permission is denied without prompt.

Windows — no native support

Must add CommunityToolkit.Maui.Maps + Bing key. Use conditional package reference and #if WINDOWS for setup.

MauiProgram.cs — don't forget UseMauiMaps

// ✅ Required — without this, Map control throws at runtime
builder.UseMauiMaps();

// ❌ Forgetting this causes "No registered handler for Map" crash

Performance tips

  • ⚠️ Don't add hundreds of pins directly — use ItemsSource with data binding for large pin sets.
  • Set initial region with MoveToRegion() to avoid the default world view zoom animation.
  • Avoid frequent MoveToRegion() calls — each triggers a map animation; debounce if driven by data changes.

Data-bound pins — do this for dynamic data

<!-- ✅ Correct — data-bound pins for dynamic collections -->
<maps:Map ItemsSource="{Binding Locations}">
    <maps:Map.ItemTemplate>
        <DataTemplate>
            <maps:Pin Label="{Binding Name}"
                      Address="{Binding Description}"
                      Location="{Binding Position}" />
        </DataTemplate>
    </maps:Map.ItemTemplate>
</maps:Map>

<!-- ❌ Wrong — manually adding pins in code-behind for data-driven scenarios -->

Decision framework

Need Approach
Basic map with pins Map control + Pins.Add() or ItemsSource binding
Map with shapes MapElements — Polygon, Polyline, Circle
Address → coordinates Geocoding.Default.GetLocationsAsync(address)
Coordinates → address Geocoding.Default.GetPlacemarksAsync(lat, lon)
Custom map overlays Use handlers to access native map APIs
Windows support Must add CommunityToolkit.Maui.Maps + Bing key

Quick checklist

  • [ ] NuGet: Microsoft.Maui.Controls.Maps added
  • [ ] .UseMauiMaps() called in MauiProgram.cs
  • [ ] Android: Google Maps API key inside <application> in AndroidManifest.xml
  • [ ] Android: Google Play Services version meta-data present
  • [ ] Android 11+: <queries> for geo scheme added
  • [ ] iOS/Mac: NSLocationWhenInUseUsageDescription in Info.plist
  • [ ] Windows: CommunityToolkit.Maui.Maps + Bing Maps key (conditional)
  • [ ] Namespace alias added to avoid Map type conflict

Current listing version

0.0.1

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 提供 .NET MAUI 地图控件的完整端到端使用指南,涵盖多平台配置与常见陷阱解决方案
  • 明确区分适用与不适用场景,帮助用户精准选择工具
Trigger Precision90/100

Highlights

  • 触发词覆盖全面,包含地图控件、图钉、地理编码等核心功能关键词
  • 明确排除 GPS 坐标获取等易混淆场景,边界清晰
Structure and Standards95/100

Areas to improve

  • 文档长度略长 Reported severity: Minor

    主文档约600行,可能影响阅读体验

    Recommendation: 建议增加目录导航或将部分内容移至子文档

Highlights

  • 结构清晰,包含常见陷阱、平台设置、性能提示、决策框架和检查清单
  • 提供大量可复用的代码示例和最佳实践
Execution Reliability90/100

Highlights

  • 工具来源明确(Microsoft.Maui.Controls.Maps、CommunityToolkit.Maui.Maps)
  • 覆盖主要异常场景(API密钥缺失、权限问题、平台差异)并提供具体修复方案
Evidence Verifiability (mean of the first four)90/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.