Example E3617
Visible to All Users

Map for WPF - Connect to the OpenStreetMap Image Tile Service

This example uses the OpenStreetMapDataProvider class to connect the Map Control to the OpenStreetMap image tile service.

Review the Copyright and License and Tile usage policy pages before using map images in the OpenStreetMap format.

To use the OpenStreetMap provider, you should provide the UserAgent parameter with a valid value to identify your application.

Set the OpenStreetMapDataProvider.TileUriTemplate property to a tile's URL. You can use the public OpenStreetMap server that has limitations described in the Tile usage policy. To do this, set TileUriTemplate to "https://.tile.openstreetmap.org///.png" . You can also deploy your own tile server.

Files to Review

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

Example Code

MainWindow.xaml
XAML
<Window x:Class="DXMapLesson2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dxm="http://schemas.devexpress.com/winfx/2008/xaml/map" Title="MainWindow" Height="350" Width="525" > <Grid> <dxm:MapControl Name="mapControl1"> <dxm:ImageLayer> <dxm:ImageLayer.DataProvider> <dxm:OpenStreetMapDataProvider TileUriTemplate="http://{subdomain}.tile.MyCustomOSMProvider.org/{tileLevel}/{tileX}/{tileY}.png" WebRequest="OnWebRequest"/> </dxm:ImageLayer.DataProvider> </dxm:ImageLayer> <!--region #Elements--> <dxm:MapControl.ZoomTrackbarOptions> <dxm:ZoomTrackbarOptions Margin="16" Orientation="Horizontal" VerticalAlignment="Bottom" /> </dxm:MapControl.ZoomTrackbarOptions> <dxm:MapControl.ScrollButtonsOptions> <dxm:ScrollButtonsOptions VerticalAlignment="Bottom" HorizontalAlignment="Right" /> </dxm:MapControl.ScrollButtonsOptions> <dxm:MapControl.ScalePanelOptions> <dxm:ScalePanelOptions HorizontalAlignment="Right" VerticalAlignment="Bottom" Visible="False" /> </dxm:MapControl.ScalePanelOptions> <dxm:MapControl.CoordinatesPanelOptions> <dxm:CoordinatesPanelOptions VerticalAlignment="Top" HorizontalAlignment="Right" /> </dxm:MapControl.CoordinatesPanelOptions> <!--endregion #Elements--> </dxm:MapControl> </Grid> </Window>

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.