Exceeding Standard Zoom-Levels in the Bing Maps Silverlight Control

With tools like the MapCruncher it was always possible to create your own tile-layers and overlay them on top of the Bing Maps base map, e.g. in order to use your own aerial imagery or to overlay floor-plans. Particularly when you work with floor-plans you might want to get closer than the maximum zoom-level 21 that Bing Maps uses by default. The MapCruncher supports the generation of tiles for these higher zoom-levels and in the Bing Maps AJAX control you can just set the minimum and maximum zoom-level in the VETileSourceSpecification

tileSourceSpec.MinZoomLevel = 18;
tileSourceSpec.MaxZoomLevel = 23;

In the Bing Maps Silverlight Control there is a similar property of the LocationRectTileSource which suggest that you can just set the zoom-range beyond level 21 as well, e.g.

Dim tileSource As New LocationRectTileSource()
tileSource.ZoomRange = New Range(Of Double)(18, 23)

However, this alone does not do the trick because the default MapModes have the maximum zoom-level 21. In order to go beyond level 21 you can derive from AerialMode or RoadMode and override the GetZoomRange-method, e.g.

Public Class MyAerialMode
    Inherits AerialMode
    Protected Overrides Function GetZoomRange(ByVal center As Location) As Range(Of Double)
        Return New Range(Of Double)(1, 23)
    End Function
End Class

And then we can point to MyAerialMode rather than the default AerialMode, e.g.

Private Sub MapStyleAerial(ByVal sender As System.Object, ByVal e As System.Windows.Input.MouseButtonEventArgs)
    MyMap.MapForeground.Copyright.Attributions.Clear()
    MyMap.Mode = New MyAerialMode
End Sub

That’s it, now we can zoom down to my desk again:

image

Technorati Tags: ,

Advertisements
This entry was posted in Bing Maps. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s