Using OpenStreetMap


 

AspMap allows you to add a map from an OpenStreetMap-compatible web service as a background layer of your Map control. 

 

The following conditions take place when an OSMLayer object is added as a background layer:

  1. The coordinate system of the Map control will be set to PCS_PopularVisualisationMercator;

  2. 19 zoom levels from OpenStreetMap will be added to the ZoomLevels collection of the Map control;

  3. The FullExtent property of the Map control will be set to the full extent of OpenStreetMap;

  4. You have to explicitly or implicitly (via a .prj file for your shapefiles) specify the coordinate system for each layer added to the Map control.

 

It is highly recommended to place the Map control inside an ASP.NET AJAX UpdatePanel to avoid initializing the OpenStreetMap engine on each postback.

 

The following sample code demonstrates how to add a background layer from the OpenStreetMap Web Service:
 

Imports AspMap
Imports AspMap.Web
Imports AspMap.Web.Extensions

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim serviceUrl As String 

serviceUrl = "http://tile.openstreetmap.org/{z}/{x}/{y}.png"
Dim osmLayer As OSMLayer = New OSMLayer(serviceUrl)
map.BackgroundLayer = osmLayer

' set the transparency of the main map image to display other layers over the OpenStreetMap
map.ImageFormat = ImageFormat.Png
map.ImageOpacity = 0.4

End Sub

See the OpenStreetMapApp.aspx sample in the AJAX samples.

 

 

 

 

© 2018 VDS Technologies
Converted from CHM to HTML with chm2web Standard 2.85 (unicode)