This topic provides information on how to display geographic imagery from ArcGIS Online servers in the background content of the XamGeographicMap™ control.
The following table lists the topics required as a prerequisite to understanding this topic.
This topic contains the following sections:
ArcGIS Online is an Esri product that allows you to create and share maps either publicly or privately. You can also access other maps created by Esri and other ArcGIS users.
You can see a list of some available public maps at the following location, Esri Maps and Data Group .
The XamGeographicMap control displays geographic imagery from ArcGIS Online in the map background content using the ArcGISOnlineMapImagery class.
Public maps can be displayed by setting the MapServerUri property of the ArcGISOnlineMapImagery class to the map’s specified URI.
Private maps involve more configuration than simply setting the MapServerUri. You must use an access token either provided by the owner of the map or generated via a Username, and Password combination also provided by the owner.
The following screenshot is a preview of the XamGeographicMap control with geographic imagery tile from map content on an ArcGIS Online server.
The map owner can allow a map to be publicly accessible and provide the URI for that map.
In order to use geographic imagery from ArcGIS public maps, you must first obtain the map’s public URI. You must then set this map URI to the ArcGISOnlineMapImagery object’s MapServerUri property.
The following screenshot illustrates the rendering of the XamGeographicMap control with the BackgroundContent property set to the ArcGISOnlineMapImagery.
The MapServerUri property of the ArcGISOnlineMapImagery object is set to following value:
In XAML:
<ig:XamGeographicMap x:Name="GeoMap"
Background="Transparent"
PlotAreaBackground="Transparent">
<ig:XamGeographicMap.BackgroundContent>
<ig:ArcGISOnlineMapImagery
MapServerUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
</ig:XamGeographicMap.BackgroundContent>
</ig:XamGeographicMap>
In C#:
var publicMap = new ArcGISOnlineMapImagery();
publicMap.MapServerUri ="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";
this.GeoMap.BackgroundContent = publicMap;
In Visual Basic:
Dim publicMap As var = New ArcGISOnlineMapImagery
publicMap.MapServerUri ="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
Me.GeoMap.BackgroundContent = publicMap
The map owner can set their map to be private, controlling access to specific users. This map can then be accessed, either with an access token provided by the owner of the map or one generated from a Username and Password combination.
The following table summarizes the credential properties of the ArcGISOnlineMapImagery object used for accessing the private map content on ArcGIS Online servers.
The following code example demonstrates how to set the ArcGISOnlineMapImagery object’s properties required for a private map.
In XAML:
<ig:ArcGISOnlineMapImagery
TokenGenerationEndPoint="https://www.arcgis.com/sharing/"
IsMapPublic="False"
UserName="USERNAME"
Password="PASSWORD"
DefaultTokenTimeout="65"
MapServerUri="MAP_SERVER_URI"
RefererUri="REFERER_URI" >
</ig:ArcGISOnlineMapImagery>
In C#:
var privMap = new ArcGISOnlineMapImagery();
privMap.TokenGenerationEndPoint = "https://www.arcgis.com/sharing/";
privMap.IsMapPublic = false;
privMap.UserName = "USERNAME";
privMap.Password = "PASSWORD";
privMap.DefaultTokenTimeout = 65;
privMap.MapServerUri = "MAP_SERVER_URI";
privMap.RefererURI = "REFERER_URI";
In Visual Basic:
Dim privMap As var = New ArcGISOnlineMapImagery
privMap.TokenGenerationEndPoint = "https://www.arcgis.com/sharing/"
privMap.IsMapPublic = false
privMap.UserName = "USERNAME"
privMap.Password = "PASSWORD"
privMap.DefaultTokenTimeout = 65
privMap.MapServerUri = "MAP_SERVER_URI"
privMap.ReferURI = "REFERER_URI"
The following topics provide additional information related to this topic.