View in MAUI UWP WPF WinUI View on GitHub
import InlineCode from "@esri-dx/starship-doc-components/components/InlineCode.astro";

Add OpenStreetMap as a basemap layer.

Image of OpenStreetMap layer

Use case

OpenStreetMap is a free community-edited basemap.

How to use the sample

When the sample opens, it will automatically display the map with the OpenStreetMap basemap. Pan and zoom to observe the basemap.

How it works

  1. Create a basemap wwith a
    basemap style.
  2. Create a map with that basemap.
  3. Show the map in a map view.

Relevant API

  • Basemap
  • BasemapStyle.OSMStandard
  • Map
  • MapView
  • OpenStreetMapLayer

Additional information

OpenStreetMap (OSM) basemaps are in mature support and will no longer be updated. They will be removed in a future version of the ArcGIS Native Maps SDKs. For more information, see the Overture Maps Data in ArcGIS blog. We recommend that you replace your OSM with the equivalent Open Basemap styles.

Tags

basemap, layers, map, open, OpenStreetMap, OSM, street

Sample Code

OpenStreetMapLayer.xaml OpenStreetMapLayer.xaml OpenStreetMapLayer.xaml.cs
<UserControl x:Class="ArcGIS.WinUI.Samples.OpenStreetMapLayer.OpenStreetMapLayer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
<Grid>
<esriUI:MapView x:Name="MyMapView" />
</Grid>
</UserControl>