I am trying to get a Bing Maps overlay working. Below is my code. When it runs I see it creates BingMapsMetadata.xml in my C:\Temp folder but the code throws an error of "Parameter is not valid". The example out there are very lacking when it comes to the overlays. What am I missing here?
mapCtrl.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
mapCtrl.MapResizeMode = MapResizeMode.PreserveScaleAndCenter
mapCtrl.MapUnit = GeographyUnit.DecimalDegree
mapCtrl.BackgroundOverlay.BackgroundBrush =
New
GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean)
mapCtrl.CurrentExtent =
New
RectangleShape(-75.412903, 41.409776, -73.979187, 38.826871)
Dim
applicationID
As
String
=
"123456789"
Dim
cacheDirectory
As
String
=
"C:\Temp"
Dim
bingMapsLayer
As
New
BingMapsLayer(applicationID, BingMapsMapType.Road, cacheDirectory)
Dim
staticOverlay
As
New
LayerOverlay()
staticOverlay.Layers.Add(
"WorldLayer"
, bingMapsLayer)
mapCtrl.Overlays.Add(staticOverlay)
simpleMarkerOverlay =
New
SimpleMarkerOverlay()
simpleMarkerOverlay.MapControl = mapCtrl
simpleMarkerOverlay.DragMode = MarkerDragMode.Drag
mapCtrl.Overlays.Add(
"SimpleMarker"
, simpleMarkerOverlay)
mapCtrl.Refresh()