OpenStreetMap layer

View inAndroidFormsUWPWPFWinUIiOSView on GitHub

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 BasemapStyle.OSMStandard 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

The attribution text will be set to the required OpenStreetMap attribution automatically.

Apps that expect to make many requests to OpenStreetMap should consider using an alternative tile server via the WebTiledLayer class.

Esri now hosts an OpenStreetMap vector layer on ArcGIS Online that uses recent OpenStreetMap data in conjunction with a style matching the default OpenStreetMap style. This layer is not subject to the tile access restrictions that apply to tiles fetched from OpenStreetMap.org.

Tags

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

Sample Code

OpenStreetMapLayer.xamlOpenStreetMapLayer.xamlOpenStreetMapLayer.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="ArcGISRuntimeXamarin.Samples.OpenStreetMapLayer.OpenStreetMapLayer"
             xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms">
    <Grid>
        <esriUI:MapView x:Name="MyMapView" />
    </Grid>
</ContentPage>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.