Contents
Bing Maps AJAX Control, Version 6.3 ........................................................................................... 13
Getting Started with the Bing Maps AJAX Control ..................................................................... 14
What's New in the Map Control? ................................................................................................ 15
Version Changelist .................................................................................................................. 16
Developing with the Bing Maps AJAX Control ........................................................................... 17
Displaying a Map Using JavaScript ........................................................................................ 18
Displaying an Embedded Map ................................................................................................ 20
Controlling the Map ................................................................................................................. 22
Adding Shapes to a Map ........................................................................................................ 23
Using Routes and Directions .................................................................................................. 27
Working with Bird's Eye Images ............................................................................................. 29
Displaying 3D Maps ................................................................................................................ 31
Using Map Control Parameters .............................................................................................. 33
Returning Localized Results ................................................................................................... 34
Tracking Your Bing Maps Usage ............................................................................................ 37
Bing Map Control Performance .............................................................................................. 38
Using the Core Map Control ................................................................................................... 40
Using the REST Services with the Core Map Control ............................................................ 49
Bing Maps AJAX Control Class Reference ................................................................................ 54
VEAltitudeMode Enumeration ................................................................................................. 56
VEBirdseyeScene Class ......................................................................................................... 56
VEBirdseyeScene Methods ................................................................................................. 57
VEBirdseyeScene.ContainsLatLong Method ................................................................... 58
VEBirdseyeScene.ContainsPixel Method ........................................................................ 59
VEBirdseyeScene.GetBoundingRectangle Method ......................................................... 59
VEBirdseyeScene.GetHeight Method .............................................................................. 60
VEBirdseyeScene.GetID Method ..................................................................................... 60
VEBirdseyeScene.GetOrientation Method ...................................................................... 60
VEBirdseyeScene.GetWidth Method ............................................................................... 61
VEBirdseyeScene.LatLongToPixel Method ..................................................................... 61
VEBirdseyeScene.PixelToLatLong Method ..................................................................... 62
VEClusteringOptions Class .................................................................................................... 62
VEClusteringOptions Constructor ....................................................................................... 63
VEClusteringOptions Properties .......................................................................................... 63
VEClusteringOptions.Icon Property ................................................................................. 64
VEClusteringOptions.Callback Property .......................................................................... 64
VEClusteringType Enumeration ............................................................................................. 64
VEClusterSpecification Class ................................................................................................. 65
VEClusterSpecification Methods ......................................................................................... 65
VEClusterSpecification.GetClusterShape Method ........................................................... 65
VEClusterSpecification Properties ...................................................................................... 66
VEClusterSpecification.Shapes Property......................................................................... 66
VEClusterSpecification.LatLong Property ........................................................................ 66
VEColor Class ......................................................................................................................... 66
VEColor Constructor............................................................................................................ 67
VEColor Properties .............................................................................................................. 68
VEColor.A Property .......................................................................................................... 68
VEColor.B Property .......................................................................................................... 69
VEColor.G Property ......................................................................................................... 69
VEColor.R Property.......................................................................................................... 69
VECustomIconSpecification Class ......................................................................................... 69
VECustomIconSpecification Constructor ............................................................................ 71
VECustomIconSpecification Properties............................................................................... 71
VECustomIconSpecification.BackColor Property ............................................................ 72
VECustomIconSpecification.CustomHTML Property ....................................................... 72
VECustomIconSpecification.ForeColor Property ............................................................. 72
VECustomIconSpecification.Image Property ................................................................... 73
VECustomIconSpecification.ImageOffset Property ......................................................... 73
VECustomIconSpecification.TextBold Property ............................................................... 73
VECustomIconSpecification.TextContent Property ......................................................... 73
VECustomIconSpecification.TextFont Property ............................................................... 73
VECustomIconSpecification.TextItalics Property ............................................................. 74
VECustomIconSpecification.TextOffset Property ............................................................ 74
VECustomIconSpecification.TextSize Property ............................................................... 74
VECustomIconSpecification.TextUnderline Property ...................................................... 74
VEDashboardSize Enumeration ............................................................................................. 74
VEDataType Enumeration ...................................................................................................... 75
VEDistanceUnit Enumeration ................................................................................................. 77
VEException Class ................................................................................................................. 78
VEException Properties ...................................................................................................... 79
VEException.message Property ...................................................................................... 79
VEException.name Property ............................................................................................ 79
VEException.source Property .......................................................................................... 79
VEFailedShapeRequest Enumeration .................................................................................... 79
VEFindResult Class ................................................................................................................ 80
VEFindResult Properties ..................................................................................................... 81
VEFindResult.Description Property ................................................................................. 81
VEFindResult.IsSponsored Property ............................................................................... 81
VEFindResult.LatLong Property ...................................................................................... 82
VEFindResult.Name Property .......................................................................................... 82
VEFindResult.Phone Property ......................................................................................... 82
VEFindResult.FindType Property .................................................................................... 82
VEFindResult.Shape Property ......................................................................................... 82
VEFindType Enumeration ....................................................................................................... 83
VEGeocodeLocation Class ..................................................................................................... 83
VEGeocodeLocation Properties .......................................................................................... 84
VEGeocodeLocation.LatLong Property ........................................................................... 84
VEGeocodeLocation.Precision Property.......................................................................... 84
VEGeocodeOptions Class ...................................................................................................... 84
VEGeocodeOptions Constructor ......................................................................................... 85
VEGeocodeOptions Properties ........................................................................................... 85
VEGeocodeOptions.SetBestMapView Property .............................................................. 86
VEGeocodeOptions.UseDefaultDisambiguation Property ............................................... 86
VEImageryMetadata Class ..................................................................................................... 86
VEImageryMetadata Properties .......................................................................................... 86
VEImageryMetadata.DateRangeStart Property ............................................................... 87
VEImageryMetadata.DateRangeEnd Property ................................................................ 87
VEImageryMetadataOptions Class ......................................................................................... 87
VEImageryMetadataOptions Constructor ........................................................................... 88
VEImageryMetadataOptions Properties .............................................................................. 88
VEImageryMetadataOptions.LatLong Property ............................................................... 89
VEImageryMetadataOptions.MapStyle Property ............................................................. 89
VEImageryMetadataOptions.ZoomLevel Property .......................................................... 89
VELatLong Class .................................................................................................................... 90
VELatLong Constructor ....................................................................................................... 90
VELatLong Properties ......................................................................................................... 91
VELatLong.Altitude Property ............................................................................................ 92
VELatLong.AltitudeMode Property ................................................................................... 92
VELatLong.Latitude Property ........................................................................................... 92
VELatLong.Longitude Property ........................................................................................ 92
VELatLong Methods ............................................................................................................ 93
VELatLong.SetAltitude Method ........................................................................................ 93
VELatLongRectangle Class .................................................................................................... 93
VELatLongRectangle Constructor ....................................................................................... 94
VELatLongRectangle Properties ......................................................................................... 95
VELatLongRectangle.BottomLeftLatLong Property ......................................................... 95
VELatLongRectangle.BottomRightLatLong Property ...................................................... 96
VELatLongRectangle.TopLeftLatLong Property .............................................................. 96
VELatLongRectangle.TopRightLatLong Property ............................................................ 96
VELocationPrecision Enumeration ......................................................................................... 96
VEMap Class .......................................................................................................................... 97
VEMap Constructor ........................................................................................................... 104
VEMap Events ................................................................................................................... 105
Keyboard Events ............................................................................................................ 105
VEMap.onkeypress Event .......................................................................................... 106
VEMap.onkeydown Event .......................................................................................... 106
VEMap.onkeyup Event ............................................................................................... 107
Mouse Events ................................................................................................................ 108
VEMap.onclick Event .................................................................................................. 109
VEMap.ondoubleclick Event ....................................................................................... 111
VEMap.onmousedown Event ..................................................................................... 113
VEMap.onmousemove Event ..................................................................................... 115
VEMap.onmouseout Event ......................................................................................... 116
VEMap.onmouseover Event ....................................................................................... 118
VEMap.onmouseup Event .......................................................................................... 119
VEMap.onmousewheel Event .................................................................................... 121
Bing Maps Events .......................................................................................................... 122
VEMap.onchangemapstyle Event .............................................................................. 124
VEMap.onchangeview Event ...................................................................................... 124
VEMap.oncredentialserror Event ................................................................................ 125
VEMap.oncredentialsvalid Event ................................................................................ 126
VEMap.onendpan Event ............................................................................................. 127
VEMap.onendzoom Event .......................................................................................... 127
VEMap.onerror Event ................................................................................................. 128
VEMap.oninitmode Event ........................................................................................... 129
VEMap.onmodenotavailable Event ............................................................................ 129
VEMap.onobliquechange Event ................................................................................. 130
VEMap.onobliqueenter Event ..................................................................................... 131
VEMap.onobliqueleave Event .................................................................................... 131
VEMap.onresize Event ............................................................................................... 132
VEMap.onstartpan Event ............................................................................................ 133
VEMap.onstartzoom Event ......................................................................................... 133
VEMap.ontokenerror Event ........................................................................................ 134
VEMap.ontokenexpire Event ...................................................................................... 135
VEMap Event Object Properties .................................................................................... 136
VEMap Methods ................................................................................................................ 138
VEMap.AddControl Method ........................................................................................... 145
VEMap.AddCustomLayer Method ................................................................................. 146
VEMap.AddShape Method ............................................................................................ 146
VEMap.AddShapeLayer Method ................................................................................... 147
VEMap.AddTileLayer Method ........................................................................................ 147
VEMap.AttachEvent Method .......................................................................................... 148
VEMap.Clear Method ..................................................................................................... 149
VEMap.ClearInfoBoxStyles Method ............................................................................... 149
VEMap.ClearTraffic Method ........................................................................................... 151
VEMap.DeleteAllShapeLayers Method.......................................................................... 152
VEMap.DeleteAllShapes Method ................................................................................... 152
VEMap.DeleteControl Method ....................................................................................... 152
VEMap.DeleteRoute Method ......................................................................................... 153
VEMap.DeleteShape Method ........................................................................................ 153
VEMap.DeleteShapeLayer Method ............................................................................... 153
VEMap.DeleteTileLayer Method .................................................................................... 154
VEMap.DetachEvent Method ......................................................................................... 154
VEMap.Dispose Method ................................................................................................ 155
VEMap.EnableShapeDisplayThreshold Method ............................................................ 155
VEMap.EndContinuousPan Method .............................................................................. 156
VEMap.Find Method ...................................................................................................... 156
VEMap.FindLocations Method ....................................................................................... 159
VEMap.Geocode Method ............................................................................................... 160
VEMap.GetAltitude Method ........................................................................................... 161
VEMap.GetBirdseyeScene Method ............................................................................... 161
VEMap.GetCenter Method ............................................................................................. 162
VEMap.GetDirections Method ....................................................................................... 162
VEMap.GetHeading Method .......................................................................................... 163
VEMap.GetImageryMetadata Method ........................................................................... 164
VEMap.GetLeft Method ................................................................................................. 165
VEMap.GetMapMode Method ....................................................................................... 165
VEMap.GetMapStyle Method ........................................................................................ 165
VEMap.GetMapView Method ......................................................................................... 165
VEMap.GetPitch Method ............................................................................................... 166
VEMap.GetRoute Method .............................................................................................. 166
VEMap.GetShapeByID Method ..................................................................................... 167
VEMap.GetShapeLayerByIndex Method ....................................................................... 168
VEMap.GetShapeLayerCount Method .......................................................................... 168
VEMap.GetTileLayerByID Method ................................................................................. 169
VEMap.GetTileLayerByIndex Method............................................................................ 169
VEMap.GetTileLayerCount Method ............................................................................... 170
VEMap.GetTop Method ................................................................................................. 170
VEMap.GetVersion Method ........................................................................................... 170
VEMap.GetZoomLevel Method ...................................................................................... 171
VEMap.Hide3DNavigationControl Method .................................................................... 171
VEMap.HideAllShapeLayers Method............................................................................. 171
VEMap.HideBaseTileLayer Method ............................................................................... 172
VEMap.HideControl Method .......................................................................................... 172
VEMap.HideDashboard Method .................................................................................... 172
VEMap.HideFindControl Method ................................................................................... 173
VEMap.HideInfoBox Method .......................................................................................... 173
VEMap.HideMiniMap Method ........................................................................................ 173
VEMap.HideScalebar Method ........................................................................................ 174
VEMap.HideTileLayer Method ....................................................................................... 174
VEMap.HideTrafficLegend Method ................................................................................ 174
VEMap.Import3DModel Method ..................................................................................... 175
VEMap.ImportShapeLayerData Method ........................................................................ 176
VEMap.IncludePointInView Method ............................................................................... 177
VEMap.IsBirdseyeAvailable Method .............................................................................. 177
VEMap.LatLongToPixel Method .................................................................................... 178
VEMap.LoadMap Method .............................................................................................. 179
VEMap.LoadTraffic Method ........................................................................................... 180
VEMap.Pan Method ....................................................................................................... 181
VEMap.PanToLatLong Method ...................................................................................... 181
VEMap.PixelToLatLong Method .................................................................................... 182
VEMap.RemoveCustomLayer Method .......................................................................... 182
VEMap.Resize Method .................................................................................................. 183
VEMap.Search Method .................................................................................................. 183
VEMap.SetAltitude Method ............................................................................................ 184
VEMap.SetBirdseyeOrientation Method ........................................................................ 185
VEMap.SetBirdseyeScene Method ................................................................................ 185
VEMap.SetBirdseyeScene(id) Method ....................................................................... 186
VEMap.SetBirdseyeScene(veLatLong, orientation, zoomLevel, callback) Method ... 186
VEMap.SetCenter Method ............................................................................................. 187
VEMap.SetCenterAndZoom Method ............................................................................. 187
VEMap.SetClientToken Method ..................................................................................... 188
VEMap.SetCredentials Method ...................................................................................... 189
VEMap.SetDashboardSize Method ............................................................................... 189
VEMap.SetDefaultInfoBoxStyles Method ...................................................................... 190
VEMap.SetFailedShapeRequest Method ...................................................................... 190
VEMap.SetHeading Method .......................................................................................... 191
VEMap.SetMapMode Method ........................................................................................ 191
VEMap.SetMapStyle Method ......................................................................................... 192
VEMap.SetMapView Method ......................................................................................... 192
VEMap.SetMouseWheelZoomToCenter Method .......................................................... 193
VEMap.SetPitch Method ................................................................................................ 193
VEMap.SetPrintOptions Method .................................................................................... 194
VEMap.SetScaleBarDistanceUnit Method ..................................................................... 195
VEMap.SetShapesAccuracy Method ............................................................................. 195
VEMap.SetShapesAccuracyRequestLimit Method ........................................................ 196
VEMap.SetTileBuffer Method ........................................................................................ 196
VEMap.SetTrafficLegendText Method ........................................................................... 197
VEMap.SetZoomLevel Method ...................................................................................... 197
VEMap.Show3DBirdseye Method .................................................................................. 198
VEMap.Show3DNavigationControl Method ................................................................... 199
VEMap.ShowAllShapeLayers Method ........................................................................... 199
VEMap.ShowBaseTileLayer Method ............................................................................. 199
VEMap.ShowControl Method ......................................................................................... 200
VEMap.ShowDashboard Method ................................................................................... 200
VEMap.ShowDisambiguationDialog Method ................................................................. 200
VEMap.ShowFindControl Method .................................................................................. 201
VEMap.ShowInfoBox Method ........................................................................................ 202
VEMap.ShowMessage Method ...................................................................................... 202
VEMap.ShowMiniMap Method ....................................................................................... 203
VEMap.ShowScalebar Method ...................................................................................... 203
VEMap.ShowTileLayer Method ..................................................................................... 204
VEMap.ShowTrafficLegend Method .............................................................................. 204
VEMap.StartContinuousPan Method ............................................................................. 205
VEMap.ZoomIn Method ................................................................................................. 206
VEMap.ZoomOut Method .............................................................................................. 206
VEMap Properties ............................................................................................................. 206
VEMap.onLoadMap Property ......................................................................................... 207
VEMapMode Enumeration .................................................................................................... 207
VEMapOptions Class ............................................................................................................ 208
VEMapOptions Constructor ............................................................................................... 210
VEMapOptions Properties ................................................................................................. 210
VEMapOptions.BirdseyeOrientation Property ............................................................... 212
VEMapOptions.DashboardColor Property ..................................................................... 212
VEMapOptions.EnableBirdseye Property ...................................................................... 212
VEMapOptions.EnableClickableLogo Property ............................................................. 213
VEMapOptions.EnableDashboardLabels Property ........................................................ 213
VEMapOptions.EnableSearchLogo Property ................................................................ 213
VEMapOptions.LoadBaseTiles Property ....................................................................... 213
VEMapOptions.UseEnhancedRoadStyle Property ........................................................ 214
VEMapStyle Enumeration ..................................................................................................... 214
VEMapViewSpecification Class ............................................................................................ 215
VEMapViewSpecification Constructor ............................................................................... 215
VEMatchCode Enumeration ................................................................................................. 216
VEMatchConfidence Enumeration........................................................................................ 217
VEMiniMapSize Enumeration ............................................................................................... 217
VEModelFormat Enumeration .............................................................................................. 218
VEModelOrientation Class .................................................................................................... 219
VEModelOrientation Constructor ....................................................................................... 220
VEModelOrientation Properties ......................................................................................... 221
VEModelOrientation.Heading Property .......................................................................... 221
VEModelOrientation.Roll Property ................................................................................. 221
VEModelOrientation.Tilt Property .................................................................................. 222
VEModelScale Class ............................................................................................................ 222
VEModelScale Constructor ............................................................................................... 223
VEModelScale Properties ................................................................................................. 224
VEModelScale.X Property ............................................................................................. 224
VEModelScale.Y Property ............................................................................................. 224
VEModelScale.Z Property .............................................................................................. 224
VEModelScaleUnit Enumeration .......................................................................................... 225
VEModelSourceSpecification Class ..................................................................................... 225
VEModelSourceSpecification Constructor ........................................................................ 226
VEModelSourceSpecification Properties .......................................................................... 226
VEModelSourceSpecification.Format Property ............................................................. 227
VEModelSourceSpecification.Layer Property ................................................................ 227
VEModelSourceSpecification.ModelSource Property .................................................... 227
VEModelStatusCode Enumeration ....................................................................................... 227
VEOrientation Enumeration .................................................................................................. 228
VEPixel Class ....................................................................................................................... 228
VEPixel Constructor .......................................................................................................... 229
VEPixel Properties............................................................................................................. 229
VEPixel.x Property ......................................................................................................... 230
VEPixel.y Property ......................................................................................................... 230
VEPlace Class ...................................................................................................................... 230
VEPlace Properties ........................................................................................................... 231
VEPlace.LatLong Property ............................................................................................. 232
VEPlace.Locations Property .......................................................................................... 232
VEPlace.MatchCode Property ....................................................................................... 232
VEPlace.MatchConfidence Property.............................................................................. 233
VEPlace.Name Property ................................................................................................ 233
VEPlace.Precision Property ........................................................................................... 233
VEPrintOptions Class ........................................................................................................... 233
VEPrintOptions Constructor .............................................................................................. 234
VEPrintOptions Properties ................................................................................................ 235
VEPrintOptions.EnablePrinting Property ....................................................................... 235
VERoute Class ...................................................................................................................... 235
VERoute Properties ........................................................................................................... 236
VERoute.Distance Property ........................................................................................... 236
VERoute.RouteLegs Property ........................................................................................ 237
VERoute.ShapePoints Property ..................................................................................... 237
VERoute.Time Property ................................................................................................. 237
VERouteDeprecated Class ................................................................................................... 237
VERouteDeprecated Properties ........................................................................................ 238
VERouteDeprecated.EndLocation Property .................................................................. 238
VERouteDeprecated.Itinerary Property ......................................................................... 238
VERouteDeprecated.StartLocation Property ................................................................. 239
VERouteDistanceUnit Enumeration ...................................................................................... 239
VERouteHint Class ............................................................................................................... 239
VERouteHint Properties .................................................................................................... 240
VERouteHint.Type Property ........................................................................................... 240
VERouteHint.Text Property ............................................................................................ 240
VERouteHintType Enumeration ............................................................................................ 241
VERouteItinerary Class ........................................................................................................ 241
VERouteItinerary Properties .............................................................................................. 242
VERouteItinerary.Items Property ................................................................................... 242
VERouteItineraryDeprecated Class ...................................................................................... 242
VERouteItineraryDeprecated Properties ........................................................................... 243
VERouteItineraryDeprecated.Distance Property ........................................................... 243
VERouteItineraryDeprecated.DistanceUnit Property ..................................................... 243
VERouteItineraryDeprecated.RouteType Property ........................................................ 243
VERouteItineraryDeprecated.Segments Property ......................................................... 243
VERouteItineraryDeprecated.Time Property ................................................................. 244
VERouteItineraryItem Class ................................................................................................. 244
VERouteItineraryItem Properties ....................................................................................... 245
VERouteItineraryItem.Distance Property ....................................................................... 245
VERouteItineraryItem.LatLong Property ........................................................................ 246
VERouteItineraryItem.Shape Property ........................................................................... 246
VERouteItineraryItem.Text Property .............................................................................. 246
VERouteItineraryItem.Time Property ............................................................................. 246
VERouteItineraryItem.Warnings Property ...................................................................... 246
VERouteItineraryItem.Hints Property ............................................................................. 246
VERouteLeg Class................................................................................................................ 247
VERouteLeg Properties ..................................................................................................... 247
VERouteLeg.Distance Property ..................................................................................... 248
VERouteLeg.Itinerary Property ...................................................................................... 248
VERouteLeg.Time Property ........................................................................................... 248
VERouteLocation Class ........................................................................................................ 248
VERouteLocation Properties ............................................................................................. 249
VERouteLocation.Address Property .............................................................................. 249
VERouteLocation.LatLong Property .............................................................................. 249
VERouteMode Enumeration ................................................................................................. 249
VERouteOptimize Enumeration ............................................................................................ 250
VERouteOptions Class ......................................................................................................... 250
VERouteOptions Constructor ............................................................................................ 252
VERouteOptions Properties .............................................................................................. 252
VERouteOptions.DistanceUnit Property ........................................................................ 253
VERouteOptions.DrawRoute Property ........................................................................... 253
VERouteOptions.RouteCallback Property ..................................................................... 254
VERouteOptions.RouteColor Property .......................................................................... 254
VERouteOptions.RouteMode Property .......................................................................... 254
VERouteOptions.RouteOptimize Property ..................................................................... 254
VERouteOptions.RouteWeight Property ........................................................................ 255
VERouteOptions.RouteZIndex Property ........................................................................ 255
VERouteOptions.SetBestMapView Property ................................................................. 255
VERouteOptions.ShowDisambiguation Property ........................................................... 255
VERouteOptions.ShowErrorMessages Property ........................................................... 256
VERouteOptions.UseMWS Property ............................................................................. 256
VERouteOptions.UseTraffic Property ............................................................................ 256
VERouteSegment Class ....................................................................................................... 257
VERouteSegment Properties ............................................................................................ 258
VERouteSegment.Instruction Property .......................................................................... 258
VERouteSegment.LatLong Property.............................................................................. 258
VERouteSegment.Distance Property............................................................................. 258
VERouteType Enumeration .................................................................................................. 259
VERouteWarning Class ........................................................................................................ 259
VERouteWarning Properties ............................................................................................. 260
VERouteWarning.Severity Property ............................................................................... 260
VERouteWarning.Text Property ..................................................................................... 260
VERouteWarningSeverity Enumeration ............................................................................... 260
VESearchOptions Class ....................................................................................................... 261
VESearchOptions Constructor .......................................................................................... 262
VESearchOptions Properties ............................................................................................ 263
VESearchOptions.BoundingRectangle Property ........................................................... 264
VESearchOptions.CreateResults Property .................................................................... 264
VESearchOptions.FindType Property ............................................................................ 264
VESearchOptions.NumberOfResults Property .............................................................. 264
VESearchOptions.SetBestMapView Property ............................................................... 265
VESearchOptions.ShapeLayer Property ....................................................................... 265
VESearchOptions.ShowResults Property ...................................................................... 265
VESearchOptions.StartIndex Property .......................................................................... 265
VESearchOptions.UseDefaultDisambiguation Property ................................................ 265
VEShape Class ..................................................................................................................... 266
VEShape Constructor ........................................................................................................ 269
VEShape Events ............................................................................................................... 270
VEShape.ondrag Event ................................................................................................. 270
VEShape.onenddrag Event ........................................................................................... 271
VEShape.onstartdrag Event .......................................................................................... 271
VEShape Methods............................................................................................................. 272
VEShape.GetAltitude Method ........................................................................................ 274
VEShape.GetAltitudeMode Method ............................................................................... 275
VEShape.GetCustomIcon Method ................................................................................. 275
VEShape.GetDescription Method .................................................................................. 276
VEShape.GetFillColor Method ....................................................................................... 276
VEShape.GetIconAnchor Method .................................................................................. 277
VEShape.GetID Method ................................................................................................ 277
VEShape.GetLineColor Method ..................................................................................... 277
VEShape.GetLineToGround Method ............................................................................. 278
VEShape.GetLineWidth Method .................................................................................... 278
VEShape.GetMaxZoomLevel Method ........................................................................... 278
VEShape.GetMinZoomLevel Method ............................................................................ 279
VEShape.GetMoreInfoURL Method ............................................................................... 279
VEShape.GetPhotoURL Method ................................................................................... 280
VEShape.GetPoints Method .......................................................................................... 280
VEShape.GetShapeLayer Method ................................................................................. 280
VEShape.GetTitle Method ............................................................................................. 281
VEShape.GetType Method ............................................................................................ 281
VEShape.GetZIndex Method ......................................................................................... 281
VEShape.GetZIndexPolyShape Method ....................................................................... 282
VEShape.Hide Method .................................................................................................. 282
VEShape.HideIcon Method ............................................................................................ 282
VEShape.IsModel Method ............................................................................................. 283
VEShape.SetAltitude Method ........................................................................................ 283
VEShape.SetAltitudeMode Method ............................................................................... 284
VEShape.SetCustomIcon Method ................................................................................. 284
VEShape.SetDescription Method .................................................................................. 285
VEShape.SetFillColor Method ....................................................................................... 286
VEShape.SetIconAnchor Method .................................................................................. 287
VEShape.SetLineColor Method ..................................................................................... 287
VEShape.SetLineToGround Method ............................................................................. 288
VEShape.SetLineWidth Method .................................................................................... 288
VEShape.SetMaxZoomLevel Method ............................................................................ 289
VEShape.SetMinZoomLevel Method ............................................................................. 289
VEShape.SetMoreInfoURL Method ............................................................................... 290
VEShape.SetPhotoURL Method .................................................................................... 290
VEShape.SetPoints Method .......................................................................................... 291
VEShape.SetTitle Method .............................................................................................. 291
VEShape.SetZIndex Method ......................................................................................... 292
VEShape.Show Method ................................................................................................. 293
VEShape.ShowIcon Method .......................................................................................... 294
VEShape Properties .......................................................................................................... 294
VEShape.Draggable Property ........................................................................................ 294
VEShapeLayer Class ............................................................................................................ 295
VEShapeLayer Constructor ............................................................................................... 296
VEShapeLayer Methods ................................................................................................... 297
VEShapeLayer.AddShape Method ................................................................................ 298
VEShapeLayer.DeleteAllShapes Method ...................................................................... 299
VEShapeLayer.DeleteShape Method ............................................................................ 299
VEShapeLayer.GetBoundingRectangle Method ........................................................... 299
VEShapeLayer.GetClusteredShapes Method ............................................................... 300
VEShapeLayer.GetDescription Method ......................................................................... 300
VEShapeLayer.GetShapeByID Method ......................................................................... 301
VEShapeLayer.GetShapeByIndex Method ................................................................... 301
VEShapeLayer.GetShapeCount Method ....................................................................... 302
VEShapeLayer.GetTitle Method .................................................................................... 302
VEShapeLayer.Hide Method ......................................................................................... 302
VEShapeLayer.IsVisible Method ................................................................................... 303
VEShapeLayer.SetClusteringConfiguration Method ...................................................... 303
VEShapeLayer.SetClusteringConfiguration(type, options) Method ........................... 303
VEShapeLayer.SetClusteringConfiguration(algorithm, options) Method ................... 304
VEShapeLayer.SetDescription Method ......................................................................... 305
VEShapeLayer.SetTitle Method ..................................................................................... 305
VEShapeLayer.Show Method ........................................................................................ 306
VEShapeAccuracy Enumeration .......................................................................................... 306
VEShapeSourceSpecification Class ..................................................................................... 307
VEShapeSourceSpecification Constructor ........................................................................ 308
VEShapeSourceSpecification Properties .......................................................................... 308
VEShapeSourceSpecification.Layer Property ............................................................... 309
VEShapeSourceSpecification.LayerSource Property .................................................... 309
VEShapeSourceSpecification.MaxImportedShapes Property ....................................... 309
VEShapeSourceSpecification.Type Property ................................................................ 310
VEShapeType Enumeration ................................................................................................. 310
VETileSourceSpecification Class ......................................................................................... 310
VETileSourceSpecification Constructor ............................................................................ 311
VETileSourceSpecification Properties............................................................................... 312
VETileSourceSpecification.Bounds Property ................................................................. 313
VETileSourceSpecification.GetTilePath Property .......................................................... 313
VETileSourceSpecification.ID Property ......................................................................... 314
VETileSourceSpecification.MaxZoomLevel Property .................................................... 314
VETileSourceSpecification.MinZoomLevel Property ..................................................... 314
VETileSourceSpecification.NumServers Property ......................................................... 315
VETileSourceSpecification.Opacity Property ................................................................. 315
VETileSourceSpecification.TileSource Property ............................................................ 315
VETileSourceSpecification.ZIndex Property .................................................................. 316
Bing Maps AJAX Control Troubleshooting and Support .......................................................... 316

Bing Maps AJAX Control, Version 6.3

Bing Maps ™ is an online mapping service that enables users to search, discover, explore, plan, and share information about specific locations. By using traditional road maps, labeled aerial photo views, low-angle high-resolution aerial photos, and proximity searching capabilities, Bing Maps provides unique opportunities for developers to incorporate both location and local search features into their Web applications.

The Bing Maps AJAX Control 6.3 software development kit (SDK), Version 6.3 consists of a complete set of reference topics that cover the Bing Maps AJAX Control 6.3 application programming interface (API). You can find information about the newest Bing Maps AJAX Control, Version 7.0, in the Version 7.0 SDK .

Bing Maps also provides an Interactive SDK available at http://www.microsoft.com/maps/isdk/ajax . The Interactive SDK offers hands-on, task-based demonstrations of features available in the version 6.3 API release, complete with code samples and links back to the reference SDK.

If you are reading this SDK online, you can download the Bing Maps AJAX Control SDK CHM file or PDF file for offline viewing.

Information about Microsoft's customer identification requirements can be found in the Getting Started with the Bing Maps AJAX Control topic or the Implementing Customer Identification article found in Bing Maps Articles.

The Bing Maps Silverlight Control, the Bing Maps SOAP Services, and the Bing Maps REST Services are also available for users looking to integrate location intelligence into their Web applications. More information about available Bing Maps APIs is found in the Getting Started with Bing Maps topic.

In This Section

 Getting Started with the Bing Maps AJAX Control

 What's New in the Map Control?

 Developing with the Bing Maps AJAX Control

 Bing Maps AJAX Control Class Reference

 Troubleshooting and Support

See Also

Terms and Conditions

Getting Started with the Bing Maps AJAX Control

The Bing Maps™ map control is a JavaScript control that contains the objects, methods, and events that allow you to display maps powered by Bing Maps on your Web site. The sections in this topic describe the steps you need to take to start using the Bing Maps AJAX Control 6.3.

Get Familiar with the Bing Maps AJAX Control

The Developing with the Bing Maps AJAX Control section of this SDK contains topics that describe how to use the features provided by the AJAX map control. For information about displaying a map on your Web page, see the Displaying a Map Using JavaScript topic or the Displaying an Embedded Map topic.

Register Your Map Control Application

Create a Bing Maps Account and Get a Key

Once you have created your Bing Maps AJAX Control 6.3 application, you need to register this application using the Bing Maps Account Center . The Bing Maps Account Center allows you to create a developer account and get a Bing Maps Key for use in your application. These steps are described in the Getting a Bing Maps Key topic.

Use the

After you have created a Bing Maps Account, available Bing Maps Keys appear in the Bing Maps Account Center. Copy the key associated with the Web site URL which corresponds to the application you are building and use this string value in the VEMap.SetCredentials Method as shown in the example below.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>

<title>SetCredentials</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?

v=6.3"></script>

<script type="text/javascript">

var map = null;

function GetMap()

{

map = new VEMap('myMap');

map.SetCredentials("Your Bing Maps Key");

map.LoadMap();

}

</script>

</head>

<body onload="GetMap();">

<div id='myMap' style="position:relative; width:600px; height:400px;"></div>

</body>

</html>

Session Counting

When the Bing Maps AJAX Control 6.3 is loaded with a valid Bing Maps Key, Bing Maps counts sessions. A session begins with the load of the Bing Maps AJAX Control 6.3 into a user’s browser and includes all Bing Maps AJAX Control 6.3 interactions until the browser is closed or the user moves to a different page. Information about Bing Maps usage reports is in Viewing Bing Maps Usage Reports .

If you are using tokens retrieved from the Bing Maps Token Service in your Bing Maps AJAX Control 6.3 application, transaction definitions can be found in the Viewing Bing Maps Transaction Reports topic.

See Also

VEMap.SetCredentials Method

VEMap.oncredentialserror Event

VEMap.oncredentialsvalid Event

What's New in the Map Control?

Welcome to the latest release of the Bing Maps AJAX Control 6.3. This is an overview of the new features in this release. For a detailed list of API changes, see the Version Changelist topic.

You can find information about the latest updates to the newest Bing Maps AJAX Control, Version 7.0, in the Version 7.0 SDK .

New Features

This release of the map control includes the following new features:

Core functionality version of the map control. The Bing Maps AJAX Control 6.3 is now available in both full functionality and core functionality versions. If you do not need enhanced map features, you can improve the performance of your application by using the core version of the latest map control. See the Using the Core Map Control topic for more information. Geocoding and search capabilities are available from the Bing Maps REST Web Services , which you can use in conjunction with the core map control as described in the Using the REST Services with the Core Map Control topic.

New Search and Geocode methods. The new VEMap.Search Method and the VEMap.Geocode Method provide an easier way to return the most accurate search results.

Drag-able pushpins With the latest version of the Bing Maps AJAX Control 6.3, your pushpins become drag-able by simply setting the VEShape.Draggable Property of the pushpin to true.

New map options. The color of the map dashboard, or navigation control, can now be changed to black using the VEMapOptions.DashboardColor Property . In addition, give your users easy access to search functionality by enabling the BingTM hovering search logo using the VEMapOptions.EnableSearchLogo Property and VEMapOptions.EnableClickableLogo Property .

New enhanced road map style. Bing Maps introduced a new enhanced road map style, which is in use on http://www.bing.com/maps . This style is designed to improve readability and interaction for imagery with data overlays. On July 6, 2011, this new enhanced road map style became the default and only road style available for all Bing Maps APIs.

Version Changelist

This topic describes the changes in the 6.3 release of the Bing Maps AJAX Control 6.3 SDK.

New Map Control Elements

The following API members are new in the 6.3 release of the map control.

Name

Description

VEGeocodeOptions Class

Contains additional geocoding options for the VEMap.Geocode Method .

VEMap.Geocode Method

Finds a geographic location based on a specified address or place name string as well as other geocoding options.

Name

Description

VEMap.Search Method

Performs a search based on a given query and options.

VEMapOptions.DashboardColor Property

A String that specifies whether the map dashboard, or navigation control, is colored blue or black. Valid values are ―blue‖ or ―black‖. The default value is ―blue‖.

VEMapOptions.EnableClickableLogo Property

A Boolean value indicating whether the BingTM logo on the map is clickable. The default value is false.

VEMapOptions.EnableSearchLogo Property

A Boolean value indicating whether to enable the BingTM hovering search logo on the map. The default value is false.

VEMapOptions.UseEnhancedRoadStyle Property

A Boolean value indicating whether to use the enhanced road map style. The default value is false.

VESearchOptions Class

Contains additional search options for the VEMap.Search Method .

VEShape.Draggable Property

A Boolean value indicating whether the VEShape icon on the map can be dragged using the mouse.

VEShape.ondrag Event

Occurs when a shape is being dragged across the map.

VEShape.onenddrag Event

Occurs when a shape drag has stopped.

VEShape.onstartdrag Event

Occurs when the user starts dragging the shape.

Developing with the Bing Maps AJAX Control

The Bing Maps™ map control is a JavaScript control that contains the objects, methods, and events that you need to display maps powered by Bing Maps on your Web site.

Using the

The topics in this section provide a walkthrough to help you start using the map control.

 Displaying a Map Using JavaScript

 Displaying an Embedded Map

 Controlling the Map

 Adding Shapes to a Map

 Using Routes and Directions

 Working with Bird's Eye Images

 Displaying 3D Maps

 Using Map Control Parameters

 Returning Localized Results

 Tracking Your Bing Maps Usage

 Bing Map Control Performance

 Using the Core Map Control

 Using the REST Services with the Core Map Control

Displaying a Map Using JavaScript

This topic describes using JavaScript to load the Bing Maps AJAX Control 6.3 into your Web page to display a map. This is the first step you need to take for any page that uses the map control.

If you do not need the full functionality of the Bing Maps AJAX Control 6.3 and just want to display a simple map on your Web page, you can use the embedded map feature of the map control. This is described in the Displaying an Embedded Map topic.

Also note that you can use the core version of the map control to enhance the performance of your map control. See Using the Core Map Control .

Displaying the Default Map

Displaying the default map, which includes all of the navigation functionality, consists of the following steps:

1. At the top of the HTML page add the following DOCTYPE declaration.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

2. In the header section of an HTML page, add a META element with the charset attribute set to "utf-8", as follows.

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

It is recommended that you use UTF-8 encoding in your web page.

3. Also in the header section, add a reference to the map control, as follows.

<script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3&mkt=en-us">

</script>

More information about using the mkt attribute to set the culture of the map is found in the Returning Localized Results topic.

4. In the body of the page, add a DIV element to the page to contain the map. The size of the map is defined by the height and width of the DIV element. The position of the map is set by using the "position", "top", and "left" properties. You can set these values either inline or by defining the values in a style class and then referencing that class, as follows.

<div id='myMap' style="position:absolute; width:400px; height:400px;"></div>

or

.map {

position: absolute;

top: 20;

left: 10;

width: 400px;

height: 400px;

border:#555555 2px solid;

}

...

<div id="map" class="map"></div>

If you do not specify a width, a default width of 600 pixels is used. The default height is 400 pixels. For cross-browser compatibility, you should always specify the position attribute (both "absolute" and "relative" are valid values). If you use a percentage width and or height in the map DIV, it is the percentage of the parent width or height, respectively.

5. Create a new instance of the VEMap Class and call the VEMap.LoadMap Method , as follows.

var map = new VEMap('myMap');

map.LoadMap();

In most cases you must call the call LoadMap method before you call a VEMap method or attempt to access a VEMap property. The exceptions, which you must call

after creating the new VEMap object but before you call the LoadMap method on that object, are:

 VEMap.onLoadMap Property

 VEMap.SetDashboardSize Method

Customizing the Map When Loading

You can also specify the location, zoom level, and map style of the map when you first load it. To do this, use the overloaded VEMap.LoadMap Method function as follows to pass in the location, zoom level, map style, whether the map is locked, map mode, whether to show the map mode switch, and how much of a tile buffer to display around the map.

var map = new VEMap('myMap');

map.LoadMap(new VELatLong(47.6, -122.33, 0, VEAltitudeMode.RelativeToGround), 10, VEMapStyle.Road, false, VEMapMode.Mode2D, true, 1);

Example

A complete Web page with all of the elements required to show a map may look like the following.

VirtualEarthSDK#0

See Also

Controlling the Map

Displaying an Embedded Map

This topic describes how to put simple map onto your Web page.

If you want the full functionality of the Bing Maps AJAX Control 6.3, then you need to use JavaScript to load the map control into your Web page. This is described in the Displaying a Map Using JavaScript topic.

You can also use the core version of the map control. See Using the Core Map Control .

Add a Simple Map

To embed a map into your Web page, add an iframe tag to your Web page and set the src parameter to the embedded map URL. The following code adds a simple Road map to a Web page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>

<title>Embedded Map</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>

<body style="font-family:Arial">

<p>A simple embedded map.</p>

<iframe width="400" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"

src="http://dev.virtualearth.net/embeddedMap/v1/ajax/road"/>

</body>

</html>

Use Embedded Map Features

You can customize your embedded map by adding parameters to the map URL. The following code sets the map style to Aerial and the zoom level to 10, then centers the map and adds a pushpin to the center.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>

<title>Embedded Map</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>

<body style="font-family:Arial">

<p>A simple embedded map.</p>

<iframe width="400" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"

src="http://dev.virtualearth.net/embeddedMap/v1/ajax/aerial?zoomLevel=10&center=47.5_-122.5&pushpins=47.5_-122.5"/>

</body>

</html>

Embedded Map URL Parameters

The embedded map URL is in the following format:

http://dev.virtualearth.net/embeddedMap/v1/ajax/{mapMode}?zoomLevel={zoomLevel}&center={center}&heading={heading}&pushpins={pushpins}&culture={culture}

The table below lists the available parameters for the map URL. These parameters can be in any order and are all optional.

Parameter Name

Description

mapMode

The style of the map. Valid values are: Road, Aerial, AerialWithLabels, Birdseye, BirdseyeWithLabels

zoomLevel

An int indicating a valid zoom level for the map style.

center

Two doubles separated by an underscore that are the latitude and longitude values of the coordinate of the center of the map.

heading

A double specifying the orientation of the map in degrees.

pushpins

Two doubles separated by an underscore that are the latitude and longitude values of the coordinate of the pushpin. Multiple pushpin locations are separated by a ~.

culture

A valid culture string. The default value is ―en-us‖.

See Also

Displaying a Map Using JavaScript

Controlling the Map

After you have a map on your Web page, you can programmatically change the map. You can change the map style, adjust the zoom level, pan the map to a new location, show and hide the default navigation control, and add your own controls to the map.

Changing the Map View

There are several ways you can programmatically change the map view. You can:

Zoom the map in or out by calling the VEMap.ZoomIn Method and VEMap.ZoomOut Method .

Zoom to a specific level by calling the VEMap.SetZoomLevel Method .

Set the center of the map by calling the VEMap.SetCenter Method , or set the center of the map and zoom in by calling the VEMap.SetCenterAndZoom Method .

Change the map style by calling the VEMap.SetMapStyle Method .

Let Bing Maps determine the best map to show, based on your set of points, pushpins, or polylines. You accomplish this by passing an array of points or lines to the VEMap.SetMapView Method .

Showing and Hiding Controls

You can show and hide the default map navigation control by calling the VEMap.HideDashboard Method and VEMap.ShowDashboard Method . You can also create your own map navigation control in HTML, and then add the control to the map by calling the VEMap.AddControl Method .

Adding Shapes to a Map

You can use shapes for tasks such as marking locations, highlighting geographical boundaries, and displaying information on a map.

Shape Basics

There are three types of shapes: pushpins, polylines, and polygons. These correspond to a point, a line, and a polygon, respectively, on a map. With the release of Version 5, all shape objects are consolidated under the VEShape Class . You can add shapes directly to the base layer of a map, or use the VEShapeLayer Class to create shape layers, which you can then use to create and manage arbitrary groups of shapes. Once the shape objects are added, you can set and get shape properties by calling methods against each object directly.

VEMap Shape Methods

Use the VEMap Class to add shapes to a map's base layer. This method adds an existing VEShape object to the base layer of the map. Use the VEMap.DeleteShape Method to delete a single shape from the base layer, and VEMap.DeleteAllShapes Method to delete all shape objects from the base layer.

VEShapeLayer Shape Methods

Use the VEShapeLayer.AddShape Method to add a shape. Use the VEShapeLayer.DeleteShape Method to delete a single shape from a layer, and VEShapeLayer.DeleteAllShapes Method method to delete all shape objects from a layer.

Setting and Getting VEShape Object Properties

Once a shape has been added to a map, use the methods of the VEShape class to set and get the shape's properties. These properties control aspects of the shape such as line color and width, fill color and transparency, custom icon, image file, Latitude/Longitude coordinates, and more. As of Version 5, the title and description properties can contain custom HTML, which you can use to further extend and modify your shapes.

Adding a Shape to a Map

Adding a shape to a map consists of the following steps:

1. Define an array of VELatLong objects. Polygon objects require a minimum of three points, polyline objects require a minimum of two points, and pushpin objects require only one point which can be part of an array (the method uses the first VELatLong object), or a single VELatLong object.

var points = new Array(

new VELatLong(45.01188,-111.06687, 0, VEAltitudeMode. RelativeToGround),

new VELatLong(45.01534,-104.06324, 0, VEAltitudeMode. RelativeToGround),

new VELatLong(41.01929,-104.06, 0, VEAltitudeMode. RelativeToGround),

new VELatLong(41.003,-111.05878, 0, VEAltitudeMode. RelativeToGround)

);

2. Create the VEShape object. The following code creates a new polygon shape, "myPolygon", at the specified coordinates.

var myPolygon = new VEShape(VEShapeType.Polygon, points);

3. Add the VEShape object named "myPolygon" to the map.

var myPolygon = map.AddShape(myPolygon);

4. Edit the properties of the shape. In this example we will add strings for the title and description of the shape. Although this example shows only text, these strings can also contain valid HTML.

myPolygon.SetTitle("My Polygon");

myPolygon.SetDescription("This is the description for my polygon.");

The resulting code for the entire page might look something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>

<title>Adding a Shape to a Map</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"> </script>

<script type="text/javascript">

var map = null;

var points = new Array(

new VELatLong(45.01188,-111.06687, 0, VEAltitudeMode. RelativeToGround),

new VELatLong(45.01534,-104.06324, 0, VEAltitudeMode. RelativeToGround),

new VELatLong(41.01929,-104.06, 0, VEAltitudeMode. RelativeToGround),

new VELatLong(41.003,-111.05878, 0, VEAltitudeMode. RelativeToGround)

);

function GetMap()

{

map = new VEMap('myMap');

map.LoadMap();

var myPolygon = new VEShape(VEShapeType.Polygon, points);

map.AddShape(myPolygon);

myPolygon.SetTitle("My Polygon");

myPolygon.SetDescription("This is the description for my polygon.");

}

</script>

</head>

<body onload="GetMap();">

<div id='myMap' style="position:relative; width:400px; height:400px;"></div>

</body>

</html>

Adding a Shape Layer to a Map

Shape layers make it possible to create and manage multiple collections of shapes within a single map. Adding a shape to a shape layer consists of the following steps.

1. Initialize a new instance of the VEShapeLayer class VEShapeLayer Class .

var myShapeLayer = new VEShapeLayer();

2. Add the shape layer to the map, using the VEMap.AddShapeLayer Method.

map.AddShapeLayer(myShapeLayer);

The shape layer is invisible on its own, so let's add a shape object to the layer.

3. Define an array of VELatLong objects.

var points = new Array(

new VELatLong(45.01188,-111.06687, 0, VEAltitudeMode. RelativeToGround),

new VELatLong(45.01534,-104.06324, 0, VEAltitudeMode. RelativeToGround),

new VELatLong(41.01929,-104.06, 0, VEAltitudeMode. RelativeToGround),

new VELatLong(41.003,-111.05878, 0, VEAltitudeMode. RelativeToGround)

);

4. Create a VEShape object to add to the map.

var myShape = new VEShape(VEShapeType.Polygon, points);

5. Use the VEShapeLayer.AddShape method to add the shape to the shape layer.

myShapeLayer.AddShape(myShape);

The resulting code for the entire page might look something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>

<title>Adding a Shape to a Map</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>

<script type="text/javascript">

var map = null;

var points = new Array(

new VELatLong(45.01188,-111.06687, 0, VEAltitudeMode. RelativeToGround),

new VELatLong(45.01534,-104.06324, 0, VEAltitudeMode. RelativeToGround),

new VELatLong(41.01929,-104.06, 0, VEAltitudeMode. RelativeToGround),

new VELatLong(41.003,-111.05878, 0, VEAltitudeMode. RelativeToGround)

);

function GetMap()

{

map = new VEMap('myMap');

map.LoadMap();

var myShapeLayer = new VEShapeLayer();

map.AddShapeLayer(myShapeLayer);

var myShape = new VEShape(VEShapeType.Polygon, points);

myShapeLayer.AddShape(myShape);

}

</script>

</head>

<body onload="GetMap();">

<div id='myMap' style="position:relative; width:400px; height:400px;"></div>

</body>

</html>

Using Routes and Directions

You can use the Bing Maps routing and driving directions feature to show routes on your custom maps. Routes are automatically drawn on the map, and you can customize the driving directions by writing your own event handler.

Getting a Route

If you want to display a driving route from one point to another on the map, with possible interim points, call the VEMap.GetDirections Method . Any point can be specified as an address, place name, or VELatLong Class object. The following examples are both valid.

var myOptions = new VERouteOptions();

myOptions.SetBestMapView = false; // Don't change map view

myOptions.RouteCallback = myRouteHandler; // Gets VERoute

map.GetDirections(["space needle", "LA Coliseum", "area 51"], myOptions);

map.GetDirections(["1 Microsoft Way, 98052", new VELatLong(47.969,-122.39, 0, VEAltitudeMode.RelativeToGround)], myOptions);

The route is drawn on the map with start and end icons and waypoint icons. Each of the icons has a default enhanced preview that displays the driving directions for that step. The myRouteHandler function gets a VERoute Class object, which you can use to display the driving directions.

Showing Driving Directions

The VERoute object contains the details about the route, including the driving directions. When calling the GetDirections method, you can specify a callback function to handle the VERoute object and use the information to display driving directions. The following example shows how to display the route information in a JavaScript alert.

function myRouteHandler(route)

{

// Unroll route and populate alert text

var legs = route.RouteLegs;

var turns = "Turn-by-Turn Directions\n";

var leg = null;

var turnNum = 0; // The turn #

var totalDistance = 0; // The sum of all leg distances

// Get intermediate legs

for(var i = 0; i < legs.length; i++)

{

// Get this leg so we don't have to dereference multiple times

leg = legs[i]; // Leg is a VERouteLeg object

// Unroll each intermediate leg

var turn = null; // The itinerary leg

var legDistance = null; // The distance for this leg

for(var j = 0; j < leg.Itinerary.Items.length; j ++)

{

turnNum++;

// turn is a VERouteItineraryItem object

turn = leg.Itinerary.Items[j];

turns += turnNum + ": " + turn.Text;

legDistance = turn.Distance;

totalDistance += legDistance;

// Round distances to 1/10ths

// Note that miles is the default

turns += " (" + legDistance.toFixed(1) + " miles)\n";

}

}

turns += "Total distance: " + totalDistance.toFixed(1) + " miles\n";

// Show directions

alert(turns);

}

Returning Localized Directions

Information about returning localized directions including how to set the map control culture and a list of supported cultures can be found in the Returning Localized Results topic.

If the localized content should be in kilometers instead of miles, set the VERouteOptions.DistanceUnit Property to VERouteDistanceUnit.Kilometer.

Changing the Defaults

By default, the route is calculated in the order in which the locations are specified, and distances are calculated in miles. However, you can specify the shortest route by distance or quickest route by time and change the units to kilometers by setting the appropriate VERouteOptions Class properties, as follows.

myOptions.RouteOptimize = VERouteOptimize.MinimizeDistance;

myOptions.RouteOptimize = VERouteOptimize.MinimizeTime;

myOptions.DistanceUnit = VERouteDistanceUnit.Kilometer;

Working with Bird's Eye Images

Bird's eye images are low-angle, very high-resolution aerial images. Unlike the other map styles, bird's eye images exist only for specific regions and do not provide continuous map coverage.

The Bing Maps AJAX Control 6.3 has built-in support for the bird's eye image type. You do not need to add any additional code to your Web page to enable your users to see bird's eye images.

If users move the map to a region where bird's eye images are available, the map navigation control changes automatically.

However, there may be times when you want to show a specific bird's eye image or create your own bird's eye navigation control. This topic explains how to programmatically use bird's eye images.

Determining Whether Bird's Eye Images Are Available

You can determine whether bird's eye images are available at any point on the map by calling the VEMap.IsBirdseyeAvailable Method .

Example

Suppose you want to let users know when the map is centered on a location that has bird's eye images. You need to determine whether images are available at the center of the map whenever the user moves the map to a new location. To do this, attach a function to the VEMap.onchangeview Event . In the function you attach, call the IsBirdseyeAvailable method. If the IsBirdseyeAvailable method returns a value of True, notify the user. Your code may look like the following.

map = new VEMap('myMap');

map.LoadMap(new VELatLong(33.756, -84.37), 14 ,'r' ,false);

map.AttachEvent('onchangeview', onChangeView);

//...

function onChangeView(e)

{

if (map.IsBirdseyeAvailable())

{

alert("Bird's Eye images are available at the center of the map");

}

}

Switching to Bird's Eye View

To programmatically switch the current map view to use bird's eye images, call the VEMap.SetMapStyle Method as follows.

map.SetMapStyle(VEMapStyle.Birdseye)

When the map style changes to use bird's eye, the map navigation control also changes to include the bird's eye navigation controls.

Using the VEBirdseyeScene Object

The VEBirdseyeScene Class object provides additional functionality when you are working with bird's eye images. By using this object, you can:

Determine whether a point on the globe (a VELatLong Class object) is within the currently displayed bird's eye image by calling the VEBirdseyeScene.ContainsLatLong Method .

Determine the orientation of the current image by calling the VEBirdseyeScene.GetOrientation Method .

Displaying 3D Maps

On November 2, 2010, the end-of-life was announced for the 3D control. Effective December 1, 2011, the 3D control will no longer function. The full announcement is found at: http://www.bing.com/community/site_blogs/b/maps/archive/2010/11/02/changes-to- bird-s-eye-and-3d-maps.aspx

The Bing Maps AJAX Control 6.3 includes the ability to display a three-dimensional view of the world so that you can you to incorporate the same Bing Maps 3D experience found at the Bing Maps Web site into your own Web sites.

Enabling 3D maps

Because the three-dimensional map functionality is built in to the same map control as the standard two-dimensional maps, you do not need to change how you build your map-enabled Web site. You can program against the new 3D APIs in the same way that you use the 2D APIs. On the programming side, including the 3D maps in your existing sites requires very little additional effort.

However, because of the complexity and the graphics-intensive nature of the Bing Maps 3D maps, software must be installed on the client computer, and the client computer must have sufficient hardware to display the maps. The software, called Bing Maps 3D, requires the following on the client computer:

Microsoft Windows XP Service Pack 2, Microsoft Windows Server 2003, or Microsoft Windows Vista

Microsoft Internet Explorer 6, 7 or 8, including 64-bit versions, or Mozilla Firefox 2.0 or 3.0.

Microsoft .NET Framework version 2.0

250 MB or more of hard disk space

A 1.0 GHz processor (2.8 GHz or faster recommended)

256 MB of system memory (1 GB recommended)

32-MB video card (256 MB recommended) that supports Microsoft DirectX 9, with 3D hardware acceleration enabled

A high-speed or broadband Internet connection

Verifying the Requirements

Because there are several client-side requirements that users don't need when viewing the standard two-dimensional maps, you should provide an appropriate user interface to verify that the Bing Maps 3D control is installed. To do this, use the VEMap.AttachEvent Method to attach the VEMap.onmodenotavailable Event to your VEMap Class object. If the software is not yet installed on the client computer when the map mode is changed to 3D mode, this event fires. You can then provide instructions on installing the software.

For example, the following code creates a new VEMap object, attaches the onmodenotavailable event, and loads the map. When run on a computer without the software installed, the event handler is called when the map is switched to 3D mode. The event handler provides instructions to the customer on how to install the Bing Maps 3D software.

map=null;

function onPageLoad()

{

map = new VEMap('map');

map.LoadMap();

map.AttachEvent('onmodenotavailable', No3DInstalled);

}

function No3DInstalled ()

{

alert('Before viewing the maps in 3D mode, '+

'you must install the Bing Maps 3D software on your computer.' +

'\nTo install the software, visit ' +

'http://go.microsoft.com/fwlink/?LinkId=72623.');

}

The link to the installation program for the Bing Maps 3D software (and its prerequisites) is http://go.microsoft.com/fwlink/?LinkId=72623.

Issues when Using 3D Mode

Because Bing Maps 3D is an embedded control on your Web page, certain web-based events and properties behave differently from the traditional 2D maps. Consider the following situations when designing your site to use 3D maps:

Custom controls or Web elements that you display on top of a 2D map will be hidden behind the 3D map. You can prevent this by using an IFRAME "shim" for each control. For more information, see the VEMap.AddControl Method topic and code example.

The default find control is also hidden when the map mode is switched to 3D mode. To prevent this call the VEMap.ShowFindControl Method when the map mode is changed.

When the Bing Maps 3D control has focus, it captures keyboard and mouse events and handles them. Map Control events are passed from the Bing Maps 3D control, so you can continue to use all of them except VEMap.onstartpan Event . Page-level events will not fire when the Bing Maps 3D control has focus.

Other map enhancements, including pushpins, custom pushpin and tile layers, polylines, and polygons work in both 2D and 3D mode maps.

The client computer cannot have more than one instance of the 3D map running in the same process at the same time.

Disabling 3D maps

Because the additional requirements for displaying 3D maps, you may want to prevent users from switching to 3D mode. You can do this by setting the showSwitch parameter of the VEMap.LoadMap Method to false.

Using Map Control Parameters

This topic describes map control parameters.

Parameters

The following table contains available parameters for the map control handler.

Parameter

Values

Description

v

6.2, 6.3, 6.3c

Specifies a major API version. The default value is the latest version, which is 6.3. For information about using version 6.3c, see Using the Core Map Control .

mkt

See the Returning Localized Results topic for a list of values.

Specifies the market to use, which defines the language Bing Maps uses. The default value is "en-US" (English).

onscriptload

A string specifying a function name.

Specifies the name of a JavaScript function to call when the map control script is loaded. The name must contain only alphanumeric characters.

The CSS and tiles will not be loaded when this function is called.

(This parameter is useful for loading the map control script from an UpdatePanel in ASP.NET Ajax. Users can call

Parameter

Values

Description

Sys.Application.notifyScriptLoaded from their callback to tell ASP.NET Ajax the script has loaded.)

Adding Parameters

To add a parameter to the map control src URL, add a "?", the parameter, and set it "=" to one of the allowable values. Use "&" to separate parameters.

The following example sets the map control version to 6.3 and the market to Italian.

<script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3&mkt=it-IT">

</script>

See Also

Displaying a Map Using JavaScript

Returning Localized Results

Returning Localized Results

The Bing Maps AJAX Control 6.3 provides the ability to return results in different languages.

Setting the Culture

By default the map control features are provided in the culture English-United States (en-US). However, the map control culture can be changed by adding the mkt parameter to the map control reference, as in the following example, which sets the culture to French-France (fr-FR).

<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3&mkt=fr-fr"></script>

More information about setting map control parameters is found in the Using Map Control Parameters topic.

Supported Cultures

Depending on the culture specified in the map control reference, the following items are returned in the language of the culture:

The map control dashboard. The dashboard is the default interface for controlling the map (the compass-and-zoom control).

3D setup and instructional dialog boxes.

The VEPlace.Name Property of the results returned by the VEMap.Find Method

The VERouteItineraryItem.Text Property for each VERouteItineraryItem in the VERouteItinerary.Items array returned by the VEMap.GetDirections Method . Some locales are only supported by VEMap.GetDirections when you set the VERouteOptions.UseMWS Property to true.

Map labels for Road and Hybrid map styles.

The following table lists supported cultures for the map control and available features for each culture. If you set the map control mkt parameter to a value not found in this table, the map control will not load.

Language - Country/Region

Culture

Feature Support

Czech - Czech Republic

cs-CZ

VEMap.Find, VEMap.GetDirections

Danish - Denmark

da-DK

VEMap.Find, VEMap.GetDirections

Dutch - Belgium

nl-BE

Map labels

Dutch - Netherlands

nl-NL

VEMap.Find, VEMap.GetDirections

English - Australia

en-AU

VEMap.GetDirections using MWS

English - Canada

en-CA

Map control dashboard, VEMap.Find, VEMap.GetDirections using MWS

English - India*

en-IN*

VEMap.GetDirections using MWS*

English - United Kingdom

en-GB

VEMap.GetDirections using MWS

English - United States

en-US

All features. This is the default culture.

Finnish -Finland

fi-FI

VEMap.Find, VEMap.GetDirections

French - Canada

fr-CA

Map control dashboard, 3D dialogs, VEMap.Find, VEMap.GetDirections, map labels

French - France

fr-FR

Map control dashboard, 3D dialogs, VEMap.Find, VEMap.GetDirections, map labels

German - Germany

de-DE

Map control dashboard,

Language - Country/Region

Culture

Feature Support

VEMap.Find, VEMap.GetDirections, map labels

Italian - Italy

it-IT

Map control dashboard, 3D dialogs, VEMap.Find, VEMap.GetDirections, map labels

Japanese - Japan

ja-JP

Map control dashboard, 3D dialogs, VEMap.Find, map labels

Norwegian (Bokmal) - Norway

nb-NO

VEMap.Find, VEMap.GetDirections

Portuguese - Brazil

Pt-BR

VEMap.Find, VEMap.GetDirections

Portuguese - Portugal

pt-PT

VEMap.Find, VEMap.GetDirections

Spanish - Mexico

es-MX

VEMap.GetDirections using MWS, map labels

Spanish - Spain

es-ES

Map control dashboard, VEMap.Find, VEMap.GetDirections, map labels

Spanish - United States

es-US

Map control dashboard, VEMap.Find, VEMap.GetDirections using MWS, map labels

Swedish - Sweden

sv-SE

VEMap.Find, VEMap.GetDirections

* The src for the fully supported India map control is http://dev.mapindia.live.com/mapcontrol/mapcontrol.ashx?v=6.2 . Information about this map control is found at http://dev.mapindia.live.com/sdk .

Remarks

If you set the VERouteOptions.UseMWS Property to true and use the VEMap.GetDirections Method with a supported culture, the MapPoint Web Service will return the route directions in the neutral language of that culture. See the Supported Languages topic in the Microsoft MapPoint Web Service SDK for more information.

VEMap.GetRoute is deprecated and will ignore specified cultures.

Error messages are always displayed in English - United States.

See Also

VEMap.Find Method

VEMap.GetDirections Method

VEMap.ShowDashboard Method

VEPlace Class

VERoute Class

Tracking Your Bing Maps Usage

Bing Maps Keys are the recommended authentication method for accessing the Bing Maps AJAX Control 6.3 as described in Getting a Bing Maps Key. Information about transaction accounting provided by Bing Maps Keys is in Understanding Bing Maps Usage Reports. If you are an existing customer using tokens, consider updating your application to use Bing Maps Keys. See the Getting Started with the Bing Maps AJAX Control topic.

This topic provides information about Bing Maps Tokens.

Using Tokens for Identification

In order for Bing Maps to track your map control usage, every map control request that your application sends to the Bing Maps servers must be identified as belonging to you. The Bing Maps Token Service is provided to generate a unique string, called a token, which identifies you. Use the VEMap.SetClientToken Method to set this token before the map control is loaded. Then all further requests to the Bing Maps servers are identified as requests made by you.

See the Implementing Customer Identification article and the Bing Maps Token Service for more information about the Bing Maps Token Service. Note that you must be a Bing Maps customer to use the Bing Maps Token Service.

Tracking Transactions

All map control requests sent to the Bing Maps servers after a valid Bing Maps token is set using the VEMap.SetClientToken Method are tracked. The following Bing Maps methods make server requests:

Any time new map tiles are requested from Bing Maps. This includes VEMap.LoadMap, VEMap.ZoomIn, VEMap.ZoomOut, VEMap.Pan, VEMap.SetMapView, and many other methods that cause the map to move. If traffic display is turned on using VEMap.ShowTraffic, requests for traffic map tiles are tracked as well.

Any time Bing Maps AJAX Control 6.3 makes a where-only request for a find result. This includes where-only requests from the VEMap.Find method as well as the VEMap.GetDirections method.

Each request made using the VEMap.FindLocations method.

Each request made using the VEMap.GetDirections method.

Viewing Reports

You can view reports detailing your Bing Maps AJAX Control 6.3 usage. See the Implementing Customer Identification article for more information.

See Also

VEMap.SetClientToken Method

VEMap.ontokenerror Event

VEMap.ontokenexpire Event

Bing Map Control Performance

To give end users the best possible performance, Microsoft Bing Maps AJAX Control 6.3 offers the following improvements.

Core Functionality Version

Both full functionality and core functionality versions of the Bing Maps AJAX Control 6.3 are available. If you do not need enhanced map features, you can improve the performance of your application by using the core version of the map control. See the Using the Core Map Control topic for more information. Geocoding and routing capabilities are available from the Bing Maps REST API, which you can use in conjunction with the core map control as described in the Using the REST Services with the Core Map Control topic.

Quicker Content Delivery with Advanced Network Technology

Microsoft Content Delivery Network (CDN) support. The addition of CDN to the Bing Maps core infrastructure has improved delivery speeds of Bing Maps content up to 82%. CDN is a key pillar of Microsoft’s cloud computing strategy and is one of the primary investments the Bing Maps Platform team has made to increase overall platform performance. CDN is comprised of multiple worldwide datacenters that allow Microsoft to host Bing Maps content closer to end users.

To use CDN, set the map control src reference to the CDN URL, as demonstrated in the code below.

<script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3&mkt=en-us"></script>

The map control found at http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3 does not use CDN, but will remain available for backwards compatibility.

Faster Rendering of Map Details

Add custom layer method. The VEMap.AddCustomLayer Method quickly adds custom data to the map.

Add bulk pushpins. The Bing Maps AJAX Control 6.3 allows you to bulk add pushpins to the map. The time to add these pushpins to the map is close to half the time it takes to add these pushpins using the traditional method. The code below demonstrates this feature.

// Create an array with a large number of pushpins:

var center = map.GetCenter();

var shapes = new Array();

for (i=0 ; i < 150; ++i)

{

var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(center.Latitude + Math.random()*20 - 10, center.Longitude + Math.random()*20 - 10));

shapes.push(shape);

}

// Create an empty shape layer and add it to the map:

var shapeLayer = new VEShapeLayer();

map.AddShapeLayer(shapeLayer);

// Add the array of pushpins to the shape layer:

shapeLayer.AddShape(shapes);

Route rendering optimization. The Bing Maps AJAX Control 6.3 contains logic to optimize by zoom level the number of route points needed to display a route on the map. When the map is zoomed out, the route is rendered with fewer points.

In addition to the map control performance features above, you can further improve the performance of your web page by following tips in the Performance and Load Testing in Bing Maps article in the Bing Maps Articles.

See Also

Displaying a Map Using JavaScript

Using the Core Map Control

If you do not need enhanced map features, you can improve the performance of your application by using the core version of the map control. This topic includes information about how to load the core map control as well as the map control APIs that are supported in the core version.

Loading the Core Map Control

To load the core map control, set the v parameter of the map control to 6.3c. Your script tag in the header of your web page now looks like this:

<script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3c&mkt=en-us"></script>

Core Map Control API

The following APIs are supported in the core version of Bing Maps AJAX Control 6.3. If you need geocoding or search functionality, you can use the Bing Maps REST Services in conjunction with the core map control as described in the Using the REST Services with the Core Map Control topic.

The core version of the map control is only supported on the following browsers: Internet Explorer 7, Internet Explorer 8, Firefox 3.5, Firefox 3.6, Safari 4, and Google Chrome.

Supported Types

Type

Supported Members

VEDistanceUnit Enumeration

All members are supported.

VEException Class

All members are supported.

VELatLong Class

All members are supported.

VELatLongRectangle Class

All members are supported.

VEMap Class

Supported members are listed in the VEMap member tables below.

VEMapOptions Class

All members are supported.

VEMapStyle Enumeration

All members are supported.

VEMapViewSpecification Class

All members are supported.

VEPixel Class

All members are supported.

VEShape Class

Supported members are listed in the VEShape member tables below.

Type

Supported Members

VEShapeLayer Class

Supported members are listed in the VEShapeLayer member tables below.

VEShapeType Enumeration

VEShapeType.Pushpin

VETileSourceSpecification Class

All members are supported.

Supported VEMap Members

The following members of the VEMap Class are supported in the core version of the map control.

Public Constructor

Name

Description

VEMap Constructor

Initializes a new instance of the VEMap Class .

Public Events

Name

Description

VEMap.onkeypress Event

Occurs when a key is pressed and released.

VEMap.onkeydown Event

Occurs when a key is pressed (but before it is released).

VEMap.onkeyup Event

Occurs when a key is released.

VEMap.onclick Event

Occurs when a left or right mouse button is single-clicked.

VEMap.ondoubleclick Event

Occurs when a left mouse button is double-clicked.

VEMap.onmousedown Event

Occurs when a mouse button (left, right, or middle) is clicked (but before it is released).

VEMap.onmousemove Event

Occurs when the mouse cursor moves.

VEMap.onmouseout Event

Occurs when the mouse cursor moves away from a VEShape object.

VEMap.onmouseover Event

Occurs when the mouse cursor moves over a VEShape Class object.

VEMap.onmouseup Event

Occurs when a mouse button (left, right, or middle) is released.

VEMap.onmousewheel Event

Occurs when the mouse wheel is moved.

Name

Description

VEMap.onchangemapstyle Event

Occurs when the map style changes.

VEMap.onchangeview Event

Occurs whenever the map view changes.

VEMap.oncredentialserror Event

Occurs when the map control makes a request to the Bing Maps servers and the credentials that were set using the VEMap.SetCredentials Method are invalid.

VEMap.oncredentialsvalid Event

Occurs when the map control makes a request to the Bing Maps servers and the credentials that were set using the VEMap.SetCredentials Method are valid.

VEMap.onendpan Event

Occurs when a pan of the map ends.

VEMap.onendzoom Event

Occurs when the map zoom ends.

VEMap.onerror Event

Occurs when there is a map control error.

VEMap.oninitmode Event

Occurs after the map mode changes and the map has reloaded.

VEMap.onresize Event

Occurs when the map is resized.

VEMap.onstartpan Event

Occurs when a pan of the map begins.

VEMap.onstartzoom Event

Occurs when the map zoom begins.

Public Methods

Name

Description

VEMap.AddControl Method

Adds a custom control to the map.

VEMap.AddCustomLayer Method

Adds a custom layer to the map.

VEMap.AddShape Method

Adds an existing VEShape Class object, as specified by the shape parameter, to the base layer. The core version of this method does not support adding shape arrays. Also note that the core version of the map control only supports VEShape objects that are of type VEShapeType.Pushpin.

VEMap.AddShapeLayer Method

Adds the specified shape layer to the map.

VEMap.AddTileLayer Method

Adds a tile layer to the map, and if the visibleOnLoad parameter is true, it also shows

Name

Description

it on the map.

VEMap.AttachEvent Method

Attaches a Map Control event to a specified function.

VEMap.Clear Method

Removes all shapes, shape layers, and search results on the map. Also removes the route from the map, if one is displayed.

VEMap.ClearInfoBoxStyles Method

Clears out all of the default Bing Maps info box CSS styles.

VEMap.ClearTraffic Method

Clears the traffic map.

VEMap.DeleteControl Method

Removes the specified control from the map.

VEMap.DeleteAllShapes Method

Deletes all shapes in all layers, leaving empty layers behind.

VEMap.DeleteAllShapeLayers Method

Deletes all shape layers, along with any shapes within the layers.

VEMap.DeleteShape Method

Deletes a VEShape Class object from any layer, including the base map layer.

VEMap.DeleteShapeLayer Method

Deletes the specified shape layer from the map.

VEMap.DeleteTileLayer Method

Deletes a tile layer from view.

VEMap.DetachEvent Method

Detaches the specified map control event so that it no longer calls the specified function.

VEMap.Dispose Method

Deletes the VEMap object and releases any associated resources

VEMap.EndContinuousPan Method

Stops the continuous map panning initiated by a call to the VEMap.StartContinuousPan Method .

VEMap.GetCenter Method

Returns a VELatLong Class object that represents the location of the center of the current map view.

VEMap.GetLeft Method

Returns the pixel value of the left edge of the map control.

VEMap.GetMapStyle Method

Returns the current map style.

VEMap.GetMapView Method

Returns the current map view object as a

Name

Description

VELatLongRectangle Class object.

VEMap.GetShapeByID Method

Gets the reference to a VEShape Class object based on its internal identifier.

VEMap.GetShapeLayerByIndex Method

Gets the reference to a VEShapeLayer Class object based on its index.

VEMap.GetShapeLayerCount Method

Gets the total number of shape layers on the map.

VEMap.GetTileLayerByID Method

Gets a tile layer based upon its identifier.

VEMap.GetTileLayerByIndex Method

Gets a tile layer based upon an index value.

VEMap.GetTileLayerCount Method

Gets the number of tile layers.

VEMap.GetTop Method

Returns the pixel value of the top edge of the map control.

VEMap.GetVersion Method

Returns the current version of the map control.

VEMap.GetZoomLevel Method

Returns the current zoom level of the map.

VEMap.HideBaseTileLayer Method

Hides the base tile layer of the map.

VEMap.HideControl Method

Hides the specified control from view.

VEMap.HideDashboard Method

Hides the default user interface for controlling the map (the compass and the zoom control).

VEMap.HideInfoBox Method

Hides a shape's custom or default info box.

VEMap.HideScalebar Method

Hides the scale bar from the map.

VEMap.HideAllShapeLayers Method

Hides all of the shape layers on the map.

VEMap.HideTileLayer Method

Hides a tile layer from view.

VEMap.HideTrafficLegend Method

Hides the traffic legend.

VEMap.IncludePointInView Method

Changes the map view so that it includes both the specified VELatLong Class point and the center point of the current map.

VEMap.LatLongToPixel Method

Converts an array of VELatLong Class objects (latitude/longitude pair) to an array of VEPixel Class objects.

VEMap.LoadMap Method

Loads the specified map. All parameters are optional.

Name

Description

VEMap.LoadTraffic Method

Loads the traffic map.

VEMap.Pan Method

Moves the map the specified amount.

VEMap.PanToLatLong Method

Pans the map to a specific latitude and longitude.

VEMap.PixelToLatLong Method

Converts a pixel (a point on the map) to a VELatLong Class object (latitude/longitude pair).

VEMap.RemoveCustomLayer Method

Removes a custom layer from the map.

VEMap.Resize Method

Resizes the map based on the specified width and height.

VEMap.SetCenter Method

Centers the map to a specific latitude and longitude.

VEMap.SetCenterAndZoom Method

Centers the map to a specific latitude and longitude and sets the zoom level.

VEMap.SetCredentials Method

Sets the credentials to use to authenticate map service requests.

VEMap.SetDefaultInfoBoxStyles Method

Sets the info box CSS styles back to their original classes.

VEMap.SetMapStyle Method

Sets the style of the map.

VEMap.SetMapView Method

Sets the map view to include all of the points, lines, or polygons specified in the provided array, or to the view defined by a VEMapViewSpecification Class object.

VEMap.SetMouseWheelZoomToCenter Method

Specifies whether to zoom to the center of the screen or to the cursor position on the screen.

VEMap.SetScaleBarDistanceUnit Method

Sets the distance unit (kilometers or miles) for the map scale.

VEMap.SetTileBuffer Method

Sets the number of "rings" of map tiles that should be loaded outside of the visible mapview area.

VEMap.SetTrafficLegendText Method

Specifies the text shown with the traffic legend, if visible.

VEMap.SetZoomLevel Method

Sets the view of the map to the specified zoom

Name

Description

level.

VEMap.ShowAllShapeLayers Method

Shows all shape layers on the map.

VEMap.ShowBaseTileLayer Method

Shows the base tile layer of the map.

VEMap.ShowControl Method

Makes the specified control visible. This method only affects control elements that have been hidden from view using the VEMap.HideControl Method .

VEMap.ShowDashboard Method

Shows the default user interface for controlling the map (the compass-and-zoom control). By default, this control is shown.

VEMap.ShowInfoBox Method

Shows a shape's custom or default info box.

VEMap.ShowMessage Method

Displays the specified message in a dialog box on the map.

VEMap.ShowScalebar Method

Displays the scale bar on the map.

VEMap.ShowTileLayer Method

Shows a tile layer from view.

VEMap.ShowTrafficLegend Method

Displays the traffic legend.

VEMap.StartContinuousPan Method

Moves the map in the specified direction until the VEMap.EndContinuousPan Method is called.

VEMap.ZoomIn Method

Increases the map zoom level by 1.

VEMap.ZoomOut Method

Decreases the map zoom level by 1.

Public Properties

Name

Description

VEMap.onLoadMap Property

Specifies the function to call when the map is first loaded.

Supported VEShape Members

The following members of the VEShape Class are supported in the core version of the map control.

The core version of the map control only supports VEShape objects that are of type VEShapeType.Pushpin.

Public Constructor

Name

Description

VEShape Constructor

Initializes a new instance of the VEShape Class .

Public Events

Name

Description

VEShape.ondrag Event

Occurs when a shape is being dragged across the map.

VEShape.onenddrag Event

Occurs when a shape drag has stopped.

VEShape.onstartdrag Event

Occurs when the user starts dragging the shape.

Public Methods

Name

Description

VEShape.GetCustomIcon Method

Gets the VEShape object's custom icon.

VEShape.GetDescription Method

Gets the description of the VEShape object.

VEShape.GetIconAnchor Method

Gets a VELatLong Class object representing the shape's custom icon anchor point.

VEShape.GetID Method

Gets the internal identifier of the VEShape object.

VEShape.GetMaxZoomLevel Method

Gets the maximum zoom level at which the shape is visible.

VEShape.GetMinZoomLevel Method

Gets the minimum zoom level at which the shape is visible.

VEShape.GetPoints Method

Returns an array of VELatLong Class objects representing the points that make up the pushpin.

VEShape.GetShapeLayer Method

Gets the reference to the layer containing the specified VEShape object.

VEShape.GetTitle Method

Gets the title of the VEShape object.

Name

Description

VEShape.GetType Method

Gets the type of the VEShape object.

VEShape.GetZIndex Method

Gets the z-index of a pushpin shape.

VEShape.Hide Method

Hides the specified VEShape object from view.

VEShape.SetCustomIcon Method

Sets the VEShape object's custom icon.

VEShape.SetDescription Method

Sets the description of the VEShape object.

VEShape.SetIconAnchor Method

Sets the info box anchor of the VEShape object.

VEShape.SetMaxZoomLevel Method

Sets the maximum zoom level at which the shape is visible.

VEShape.SetMinZoomLevel Method

Sets the minimum zoom level at which the shape is visible.

VEShape.SetPoints Method

Sets the points of the VEShape object.

VEShape.SetTitle Method

Sets the title of the VEShape object.

VEShape.SetZIndex Method

Sets the z-index value for a shape.

VEShape.Show Method

Makes the specified VEShape object visible.

Public Properties

Name

Description

VEShape.Draggable Property

A Boolean value indicating whether the VEShape icon on the map can be dragged using the mouse.

Supported VEShapeLayer Members

The following members of the VEShapeLayer Class are supported in the core version of the map control.

Public Constructor

Name

Description

VEShapeLayer Constructor

Initializes a new instance of the VEShapeLayer Class .

Public Methods

Name

Description

VEShapeLayer.AddShape Method

Adds an existing VEShape Class object to the layer based on the specified VEShape reference. The core version of this method does not support adding shape arrays. Also note that the core version of the map control only supports VEShape objects that are of type VEShapeType.Pushpin.

VEShapeLayer.DeleteAllShapes Method

Deletes all VEShape objects from the layer.

VEShapeLayer.DeleteShape Method

Deletes a VEShape object from the current layer.

VEShapeLayer.GetBoundingRectangle Method

Returns a best-fit VELatLongRectangle Class object based on the shapes currently present in the layer.

VEShapeLayer.GetShapeByID Method

Retrieves a reference to a VEShape object contained in this layer based on the specified ID.

VEShapeLayer.GetShapeByIndex Method

Retrieves a reference to a VEShape object contained in this layer based on the specified index.

VEShapeLayer.GetShapeCount Method

Returns the total number of shapes in the current layer.

VEShapeLayer.IsVisible Method

Returns whether the layer is visible.

VEShapeLayer.Hide Method

Hides the layer from view on the map.

VEShapeLayer.Show Method

Shows the layer on the map.

Using the REST Services with the Core Map Control

This topic describes how to use the core version of the Bing Maps AJAX Control 6.3 and the Bing Maps REST Services to create a simple page that geocodes a given place or address string and adds a pushpin to the map at that location.

Load the Core Map Control

Before you add geocoding functionality, load the core version of the map control using the following code. The core map control is described in Using the Core Map Control .

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>

<title>Core Map Control Sample</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript" src="http://ecn.dev.virtualearth.net/MapControl/mapcontrol.ashx?v=6.3c"></script>

<script type="text/javascript">

var map = null;

function GetMap()

{

map = new VEMap('myMap');

map.LoadMap();

}

</script>

</head>

<body onload="GetMap();">

<div id='myMap' style="position:relative; width:400px; height:400px;"></div>

</body>

</html>

Add Controls

For this sample, add a text box and a geocode button. In your script, create a ClickGeocode function that is called when the button is clicked.

<input id="txtQuery" type="text" value="Portland"/>

<input type="button" value="Geocode" onclick="ClickGeocode()"/>

Make a REST Geocode Request

Next, make a geocode request to the Bing Maps REST Services using the value in the txtQuery input box.

The Bing Maps REST Services requires a Bing Maps Key. You can get a key by signing up for a free Bing Maps developer account at https://www.bingmapsportal.com .

The Bing Maps REST Services can return an XML or JSON response object. For JavaScript code, JSON is more appropriate, so set output=JSON. This means that you need to also set a jsonp callback function name. In this sample the callback function is named GeocodeCallback. Finally, since you do not know if the text provided is a place name or an address, supply the locationQuery parameter and set it to the value of the txtQuery text box. Your REST geocode request looks like this:

var geocodeRequest = "http://dev.virtualearth.net/REST/v1/Locations/" + document.getElementById('txtQuery').value + "?output=json&jsonp=GeocodeCallback&key=BingMapsKey";

Now add script to make the REST request.

function ClickGeocode()

{

var geocodeRequest = "http://dev.virtualearth.net/REST/v1/Locations/" + document.getElementById('txtQuery').value + "?output=json&jsonp=GeocodeCallback&key=BingMapsKey";

CallRestService(geocodeRequest);

}

function CallRestService(request)

{

var script = document.createElement("script");

script.setAttribute("type", "text/javascript");

script.setAttribute("src", request);

document.body.appendChild(script);

}

function GeocodeCallback(result)

{

// Do something with the result

}

Display the Result

Finally, add code to the GeocodeCallback function to set the map view to the found location and add a pushpin at that location. The final code is shown below.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>

<title>Core Map Control Sample</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript" src="http://ecn.dev.virtualearth.net/MapControl/mapcontrol.ashx?v=6.3c"></script>

<script type="text/javascript">

var map = null;

function GetMap()

{

map = new VEMap('myMap');

map.LoadMap();

}

function ClickGeocode()

{

var geocodeRequest = "http://dev.virtualearth.net/REST/v1/Locations/" + document.getElementById('txtQuery').value + "?output=json&jsonp=GeocodeCallback&key=BingMapsKey";

CallRestService(geocodeRequest);

}

function GeocodeCallback(result)

{

alert("Found location: " + result.resourceSets[0].resources[0].name);

if (result &&

result.resourceSets &&

result.resourceSets.length > 0 &&

result.resourceSets[0].resources &&

result.resourceSets[0].resources.length > 0)

{

// Set the map view using the returned bounding box

var bbox = result.resourceSets[0].resources[0].bbox;

map.SetMapView(new VELatLongRectangle(new VELatLong(bbox[0], bbox[1]), new VELatLong(bbox[2], bbox[3])));

// Add a pushpin at the found location

var latlong = new VELatLong(result.resourceSets[0].resources[0].point.coordinates[0], result.resourceSets[0].resources[0].point.coordinates[1]);

var pushpin = new VEShape(VEShapeType.Pushpin, latlong);

map.AddShape(pushpin);

}

}

function CallRestService(request)

{

var script = document.createElement("script");

script.setAttribute("type", "text/javascript");

script.setAttribute("src", request);

document.body.appendChild(script);

}

</script>

</head>

<body onload="GetMap();">

<div id='myMap' style="position:relative; width:400px; height:400px;"></div>

<input id="txtQuery" type="text" value="Portland"/><input type="button" value="Geocode" onclick="ClickGeocode()"/>

</body>

</html>

See Also

Using the Core Map Control

Bing Maps AJAX Control Class Reference

In This Section

The following classes and enumerations are part of the Bing Maps AJAX Control 6.3.

 VEAltitudeMode Enumeration

 VEBirdseyeScene Class

 VEClusteringOptions Class

 VEClusteringType Enumeration

 VEClusterSpecification Class

 VEColor Class

 VECustomIconSpecification Class

 VEDashboardSize Enumeration

 VEDataType Enumeration

 VEDistanceUnit Enumeration

 VEException Class

 VEFailedShapeRequest Enumeration

 VEFindResult Class

 VEFindType Enumeration

 VEGeocodeLocation Class

 VEGeocodeOptions Class

 VEImageryMetadata Class

 VEImageryMetadataOptions Class

 VELatLong Class

 VELatLongRectangle Class

 VELocationPrecision Enumeration

 VEMap Class

 VEMapMode Enumeration

 VEMapOptions Class

 VEMapStyle Enumeration

 VEMapViewSpecification Class

 VEMatchCode Enumeration

 VEMatchConfidence Enumeration

 VEMiniMapSize Enumeration

 VEModelFormat Enumeration

 VEModelOrientation Class

 VEModelScale Class

 VEModelScaleUnit Enumeration

 VEModelSourceSpecification Class

 VEModelStatusCode Enumeration

 VEOrientation Enumeration

 VEPixel Class

 VEPlace Class

 VEPrintOptions Class

 VERoute Class

 VERouteDeprecated Class

 VERouteDistanceUnit Enumeration

 VERouteHint Class

 VERouteHintType Enumeration

 VERouteItinerary Class

 VERouteItineraryDeprecated Class

 VERouteItineraryItem Class

 VERouteLeg Class

 VERouteLocation Class

 VERouteMode Enumeration

 VERouteOptimize Enumeration

 VERouteOptions Class

 VERouteSegment Class

 VERouteType Enumeration

 VERouteWarning Class

 VERouteWarningSeverity Enumeration

 VESearchOptions Class

 VEShape Class

 VEShapeLayer Class

 VEShapeAccuracy Enumeration

 VEShapeSourceSpecification Class

 VEShapeType Enumeration

 VETileSourceSpecification Class

VEAltitudeMode Enumeration

Defines the altitude of a point on the globe.

Syntax

VEAltitudeMode{ Default Absolute RelativeToGround }

Members

Member

Description

Default

The altitude is meters above ground level

Absolute

The altitude is meters above the WGS 84 ellipsoid

RelativeToGround

The altitude is meters above ground level

Remarks

If the object is a 3D model, then the altitude mode is always RelativeToGround.

See Also

VELatLong Constructor

VELatLong.AltitudeMode Property

VELatLong.SetAltitude Method

VEShape.SetAltitudeMode Method

VEBirdseyeScene Class

Contains the information about a specific bird's eye image.

Public Methods

Name

Description

VEBirdseyeScene.ContainsLatLong Method

Determines whether the location specified by a VELatLong Class object is within the current VEBirdseyeScene object.

VEBirdseyeScene.ContainsPixel Method

Determines whether a specified pixel is within the current VEBirdseyeScene object.

VEBirdseyeScene.GetBoundingRectangle Method

Returns an unencrypted and rounded off bounding rectangle for the VEBirdseyeScene object.

VEBirdseyeScene.GetHeight Method

Returns the height of the image in the current VEBirdseyeScene object, in pixels, at maximum resolution

VEBirdseyeScene.GetID Method

Returns the ID of the current VEBirdseyeScene object.

VEBirdseyeScene.GetOrientation Method

Returns the orientation ( VEOrientation Enumeration ) of the current VEBirdseyeScene object.

VEBirdseyeScene.GetWidth Method

Returns the width of the image in the current VEBirdseyeScene object, in pixels, at maximum resolution

VEBirdseyeScene.LatLongToPixel Method

Converts a VELatLong Class object (latitude/longitude pair) to the corresponding pixel on the map.

VEBirdseyeScene.PixelToLatLong Method

Converts a point in the bird's eye scene to an encrypted latitude/longitude value.

Remarks

To get the VEBirdseyeScene object for the current map, call the VEMap.GetBirdseyeScene Method .

To change the VEBirdseyeScene object for the current map, call the VEMap.SetBirdseyeScene Method .

VEBirdseyeScene Methods

The methods of the VEBirdseyeScene class are listed here. For a complete list of VEBirdseyeScene class members, see the VEBirdseyeScene Class topic.

Public Methods

Name

Description

VEBirdseyeScene.ContainsLatLong Method

Determines whether the location specified by a VELatLong Class object is within the current VEBirdseyeScene object.

VEBirdseyeScene.ContainsPixel Method

Determines whether a specified pixel is within the current VEBirdseyeScene object.

VEBirdseyeScene.GetBoundingRectangle Method

Returns an unencrypted and rounded off bounding rectangle for the VEBirdseyeScene object.

VEBirdseyeScene.GetHeight Method

Returns the height of the image in the current VEBirdseyeScene object, in pixels, at maximum resolution

VEBirdseyeScene.GetID Method

Returns the ID of the current VEBirdseyeScene object.

VEBirdseyeScene.GetOrientation Method

Returns the orientation ( VEOrientation Enumeration ) of the current VEBirdseyeScene object.

VEBirdseyeScene.GetWidth Method

Returns the width of the image in the current VEBirdseyeScene object, in pixels, at maximum resolution

VEBirdseyeScene.LatLongToPixel Method

Converts a VELatLong Class object (latitude/longitude pair) to the corresponding pixel on the map.

VEBirdseyeScene.PixelToLatLong Method

Converts a point in the bird's eye scene to an encrypted latitude/longitude value.

VEBirdseyeScene.ContainsLatLong Method

Determines whether the location specified by a VELatLong Class object is within the current VEBirdseyeScene object.

Syntax

VEBirdseyeScene.ContainsLatLong(Latlong);

Parameters

Parameter

Description

Latlong

A VELatLong Class object

Return Value

A Boolean value. True if the location specified by the VELatLong object is within the bounds of the VEBirdseyeScene object.

Example

VirtualEarthSDK#0

VEBirdseyeScene.ContainsPixel Method

Determines whether a specified pixel is within the current VEBirdseyeScene object.

Syntax

VEBirdseyeScene.ContainsPixel(x, y, zoomLevel);

Parameters

Parameter

Description

x

The X component of the pixel

y

The Y component of the pixel

zoomLevel

The current zoom level of the map

Return Value

A Boolean value. True if the specified pixel is within the bounds of the VEBirdseyeScene object.

Remarks

The pixel location is relative to the scene, not the current view.

Example

VirtualEarthSDK#0

VEBirdseyeScene.GetBoundingRectangle Method

Returns an unencrypted and rounded off bounding rectangle for the VEBirdseyeScene object.

Syntax

VEBirdseyeScene.GetBoundingRectangle();

Return Value

A VELatLongRectangle Class object containing the bounding rectangle.

Remarks

The bounding rectangle's values can be up to two miles off the original latitude and longitude. The bounding rectangle is the same size or larger than the original bounding rectangle. The bounding rectangle is for the entire scene, not just for the map view. The center of the bounding rectangle may not be the center of the scene. In some scenes, the center of the bounding rectangle might not be within the scene.

Example

VirtualEarthSDK#17

VEBirdseyeScene.GetHeight Method

Returns the height of the image in the current VEBirdseyeScene object, in pixels, at maximum resolution.

Syntax

VEBirdseyeScene.GetHeight();

Return Value

The height in pixels.

Remarks

To get the height of the image when it is zoomed out (at the minimum resolution), divide the value returned from the GetHeight method by 2.

Example

VirtualEarthSDK#0

VEBirdseyeScene.GetID Method

Returns the ID of the current VEBirdseyeScene object.

Syntax

VEBirdseyeScene.GetID();

Return Value

The scene ID as an integer.

Example

VirtualEarthSDK#0

VEBirdseyeScene.GetOrientation Method

Returns the orientation ( VEOrientation Enumeration ) of the current VEBirdseyeScene object.

Syntax

VEBirdseyeScene.GetOrientation();

Return Value

The VEOrientation Enumeration value.

Example

VirtualEarthSDK#0

VEBirdseyeScene.GetWidth Method

Returns the width of the image in the current VEBirdseyeScene object, in pixels, at maximum resolution.

Syntax

VEBirdseyeScene.GetWidth();

Return Value

The width in pixels.

Remarks

To get the width of the image when it is zoomed out (at the minimum resolution), divide the value returned from the GetWidth method by 2.

Example

VirtualEarthSDK#0

VEBirdseyeScene.LatLongToPixel Method

Converts a VELatLong Class object (latitude/longitude pair) to the corresponding pixel on the map.

Syntax

VEBirdseyeScene.LatLongToPixel(LatLong, zoomLevel);

Parameters

Parameter

Description

LatLong

A VELatLong Class object, which contains the latitude and longitude of a point. This method also accepts an encrypted VELatLong object, as supplied by the VEBirdseyeScene.PixelToLatLong Method .

zoomLevel

The zoom level of the current map view

Return Value

A pixel location of the VELatLong Class point. This object has two properties, x and y.

Remarks

The x- and y-coordinates of the pixel returned by this method are with respect to the top-left corner of the bird's eye scene. This differs from VEMap.LatLongToPixel Method , which returns x- and y-coordinates with respect to the top-left corner of the map view.

VEMap.LatLongToPixel can also be called in bird's eye view.

Example

VirtualEarthSDK#1

VEBirdseyeScene.PixelToLatLong Method

Converts a point in the bird's eye scene to an encrypted latitude/longitude value.

Syntax

VEBirdseyeScene.PixelToLatLong(pixel, zoomLevel);

Parameters

Parameter

Description

pixel

A VEPixel Class object representing a pixel location on the map

zoomLevel

The zoom level of the current map view

Return Value

An encrypted VELatLong object.

Remarks

You cannot retrieve the unencrypted latitude and longitude of a specific point in a bird's eye image. The return value is an encrypted VELatLong, but you can use it by passing it back to other methods. For example, you can use the encrypted VELatLong as input for the VEMap.GetRoute Method , the VEMap.SetCenter Method , and the VEMap.SetCenterAndZoom Method .

Example

VirtualEarthSDK#1

VEClusteringOptions Class

Contains the options for customizing a pushpin cluster display.

Constructor

Name

Description

VEClusteringOptions Constructor

Initializes a new instance of a VEClusteringOptions object.

Public Properties

Name

Description

VEClusteringOptions.Icon Property

A VECustomIconSpecification Class which describes the icon representing the pushpin cluster.

VEClusteringOptions.Callback Property

The name of the function called when clustering changes.

See Also

VEShapeLayer.SetClusteringConfiguration Method

VEClusteringOptions Constructor

Initializes a new instance of the VEClusteringOptions Class .

Syntax

var x = new VEClusteringOptions();

See Also

VEShapeLayer.SetClusteringConfiguration Method

VEClusteringOptions Properties

The properties of the VEClusteringOptions class are listed here. For a complete list of VEClusteringOptions class members, see the VEClusteringOptions Class topic.

Public Properties

Name

Description

VEClusteringOptions.Icon Property

A VECustomIconSpecification Class which describes the icon representing the pushpin cluster.

VEClusteringOptions.Callback Property

The name of the function called when

Name

Description

clustering changes.

VEClusteringOptions.Icon Property

A VECustomIconSpecification Class which describes the icon representing the pushpin cluster.

Syntax

VEClusteringOptions.Icon = new VECustomIconSpecification();

Remarks

If the Icon property is specified, it is used to display clustered icons. If the Icon property is not specified, the default cluster icon is used.

VEClusteringOptions.Callback Property

The name of the function called when clustering changes.

Syntax

VEClusteringOptions.Callback = value;

Remarks

The function specified in the Callback must take an array of VEClusterSpecification Class objects.

See Also

VEClusterSpecification.GetClusterShape Method

VEClusteringType Enumeration

An enumeration of pushpin clustering algorithms.

Syntax

VEClusteringType { None Grid }

Members

Member

Description

None

No pushpin clustering

Grid

A simple clustering algorithm

See Also

VEShapeLayer.SetClusteringConfiguration(type, options) Method

VEClusterSpecification Class

Contains the shape objects and location of a pushpin cluster.

Public Methods

Name

Description

VEClusterSpecification.GetClusterShape Method

Returns a VEShape Class that represents the pushpin cluster.

Public Properties

Name

Description

VEClusterSpecification.Shapes Property

An array of VEShape Class items representing the pushpins in a pushpin cluster.

VEClusterSpecification.LatLong Property

A VELatLong Class object indicating the center of the pushpin cluster.

See Also

VEShapeLayer.GetClusteredShapes Method

VEClusterSpecification Methods

The methods of the VEClusterSpecification class are listed here. For a complete list of VEClusterSpecification class members, see the VEClusterSpecification Class topic.

Public Methods

Name

Description

VEClusterSpecification.GetClusterShape Method

Returns a VEShape Class that represents the pushpin cluster.

VEClusterSpecification.GetClusterShape Method

Returns a VEShape Class that represents the pushpin cluster.

Syntax

VEClusterSpecification.GetClusterShape();

Return Value

A VEShape Class representing the pushpin cluster. Returns null if a VEClusterSpecification object was returned from the VEShapeLayer.GetClusteredShapes Method .

See Also

VEClusterSpecification Class

VEClusterSpecification Properties

The properties of the VEClusterSpecification class are listed here. For a complete list of VEClusterSpecification class members, see the VEClusterSpecification Class topic.

Public Properties

Name

Description

VEClusterSpecification.Shapes Property

An array of VEShape Class items representing the pushpins in a pushpin cluster.

VEClusterSpecification.LatLong Property

A VELatLong Class object indicating the center of the pushpin cluster.

VEClusterSpecification.Shapes Property

An array of VEShape Class items representing the pushpins in a pushpin cluster.

Syntax

VEClusterSpecification.Shapes

VEClusterSpecification.LatLong Property

A VELatLong Class object indicating the center of the pushpin cluster.

Syntax

VEClusterSpecification.LatLong

VEColor Class

Specifies the color and transparency to use when drawing VEShape Class objects on the map.

Constructor

Name

Description

VEColor Constructor

Initializes a new instance of the VEColor object.

Public Properties

Name

Description

VEColor.R Property

Specifies the red component value. Valid values range from 0 through 255.

VEColor.G Property

Specifies the green component value. Valid values range from 0 through 255.

VEColor.B Property

Specifies the blue component value. Valid values range from 0 through 255.

VEColor.A Property

Specifies the alpha (transparency) component value. Valid values range from 0.0 through 1.0.

Remarks

Color values are specified on a scale from 0 through 255, while transparency is specified on a scale from 0.0 (transparent) to 1.0 (opaque).

See Also

VEShape Class

VEShapeType Enumeration

VEColor Constructor

Specifies the red, green, and blue colors, plus the level of transparency, for the VEColor object.

Syntax

var x = new VEColor(r, g, b, a);

Parameters

Parameter

Description

r

The red component value. Valid values range from 0 through 255.

Parameter

Description

g

The green component value. Valid values range from 0 through 255.

b

The blue component value. Valid values range from 0 through 255.

a

The alpha (transparency) component value. Valid values range from 0.0 through 1.0.

Remarks

VEColor objects are defined by the intensity of the red, green, and blue colors, plus the level of transparency.

VEColor Properties

The properties of the VEColor class are listed here. For a complete list of VEColor class members, see the VEColor Class topic.

Public Properties

Name

Description

VEColor.R Property

Specifies the red component value. Valid values range from 0 through 255.

VEColor.G Property

Specifies the green component value. Valid values range from 0 through 255.

VEColor.B Property

Specifies the blue component value. Valid values range from 0 through 255.

VEColor.A Property

Specifies the alpha (transparency) component value. Valid values range from 0.0 through 1.0.

VEColor.A Property

Specifies the alpha (transparency) component value. Valid values range from 0.0 through 1.0.

Syntax

VEColor.A = value

Remarks

The A property specifies the transparency you want. A value of 0.0 means the color is completely transparent, while a value of 1.0 means the color is completely opaque.

See Also

VEColor.B Property

VEColor.B Property

Specifies the blue component value. Valid values range from 0 through 255.

Syntax

VEColor.B = value

See Also

VEColor.A Property

VEColor.G Property

Specifies the green component value. Valid values range from 0 through 255.

Syntax

VEColor.G = value

See Also

VEColor.R Property

VEColor.A Property

VEColor.R Property

Specifies the red component value. Valid values range from 0 through 255.

Syntax

VEColor.R = value

See Also

VEColor.G Property

VEColor.B Property

VEColor.A Property

VECustomIconSpecification Class

Specifies the appearance of a VEShape Class object's custom icon.

Constructor

Name

Description

VECustomIconSpecification Constructor

Initializes a new instance of the VECustomIconSpecification object.

Public Properties

Name

Description

VECustomIconSpecification.BackColor Property

A VEColor object representing the icon's background and transparency.

VECustomIconSpecification.CustomHTML Property

Custom HTML representing the pin's appearance. When specified, this HTML represents the pin's icon for 2D views only. String.

VECustomIconSpecification.ForeColor Property

A VEColor object representing the icon's text color and transparency.

VECustomIconSpecification.Image Property

A String representing the URL of an image file.

VECustomIconSpecification.ImageOffset Property

A VEPixel object representing the image's offset from the icon's anchor.

VECustomIconSpecification.TextBold Property

Specifies whether the text for the icon should be bold. Boolean.

VECustomIconSpecification.TextContent Property

The actual text to display for the icon. String.

VECustomIconSpecification.TextFont Property

A String containing the name of the font to use for the icon text.

VECustomIconSpecification.TextItalics Property

Specifies whether the text for the icon should be italic. Boolean.

VECustomIconSpecification.TextOffset Property

A VEPixel object representing the amount to offset text from the top left corner.

VECustomIconSpecification.TextSize Property

Specifies the size at which to display text, in points. Integer.

VECustomIconSpecification.TextUnderline Property

Specifies whether the text for the icon should be underlined. Boolean.

Remarks

The 3D control cannot accept custom HTML for custom icons. This class allows you to specify custom HTML for an icon in 2D mode, if desired, as well as a parameterized property list to define the custom icon's appearance in 3D mode. If you do not need to support custom icons in 3D mode, do not use this class.

VECustomIconSpecification Constructor

Initializes a new instance of the VECustomIconSpecification class.

Syntax

var x = new VECustomIconSpecification();

VECustomIconSpecification Properties

The properties of the VECustomIconSpecification class are listed here. For a complete list of VECustomIconSpecification class members, see the VECustomIconSpecification Class topic.

Public Properties

Name

Description

VECustomIconSpecification.BackColor Property

A VEColor object representing the icon's background and transparency.

VECustomIconSpecification.CustomHTML Property

Custom HTML representing the pin's appearance. When specified, this HTML represents the pin's icon for 2D views only. String.

VECustomIconSpecification.ForeColor Property

A VEColor object representing the icon's text color and transparency.

VECustomIconSpecification.Image Property

A String representing the URL of an image file.

VECustomIconSpecification.ImageOffset Property

A VEPixel object representing the image's offset from the icon's anchor.

VECustomIconSpecification.TextBold Property

Specifies whether the text for the icon should be bold. Boolean.

VECustomIconSpecification.TextContent Property

The actual text to display for the icon. String.

VECustomIconSpecification.TextFont Property

A String containing the name of the font to use for the icon text.

VECustomIconSpecification.TextItalics Property

Specifies whether the text for the icon should be italic. Boolean.

VECustomIconSpecification.TextOffset Property

A VEPixel object representing the amount to offset text from the top left corner.

VECustomIconSpecification.TextSize Property

Specifies the size at which to display text, in

Name

Description

points. Integer.

VECustomIconSpecification.TextUnderline Property

Specifies whether the text for the icon should be underlined. Boolean.

VECustomIconSpecification.BackColor Property

A VEColor object representing the icon's background and transparency.

Syntax

VECustomIconSpecification.BackColor = object

Remarks

See Also

VEColor Class

VECustomIconSpecification.CustomHTML Property

Custom HTML representing the pin's appearance. When specified, this HTML represents the pin's icon for 2D views only. String.

Syntax

VECustomIconSpecification.CustomHTML = string

Remarks

The custom HTML is a string value, beginning with the < character, and ending with the > character. In the middle should be well-formed HTML code.

If the CustomHTML property is present, the HTML code defined therein is used to display the icon in 2D mode. If the CustomHTML property is not present, the icon still uses the other properties that have been set for the VECustomIconSpecification object.

In 3D mode, the CustomHTML property is ignored.

VECustomIconSpecification.ForeColor Property

A VEColor object representing the icon's text color and transparency.

Syntax

VECustomIconSpecification.ForeColor = color

Remarks

See Also

VEColor Class

VECustomIconSpecification.Image Property

A String representing the URL of an image file.

Syntax

VECustomIconSpecification.Image = string;

Remarks

This value must be a fully qualified, externally accessible URL for 3D use. If the URL is not valid, the property is ignored and the icon is not displayed.

VECustomIconSpecification.ImageOffset Property

A VEPixel object representing the image's offset from the icon's anchor.

Syntax

VECustomIconSpecification.ImageOffset = object

Remarks

See Also

VEPixel Class

VEShape.SetIconAnchor Method

VEShape.GetIconAnchor Method

VECustomIconSpecification.TextBold Property

Specifies whether the text for the icon should be bold. Boolean.

Syntax

VECustomIconSpecification.TextBold = boolean

Remarks

VECustomIconSpecification.TextContent Property

The actual text to display for the icon. String.

Syntax

VECustomIconSpecification.TextContent = string

Remarks

VECustomIconSpecification.TextFont Property

A String containing the name of the font to use for the icon text.

Syntax

VECustomIconSpecification.TextFont = string

Remarks

VECustomIconSpecification.TextItalics Property

Specifies whether the text for the icon should be italic. Boolean.

Syntax

VECustomIconSpecification.TextItalics = boolean

Remarks

VECustomIconSpecification.TextOffset Property

A VEPixel object representing the amount to offset text from the top left corner.

Syntax

VECustomIconSpecification.TextOffset = object

Remarks

The VEPixel object defines a pair of pixel coordinates (VEPixel.x and VEPixel.y). This determines the pixel amount to offset the text to the right of, and below, the top left corner of the icon.

See Also

VEPixel Class

VECustomIconSpecification.TextSize Property

Specifies the size at which to display text, in points. Integer.

Syntax

VECustomIconSpecification.TextSize = value

Remarks

VECustomIconSpecification.TextUnderline Property

Specifies whether the text for the icon should be underlined. Boolean.

Syntax

VECustomIconSpecification.TextUnderline = boolean

Remarks

VEDashboardSize Enumeration

An enumeration that represents the size and type of dashboard to be displayed on the map.

Syntax

VEDashboardSize{ Normal Small Tiny }

Members

Member

Description

Normal

This is the dashboard that is used by default.

Small

This is a dashboard smaller than the default: it only contains zoom-out (+) and zoom-in (-) buttons and road, aerial, and hybrid buttons for changing the map style.

Tiny

This is the smallest dashboard option available. This dashboard only contains zoom-out (+) and zoom-in (-) buttons.

See Also

VEMap.SetDashboardSize Method

VEMap.HideDashboard Method

VEDataType Enumeration

An enumeration of shape layer data types.

Syntax

VEDataType ( GeoRSS VECollection ImportXML }

Members

Member

Description

GeoRSS

This represents a GeoRSS data import.

VECollection

This represents a Bing Maps Collection ( http://maps.live.com ) import.

ImportXML

This represents an XML data import.

Remarks

This enumeration represents the type of data to be imported into a shape layer as a VEShapeSourceSpecification Class object using the VEMap.ImportShapeLayerData Method .

Supported File Formats

GeoRSS

If the data type is VEDataType.GeoRSS, then the file specified in the VEShapeSourceSpecification.LayerSource Property must be a valid XML file. Additionally, the file must be in W3C, Simple, or GML format and contain at least one supported type.

The following types are supported:

geo:lat

geo:lon

geo:long

geo:point

geo:Point

Point

pos

posList

georss:point

georss:line

georss:polygon

georss:where

gml:Point

gml:pos

gml:posList

gml:LineString

gml:Polygon

gml:exterior

gml:interior

gml:LinearRing

VECollection

If the data type is VEDataType.VECollection, then the URL specified in the VEShapeSourceSpecification.LayerSource Property must be a valid Bing Maps ( http://maps.live.com ) collection GUID.

ImportXML

If the data type is VEDataType.ImportXML, then the file specified in the VEShapeSourceSpecification.LayerSource Property must be a valid XML file.

If the specified XML file is a KML file, the following KML elements are supported. These elements are case sensitive. Note that the supported elements may contain sub elements that are not supported. The sub elements refreshMode and refreshInterval are not supported.

Element Name

Notes

Placemark

Required

MultiGeometry

Converts to multiple VEShape objects

Polygon

LineString

LinearRing

Point

NetworkLink

One level support only. Data is imported once when the VEMap.ImportShapeLayerData Method is called.

Style

Unsupported if the element contains a StyleUrl that points to a separate KML file

Icon

Unsupported if the element contains a StyleUrl that points to a separate KML file

StyleUrl

Unsupported if the specified URL is a separate KML file

IconStyle

Unsupported if the element contains a StyleUrl that points to a separate KML file

LineStyle

Unsupported if the element contains a StyleUrl that points to a separate KML file

PolygonStyle

Unsupported if the element contains a StyleUrl that points to a separate KML file

See Also

VEShapeLayer Class

VEDistanceUnit Enumeration

An enumeration of the distance unit used for generating routes and itineraries.

Syntax

VEDistanceUnit{ Miles Kilometers }

Members

Member

Description

Miles

Generates route information in miles.

Kilometers

Generates route information in kilometers.

Remarks

This enumeration is used in the units parameter of the VEMap.GetRoute Method and as the VERouteItineraryDeprecated.DistanceUnit Property to specify the distance units to use when generating the route.

This enumeration is also used with the VEMap.SetScaleBarDistanceUnit Method to change the map scale bar units.

VEException Class

Contains the exception information for the map control.

Public Properties

Name

Description

VEException.source Property

The source object that caused the exception.

VEException.name Property

The name of the exception.

VEException.message Property

A text description of the exception.

Remarks

An exception returned from Bing Maps will always contain a value for the message property. The source and name properties may have values, or may be null or undefined.

If you want to handle VEMap object errors, use the VEMap.onerror Event .

Example

VirtualEarthSDK#54

VEException Properties

The properties of the VEException class are listed here. For a complete list of VEException class members, see the VEException Class topic.

Public Properties

Name

Description

VEException.source Property

The source object that caused the exception.

VEException.name Property

The name of the exception.

VEException.message Property

A text description of the exception.

VEException.message Property

A text description of the exception.

Syntax

VEException.message = value

VEException.name Property

The name of the exception.

Syntax

VEException.name = value

VEException.source Property

The source object that caused the exception.

Syntax

VEException.source = value

VEFailedShapeRequest Enumeration

Defines a list of the actions on how to draw the polygons or the polylines whose points exceed the maximum limit or when a request to the server fails.

Syntax

VEFailedShapeRequest{ DoNotDraw DrawInaccurately QueueRequest }

Members

Member

Description

DoNotDraw

Do not draw the shape

DrawInaccurately

Draw the shape inaccurately

QueueRequest

Resubmit the drawing request

See Also

VEMap.SetFailedShapeRequest Method

VEFindResult Class

A single "what" result returned from a VEMap.Find Method search.

Public Properties

Name

Description

VEFindResult.Shape Property

A reference to the VEShape Class object corresponding to this FindResult object. The VEShape object represents the result's pushpin displayed on the map.

VEFindResult.Name Property

The name of the found result.

VEFindResult.Description Property

The description of the found result.

VEFindResult.FindType Property

The VEFindType Enumeration enumeration that represents the type of Find that was performed. This matches the findType parameter specified in the Find method call from which this result was generated.

VEFindResult.IsSponsored Property

A Boolean value that indicates whether the found result is a paid advertisement.

VEFindResult.LatLong Property

A VELatLong Class object that represents the location of the found result.

VEFindResult.Phone Property

The telephone number of the found result.

VEFindResult Properties

The properties of the VEFindResult class are listed here. For a complete list of VEFindResult class members, see the VEFindResult Class topic.

Public Properties

Name

Description

VEFindResult.Shape Property

A reference to the VEShape Class object corresponding to this FindResult object. The VEShape object represents the result's pushpin displayed on the map.

VEFindResult.Name Property

The name of the found result.

VEFindResult.Description Property

The description of the found result.

VEFindResult.FindType Property

The VEFindType Enumeration enumeration that represents the type of Find that was performed. This matches the findType parameter specified in the Find method call from which this result was generated.

VEFindResult.IsSponsored Property

A Boolean value that indicates whether the found result is a paid advertisement.

VEFindResult.LatLong Property

A VELatLong Class object that represents the location of the found result.

VEFindResult.Phone Property

The telephone number of the found result.

VEFindResult.Description Property

The description of the found result.

Syntax

VEFindResult.Description = value

Remarks

The description field is typically the address of the found result.

VEFindResult.IsSponsored Property

A Boolean value that indicates whether the found result is a paid advertisement.

Syntax

VEFindResult.IsSponsored = value

Remarks

An IsSponsored value of true indicates that the found result is a paid advertisement.

VEFindResult.LatLong Property

A VELatLong Class object that represents the location of the found result.

Syntax

VEFindResult.LatLong = value

VEFindResult.Name Property

The name of the found result.

Syntax

VEFindResult.Name = value

Remarks

VEFindResult.Phone Property

The telephone number of the found result.

Syntax

VEFindResult.Phone = value

Remarks

VEFindResult.FindType Property

Gets or sets the VEFindType Enumeration that represents the type of Find that was performed.

Syntax

VEFindResult.FindType = value

Remarks

This value matches the findType parameter specified in the VEMap.Find Method call from which this result was generated.

VEFindResult.Shape Property

A reference to the VEShape Class object corresponding to this FindResult object. The VEShape object represents the result's pushpin displayed on the map.

Syntax

VEFindResult.Shape = value

Remarks

VEFindType Enumeration

An enumeration of search types.

Syntax

VEFindType{ Businesses }

Members

Member

Description

Businesses

Performs a business search.

Remarks

This enumeration specifies the search types that can be performed using the VEMap.Find Method . It is also present in every VEFindResult Class available in the callback after a VEMap.Find Method call. Businesses is the only valid value.

See Also

VEMap.Find Method

VEGeocodeLocation Class

A location used to interpolate a found result for a location search.

Public Properties

Property

Description

VEGeocodeLocation.LatLong Property

A VELatLong Class object specifying the latitude and longitude of the location.

VEGeocodeLocation.Precision Property

A VELocationPrecision Enumeration value specifying the precision of the location.

See Also

VEPlace Class

VEGeocodeLocation Properties

The properties of the VEGeocodeLocation class are listed here. For a complete list of VEGeocodeLocation class members, see the VEGeocodeLocation Class topic.

Public Properties

Property

Description

VEGeocodeLocation.LatLong Property

A VELatLong Class object specifying the latitude and longitude of the location.

VEGeocodeLocation.Precision Property

A VELocationPrecision Enumeration value specifying the precision of the location.

VEGeocodeLocation.LatLong Property

A VELatLong Class object specifying the latitude and longitude of the location.

Syntax

VEGeocodeLocation.LatLong

See Also

VEGeocodeLocation.Precision Property

VEGeocodeLocation.Precision Property

A VELocationPrecision Enumeration value specifying the precision of the location.

Syntax

VEGeocodeLocation.Precision

See Also

VEGeocodeLocation.LatLong Property

VEGeocodeOptions Class

Contains additional geocoding options for the VEMap.Geocode Method .

Constructor

Name

Description

VEGeocodeOptions Constructor

Initializes a new instance of the VEGeocodeOptions class.

Public Properties

Name

Description

VEGeocodeOptions.SetBestMapView Property

A Boolean value that specifies whether the map control moves the view to the first location match. The default value is true.

VEGeocodeOptions.UseDefaultDisambiguation Property

A Boolean value indicating whether to show the disambiguation dialog if there is more than one result with high match confidence . The default value is true.

See Also

VEMap.Geocode Method

VEGeocodeOptions Constructor

Initializes a new instance of the VEGeocodeOptions Class .

Syntax

var x = new VEGeocodeOptions();

See Also

VEMap.Geocode Method

VEGeocodeOptions Properties

The properties of the VEGeocodeOptions class are listed here. For a complete list of VEGeocodeOptions class members, see the VEGeocodeOptions Class topic.

Public Properties

Name

Description

VEGeocodeOptions.SetBestMapView Property

A Boolean value that specifies whether the map control moves the view to the first location match. The default value is true.

VEGeocodeOptions.UseDefaultDisambiguation Property

A Boolean value indicating whether to show the disambiguation dialog if there is more than one result with high match confidence . The default value is true.

VEGeocodeOptions.SetBestMapView Property

A Boolean value that specifies whether the map control moves the view to the first location match. The default value is true.

Syntax

VEGeocodeOptions.SetBestMapView = value;

See Also

VEMap.Geocode Method

VEGeocodeOptions.UseDefaultDisambiguation Property

A Boolean value indicating whether to show the disambiguation dialog if there is more than one result with high match confidence . The default value is true.

Syntax

VEGeocodeOptions.UseDefaultDisambiguation = value;

See Also

VEMap.Geocode Method

VEImageryMetadata Class

Contains information about the specified imagery.

Public Properties

Name

Description

VEImageryMetadata.DateRangeStart Property

A string specifying the start date of the date range when the imagery was created.

VEImageryMetadata.DateRangeEnd Property

A string specifying the end date of the date range when the imagery was created.

See Also

VEMap.GetImageryMetadata Method

VEImageryMetadata Properties

The properties of the VEImageryMetadata class are listed here. For a complete list of VEImageryMetadata class members, see the VEImageryMetadata Class topic.

Public Properties

Name

Description

VEImageryMetadata.DateRangeStart Property

A string specifying the start date of the date range when the imagery was created.

VEImageryMetadata.DateRangeEnd Property

A string specifying the end date of the date range when the imagery was created.

See Also

VEMap.GetImageryMetadata Method

VEImageryMetadata.DateRangeStart Property

A string specifying the start date of the date range when the imagery was created.

Syntax

VEImageryMetadata.DateRangeStart

Remarks

The format of the DateRangeStart property string is "mm/dd/yyyy".

See Also

VEImageryMetadata Class

VEMap.GetImageryMetadata Method

VEImageryMetadata.DateRangeEnd Property

A string specifying the end date of the date range when the imagery was created.

Syntax

VEImageryMetadata.DateRangeEnd

Remarks

The format of the DateRangeEnd property string is "mm/dd/yyyy".

See Also

VEImageryMetadata Class

VEMap.GetImageryMetadata Method

VEImageryMetadataOptions Class

Contains the options that represent the imagery.

Constructor

Name

Description

VEImageryMetadataOptions Constructor

Initializes a new instance of a VEImageryMetadataOptions object.

Public Properties

Name

Description

VEImageryMetadataOptions.LatLong Property

A VELatLong Class object specifying the center of the map view. Optional. Defaults to the center of the current map view.

VEImageryMetadataOptions.MapStyle Property

A VEMapStyle Enumeration value specifying the map style. Optional. Defaults to the current map style.

VEImageryMetadataOptions.ZoomLevel Property

An integer specifying the zoom level. Optional. Defaults to the current zoom level.

See Also

VEMap.GetImageryMetadata Method

VEImageryMetadataOptions Constructor

Initializes a new instance of the VEImageryMetadataOptions Class .

Syntax

var x = new VEImageryMetadataOptions();

See Also

VEMap.GetImageryMetadata Method

VEImageryMetadataOptions Properties

The properties of the VEImageryMetadataOptions class are listed here. For a complete list of VEImageryMetadataOptions class members, see the VEImageryMetadataOptions Class topic

Public Properties

Name

Description

VEImageryMetadataOptions.LatLong Property

A VELatLong Class object specifying the center

Name

Description

of the map view. Optional. Defaults to the center of the current map view.

VEImageryMetadataOptions.MapStyle Property

A VEMapStyle Enumeration value specifying the map style. Optional. Defaults to the current map style.

VEImageryMetadataOptions.ZoomLevel Property

An integer specifying the zoom level. Optional. Defaults to the current zoom level.

See Also

VEMap.GetImageryMetadata Method

VEImageryMetadataOptions.LatLong Property

A VELatLong Class object specifying the center of the map view. Defaults to the center of the current map view.

Syntax

VEImageryMetadataOptions.LatLong = new VELatLong();

See Also

VEImageryMetadataOptions Class

VEImageryMetadataOptions.MapStyle Property

A VEMapStyle Enumeration value specifying the map style. Defaults to the current map style.

Syntax

VEImageryMetadataOptions.MapStyle = value;

See Also

VEImageryMetadataOptions Class

VEImageryMetadataOptions.ZoomLevel Property

An integer specifying the zoom level. Defaults to the current zoom level.

Syntax

VEImageryMetadataOptions.ZoomLevel = value;

See Also

VEImageryMetadataOptions Class

VELatLong Class

Contains the latitude and longitude of a single point on the globe.

Constructor

Name

Description

VELatLong Constructor

Initializes a new instance of the VELatLong object.

Public Methods

Name

Description

VELatLong.SetAltitude Method

Specifies the altitude for a point on the globe.

Public Properties

Name

Description

VELatLong.Altitude Property

Specifies the altitude of a single point on the globe.

VELatLong.AltitudeMode Property

Specifies the mode in which an altitude is represented.

VELatLong.Latitude Property

Specifies the latitude of a single point on the globe.

VELatLong.Longitude Property

Specifies the longitude of a single point on the globe.

Remarks

The Latitude and Longitude values use WGS 84 datum.

To obtain the VELatLong object of a point on the current map, use the VEMap.PixelToLatLong Method . To convert a VELatLong object to a point on the current map, use the VEMap.LatLongToPixel Method .

VELatLong Constructor

Initializes a new instance of the VELatLong Class .

Syntax

var x = new VELatLong(latitude, longitude, altitude, altitudeMode);

Parameters

Parameter

Description

latitude

The latitude of a single point on the globe

longitude

The longitude of a single point on the globe

altitude

The altitude of a single point on the globe. Optional. The default value is 0 (zero).

altitudeMode

A VEAltitudeMode Enumeration value representing the mode in which an altitude is represented. Optional. The default value is VEAltitudeMode.Default.

Remarks

The latitude and longitude values use WGS 84 datum.

See Also

VELatLong.Altitude Property

VELatLong.AltitudeMode Property

VELatLong.Latitude Property

VELatLong.Longitude Property

VELatLong Properties

The properties of the VELatLong class are listed here. For a complete list of VELatLong class members, see the VELatLong Class topic.

Public Properties

Name

Description

VELatLong.Altitude Property

Specifies the altitude of a single point on the globe.

VELatLong.AltitudeMode Property

Specifies the mode in which an altitude is represented.

VELatLong.Latitude Property

Specifies the latitude of a single point on the globe.

Name

Description

VELatLong.Longitude Property

Specifies the longitude of a single point on the globe.

VELatLong.Altitude Property

Specifies the altitude of a single point on the globe.

Syntax

VELatLong.Altitude = value

Remarks

The value is a floating-point value representing either meters above the ground, or meters above the WGS 84 ellipsoid, as specified by the VELatLong.AltitudeMode Property .

See Also

VELatLong.SetAltitude Method

VELatLong.AltitudeMode Property

Specifies the mode in which an altitude is represented.

Syntax

VELatLong.AltitudeMode = value

Remarks

The value must be one of the VEAltitudeMode Enumeration values.

See Also

VELatLong.SetAltitude Method

VELatLong.Latitude Property

Specifies the latitude of a single point on the globe.

Syntax

VELatLong.Latitude = value

Remarks

This property is a floating-point value in decimal degrees representing a WGS 84 datum.

VELatLong.Longitude Property

Specifies the longitude of a single point on the globe.

Syntax

VELatLong.Longitude = value

Remarks

This property is a floating-point value in decimal degrees representing a WGS 84 datum.

VELatLong Methods

The methods of the VELatLong class are listed here. For a complete list of VELatLong class members, see the VELatLong Class topic.

Public Methods

Name

Description

VELatLong.SetAltitude Method

Specifies the altitude for a point on the globe.

VELatLong.SetAltitude Method

Specifies the altitude for a point on the globe.

Syntax

VELatLong.SetAltitude(altitude, mode)

Parameters

Parameter

Description

altitude

The altitude, in meters

mode

The VEAltitudeMode Enumeration value that defines whether altitude is relative to ground-level or absolute

Example

VirtualEarthSDK#41

See Also

VELatLong.Altitude Property

VELatLong.AltitudeMode Property

VELatLongRectangle Class

Contains VELatLong Class objects that define the boundaries of the current map view.

Constructor

Name

Description

VELatLongRectangle Constructor

Initializes a new instance of the VELatLongRectangle Class object.

Public Properties

Name

Description

VELatLongRectangle.TopLeftLatLong Property

A VELatLong Class object that specifies the latitude and longitude of the upper-left corner of the map view.

VELatLongRectangle.BottomRightLatLong Property

A VELatLong Class object that specifies the latitude and longitude of the lower-right corner of the map view.

VELatLongRectangle.TopRightLatLong Property

If the map is in 3D mode, a VELatLong Class object that specifies the latitude and longitude of the upper-right corner of the map view.

VELatLongRectangle.BottomLeftLatLong Property

If the map is in 3D mode, a VELatLong Class object that specifies the latitude and longitude of the lower-left corner of the map

Remarks

The VELatLongRectangle object is used as a parameter in the VETileSourceSpecification Constructor . An array of VELatLongRectangle objects is used with the VETileSourceSpecification.Bounds Property .

A VELatLongRectangle object is returned by the VEMap.GetMapView Method .

VELatLongRectangle Constructor

Initializes a new instance of the VELatLongRectangle class.

Syntax

var x = new VELatLongRectangle(TopLeftLatLong, BottomRightLatLong, TopRightLatLong, BottomLeftLatLong);

Parameters

Parameter

Description

TopLeftLatLong

A VELatLong Class object that specifies the latitude and longitude of the upper-left corner of the map view

BottomRightLatLong

A VELatLong Class object that specifies the latitude and longitude of the lower-right corner of the map view

TopRightLatLong

If the map is in 3D mode, a VELatLong Class object that specifies the latitude and longitude of the upper-right corner of the map view

BottomLeftLatLong

If the map is in 3D mode, a VELatLong Class object that specifies the latitude and longitude of the lower-left corner of the map view

VELatLongRectangle Properties

The properties of the VELatLongRectangle class are listed here. For a complete list of VELatLongRectangle class members, see the VELatLongRectangle Class topic.

Public Properties

Name

Description

VELatLongRectangle.TopLeftLatLong Property

A VELatLong Class object that specifies the latitude and longitude of the upper-left corner of the map view.

VELatLongRectangle.BottomRightLatLong Property

A VELatLong Class object that specifies the latitude and longitude of the lower-right corner of the map view.

VELatLongRectangle.TopRightLatLong Property

If the map is in 3D mode, a VELatLong Class object that specifies the latitude and longitude of the upper-right corner of the map view.

VELatLongRectangle.BottomLeftLatLong Property

If the map is in 3D mode, a VELatLong Class object that specifies the latitude and longitude of the lower-left corner of the map

VELatLongRectangle.BottomLeftLatLong Property

A VELatLong Class object that specifies the latitude and longitude of the lower-left corner of the map view.

Syntax

VELatLongRectangle.BottomLeftLatLong = value

VELatLongRectangle.BottomRightLatLong Property

A VELatLong Class object that specifies the latitude and longitude of the lower-right corner of the map view.

Syntax

VELatLongRectangle.BottomRightLatLong = value

VELatLongRectangle.TopLeftLatLong Property

A VELatLong Class object that specifies the latitude and longitude of the upper-left corner of the map view.

Syntax

VELatLongRectangle.TopLeftLatLong = value

VELatLongRectangle.TopRightLatLong Property

A VELatLong Class object that specifies the latitude and longitude of the upper-right corner of the map view.

Syntax

VELatLongRectangle.TopRightLatLong = value

VELocationPrecision Enumeration

An enumeration of location precision values.

Syntax

VELocationPrecision { Interpolated Rooftop }

Members

Member

Description

Interpolated

The precision is estimated from multiple geocoded sources.

Rooftop

The precision is from a single match.

See Also

VEGeocodeLocation.Precision Property

VEPlace.Precision Property

VEMap Class

Provides Bing map and search functionality to a Web page.

Constructor

Name

Description

VEMap Constructor

Initializes a new instance of the VEMap object.

Public Events

The events of the VEMap Class are divided into events specific to Bing Maps, mouse events, and keyboard events. For a complete list of VEMap events, see the VEMap Events topic.

Name

Description

Keyboard Events

Input events produced by the keyboard connected to the computer.

Mouse Events

Input events produced by the mouse device connected to the computer.

Bing Maps Events

The events of the VEMap Class specific to Bing Maps.

Public Methods

Name

Description

VEMap.AddControl Method

Adds a custom control to the map.

VEMap.AddCustomLayer Method

Adds a custom layer to the map.

VEMap.AddShape Method

Adds an existing VEShape Class object, as specified by the shape parameter, to the base layer.

VEMap.AddShapeLayer Method

Adds the specified shape layer to the map.

VEMap.AddTileLayer Method

Adds a tile layer to the map, and if the

Name

Description

visibleOnLoad parameter is true, it also shows it on the map.

VEMap.AttachEvent Method

Attaches a Map Control event to a specified function.

VEMap.Clear Method

Removes all shapes, shape layers, and search results on the map. Also removes the route from the map, if one is displayed.

VEMap.ClearInfoBoxStyles Method

Clears out all of the default Bing Maps info box CSS styles.

VEMap.ClearTraffic Method

Clears the traffic map.

VEMap.DeleteAllShapeLayers Method

Deletes all shape layers, along with any shapes within the layers.

VEMap.DeleteAllShapes Method

Deletes all shapes in all layers, leaving empty layers behind.

VEMap.DeleteControl Method

Removes the specified control from the map.

VEMap.DeleteRoute Method

Clears the current route, VERoute Class object, from the map.

VEMap.DeleteShape Method

Deletes a VEShape Class object from any layer, including the base map layer.

VEMap.DeleteShapeLayer Method

Deletes the specified shape layer from the map.

VEMap.DeleteTileLayer Method

Deletes a tile layer from view.

VEMap.DetachEvent Method

Detaches the specified map control event so that it no longer calls the specified function.

VEMap.Dispose Method

Deletes the VEMap object and releases any associated resources

VEMap.EnableShapeDisplayThreshold Method

Specifies whether shapes are drawn below a threshold zoom level.

VEMap.EndContinuousPan Method

Stops the continuous map panning initiated by a call to the VEMap.StartContinuousPan Method .

VEMap.Find Method

Returns an array of found results.

VEMap.FindLocations Method

Performs a search for locations that match a

Name

Description

VELatLong Class input.

VEMap.Geocode Method

Finds a geographic location based on a specified address or place name string as well as other geocoding options.

VEMap.GetAltitude Method

In 3D mode, returns a double that represents the altitude (in meters) above the geoid.

VEMap.GetBirdseyeScene Method

If the map view is already set to bird's eye, returns the current VEBirdseyeScene Class object.

VEMap.GetCenter Method

Returns a VELatLong Class object that represents the location of the center of the current map view.

VEMap.GetDirections Method

Draws a multi-point route on the map and sends details about the route to a callback function.

VEMap.GetHeading Method

In 3D mode, returns an integer that represents the compass heading of the current map view.

VEMap.GetImageryMetadata Method

Returns information about the requested imagery, including imagery date stamps and vendor attribution.

VEMap.GetLeft Method

Returns the pixel value of the left edge of the map control.

VEMap.GetMapMode Method

Returns the current map mode.

VEMap.GetMapStyle Method

Returns the current map style.

VEMap.GetMapView Method

Returns the current map view object as a VELatLongRectangle Class object.

VEMap.GetPitch Method

In 3D mode, returns an integer that represents the pitch of the current map view.

VEMap.GetRoute Method

Deprecated. Draws a route on the map and sends details about the route to a callback function.

VEMap.GetShapeByID Method

Gets the reference to a VEShape Class object based on its internal identifier.

VEMap.GetShapeLayerByIndex Method

Gets the reference to a VEShapeLayer Class

Name

Description

object based on its index.

VEMap.GetShapeLayerCount Method

Gets the total number of shape layers on the map.

VEMap.GetTileLayerCount Method

Gets the number of tile layers.

VEMap.GetTileLayerByID Method

Gets a tile layer based upon its identifier.

VEMap.GetTileLayerByIndex Method

Gets a tile layer based upon an index value.

VEMap.GetTop Method

Returns the pixel value of the top edge of the map control.

VEMap.GetVersion Method

Returns the current version of the map control.

VEMap.GetZoomLevel Method

Returns the current zoom level of the map.

VEMap.Hide3DNavigationControl Method

In 3D mode, hides the default user interface for controlling the map in 3D mode. By default, this control is shown.

VEMap.HideAllShapeLayers Method

Hides all of the shape layers on the map.

VEMap.HideBaseTileLayer Method

Hides the base tile layer of the map.

VEMap.HideControl Method

Hides the specified control from view.

VEMap.HideDashboard Method

Hides the default user interface for controlling the map (the compass and the zoom control).

VEMap.HideFindControl Method

Deprecated. Removes the Find control from the map.

VEMap.HideInfoBox Method

Hides a shape's custom or default info box.

VEMap.HideMiniMap Method

Hides the mini map from view.

VEMap.HideScalebar Method

Hides the scale bar from the map.

VEMap.HideTileLayer Method

Hides a tile layer from view.

VEMap.HideTrafficLegend Method

Hides the traffic legend.

VEMap.Import3DModel Method

Imports data from a Wavefront OBJ file and displays it as a 3D model on the map.

VEMap.ImportShapeLayerData Method

Imports data from a GeoRSS feed, Bing Maps ( http://maps.live.com ) collection, or KML URL.

VEMap.IncludePointInView Method

Changes the map view so that it includes both the specified VELatLong Class point and the

Name

Description

center point of the current map.

VEMap.IsBirdseyeAvailable Method

Determines whether the bird's eye map style is available in the current map view.

VEMap.LatLongToPixel Method

Converts an array of VELatLong Class objects (latitude/longitude pair) to an array of VEPixel Class objects.

VEMap.LoadTraffic Method

Loads the traffic map.

VEMap.LoadMap Method

Loads the specified map. All parameters are optional.

VEMap.Pan Method

When in 2D mode, moves the map the specified amount.

VEMap.PanToLatLong Method

Pans the map to a specific latitude and longitude.

VEMap.PixelToLatLong Method

Converts a pixel (a point on the map) to a VELatLong Class object (latitude/longitude pair).

VEMap.RemoveCustomLayer Method

Removes a custom layer from the map.

VEMap.Resize Method

Resizes the map based on the specified width and height.

VEMap.Search Method

Performs a search based on a given query and options.

VEMap.SetAltitude Method

In 3D mode, sets the altitude, in meters, above the WGS 84 ellipsoid in the map view.

VEMap.SetBirdseyeOrientation Method

Changes the orientation of the existing bird's eye image ( VEBirdseyeScene Class object) to the specified orientation.

VEMap.SetBirdseyeScene Method

Overloaded. Displays the specified bird's eye image.

VEMap.SetCenter Method

Centers the map to a specific latitude and longitude.

VEMap.SetCenterAndZoom Method

Centers the map to a specific latitude and longitude and sets the zoom level.

VEMap.SetClientToken Method

Sets a Bing Maps token for the VEMap object.

Name

Description

VEMap.SetCredentials Method

Sets the credentials to use to authenticate map service requests.

VEMap.SetDashboardSize Method

Sets the map dashboard size and type.

VEMap.SetDefaultInfoBoxStyles Method

Sets the info box CSS styles back to their original classes.

VEMap.SetFailedShapeRequest Method

Specifies what the map control does when a request to the server to get the accurate position of a shape when the map style is changed to birdseye fails.

VEMap.SetHeading Method

In 3D mode, sets the compass heading of the current map view.

VEMap.SetMapMode Method

Sets the mode of the map.

VEMap.SetMapStyle Method

Sets the style of the map.

VEMap.SetMapView Method

Sets the map view to include all of the points, lines, or polygons specified in the provided array, or to the view defined by a VEMapViewSpecification Class object.

VEMap.SetMouseWheelZoomToCenter Method

Specifies whether to zoom to the center of the screen or to the cursor position on the screen.

VEMap.SetPitch Method

In 3D mode, sets the pitch of the current map view.

VEMap.SetPrintOptions Method

Sets the print options for the current map.

VEMap.SetScaleBarDistanceUnit Method

Sets the distance unit (kilometers or miles) for the map scale.

VEMap.SetShapesAccuracy Method

Specifies the accuracy in converting shapes when the map style is changed to birdseye.

VEMap.SetShapesAccuracyRequestLimit Method

Specifies how to draw the polygons or the polylines whose points exceed the maximum limit or when a request to the server fails when the map style is changed to birdseye.

VEMap.SetTileBuffer Method

Sets the number of "rings" of map tiles that should be loaded outside of the visible mapview area.

VEMap.SetTrafficLegendText Method

Specifies the text shown with the traffic legend,

Name

Description

if visible.

VEMap.SetZoomLevel Method

Sets the view of the map to the specified zoom level.

VEMap.Show3DBirdseye Method

Controls whether or not to show the Birdseye and BirdseyeHybrid map styles when the map mode is set to VEMapMode.Mode3D.

VEMap.Show3DNavigationControl Method

In 3D mode, shows the default user interface for controlling the map in 3D mode. By default, this control is shown.

VEMap.ShowAllShapeLayers Method

Shows all shape layers on the map.

VEMap.ShowBaseTileLayer Method

Shows the base tile layer of the map.

VEMap.ShowControl Method

Makes the specified control visible. This method only affects control elements that have been hidden from view using the VEMap.HideControl Method .

VEMap.ShowDashboard Method

Shows the default user interface for controlling the map (the compass-and-zoom control). By default, this control is shown.

VEMap.ShowDisambiguationDialog Method

Specifies whether the default disambiguation dialog is displayed when multiple results are returned from a location query.

VEMap.ShowFindControl Method

Deprecated. Shows the Find control, which enables users to enter search queries.

VEMap.ShowInfoBox Method

Shows a shape's custom or default info box.

VEMap.ShowMessage Method

Displays the specified message in a dialog box on the map.

VEMap.ShowMiniMap Method

Displays the mini map at the specified offset from the top left corner of the screen.

VEMap.ShowScalebar Method

Displays the scale bar on the map.

VEMap.ShowTileLayer Method

Shows a tile layer from view.

VEMap.ShowTrafficLegend Method

Displays the traffic legend.

VEMap.StartContinuousPan Method

Moves the map in the specified direction until the VEMap.EndContinuousPan Method is called.

Name

Description

VEMap.ZoomIn Method

Increases the map zoom level by 1.

VEMap.ZoomOut Method

Decreases the map zoom level by 1.

Public Properties

Name

Description

VEMap.onLoadMap Property

Specifies the function to call when the map is first loaded.

See Also

VEMap Event Object Properties

VEMap Constructor

Initializes a new instance of the VEMap class.

Syntax

var x = new VEMap(control_id);

Parameters

Parameter

Description

control_id

The ID of the HTML control that will contain the map

Remarks

After initializing the map object, call the VEMap.LoadMap Method .

When you create a new instance of VEMap Class , you must specify the control on the Web page that will contain the map. For example, it is most common to display the map in a DIV control. You specify the value of the id parameter of the DIV control when initializing VEMap, as shown in the following example.

See Also

VEMap.Dispose Method

VEMap Events

The events of the VEMap Class are listed here, divided into events specific to Bing Maps, mouse events, and keyboard events. For a complete list of VEMap class members, see the VEMap Class topic.

Public Events

Keyboard Events

Mouse Events

Bing Maps Events

VEMap Event Object Properties

Remarks

An event handler can disable the default Bing Maps action associated with that event by returning true. If the event handler does not return a value or returns false, the default action occurs after any actions defined in the event handler.

Note Use only the function name to attach a handler to an event. If an entire function is attached as the handler to an event, it cannot be detached.

An event object is passed to the event handler when the event is fired. Depending on the event, a subset of the values in the VEMap Event Object Properties table are accessible from the event object. For a list of the properties that are available for a particular event, see the reference topic for that event.

Event handlers can perform actions based on the type of element (normally a VEShape Class object) by using the elementID property of the event object in conjunction with the VEMap.GetShapeByID Method method. See the example code in the VEMap Event Object Properties topic for further information.

Keyboard Events

The events of the VEMap Class class that are specific to keyboard events are listed here.

Public Keyboard Events

Name

Description

VEMap.onkeypress Event

Occurs when a key is pressed and released. This is not supported in 3D mode.

VEMap.onkeydown Event

Occurs when a key is pressed (but before it is released). This is not supported in 3D mode.

VEMap.onkeyup Event

Occurs when a key is released. This is not supported in 3D mode.

See Also

Mouse Events

Bing Maps Events

VEMap Event Object Properties

VEMap.onkeypress Event

Occurs when a key is pressed, and released. This is not supported in 3D mode.

Syntax

VEMap.AttachEvent("onkeypress", function_name);

Return Value

A MapEvent object, which has the following properties:

Property

Description

altKey

A Boolean object representing whether the ALT key was held when the key was pressed.

ctrlKey

A Boolean object representing whether the CTRL key was held when the key was pressed.

eventName

A String object representing the type of event that occurred.

keyCode

The key code of the key that has been pressed.

mapStyle

The current map style

sceneID

If the map style is set to bird's eye (oblique), the unique identifier of the current bird's eye scene.

sceneOrientation

If the map style is set to bird's eye (oblique), the orientation of the current bird's eye scene.

shiftKey

A Boolean object representing whether the shift key was held when the key was pressed.

zoomLevel

The current zoom level of the map.

See Also

VEMap Event Object Properties

VEMap.onkeydown Event

Occurs when a key is pressed (but before it is released). This is not supported in 3D mode.

Syntax

VEMap.AttachEvent("onkeydown, function_name);

Return Value

A MapEvent object, which has the following properties:

Property

Description

altKey

A Boolean object representing whether the ALT key was held when the key was pressed.

ctrlKey

A Boolean object representing whether the CTRL key was held when the key was pressed.

eventName

A String object representing the type of event that occurred.

keyCode

The key code of the key that has been pressed.

mapStyle

The current map style

sceneID

If the map style is set to bird's eye (oblique), the unique identifier of the current bird's eye scene.

sceneOrientation

If the map style is set to bird's eye (oblique), the orientation of the current bird's eye scene.

shiftKey

A Boolean object representing whether the shift key was held when the key was pressed.

zoomLevel

The current zoom level of the map.

See Also

VEMap Event Object Properties

VEMap.onkeyup Event

Occurs when a key is released. This is not supported in 3D mode.

Syntax

VEMap.AttachEvent("onkeyup", function_name);

Return Value

A MapEvent object, which has the following properties:

Property

Description

altKey

A Boolean object representing whether the ALT key was held when the key was pressed.

ctrlKey

A Boolean object representing whether the CTRL key was held when the key was pressed.

eventName

A String object representing the type of event

Property

Description

that occurred.

keyCode

The key code of the key that has been pressed.

mapStyle

The current map style

sceneID

If the map style is set to bird's eye (oblique), the unique identifier of the current bird's eye scene.

sceneOrientation

If the map style is set to bird's eye (oblique), the orientation of the current bird's eye scene.

shiftKey

A Boolean object representing whether the shift key was held when the key was pressed.

zoomLevel

The current zoom level of the map.

See Also

VEMap Event Object Properties

Mouse Events

The events of the VEMap Class that are specific to mouse events are listed here.

Public Mouse Events

Name

Description

VEMap.onclick Event

Occurs when a left or right mouse button is single-clicked.

VEMap.ondoubleclick Event

Occurs when a left mouse button is double-clicked.

VEMap.onmousemove Event

Occurs when the mouse cursor moves.

This is not supported in 3D mode.

VEMap.onmousedown Event

Occurs when a mouse button (left, right, or middle) is clicked (but before it is released).

VEMap.onmouseup Event

Occurs when a mouse button (left, right, or middle) is released.

VEMap.onmouseover Event

Occurs when the mouse cursor moves over a VEShape Class object.

VEMap.onmouseout Event

Occurs when the mouse cursor moves away from a VEShape object.

Name

Description

VEMap.onmousewheel Event

Occurs when the mouse wheel is moved.

This method is not supported in 3D mode, and the coordinate values returned in Firefox 1.5 and 2.0 are not correct.

See Also

Bing Maps Events

Keyboard Events

VEMap Event Object Properties

VEMap.onclick Event

Occurs when a left or right mouse button is single-clicked.

Syntax

VEMap.AttachEvent("onclick", function_name);

Return Value

A MapEvent object, which has the following properties:

Property

Description

altKey

A Boolean object representing whether the ALT key was held when the key was pressed.

This is not supported in 3D mode.

ctrlKey

A Boolean object representing whether the CTRL key was held when the key was pressed.

This is not supported in 3D mode.

elementID

The ID of the object associated with the event, usually a VEShape Class object or the base map.

eventName

A String object representing the type of event that occurred.

latLong

The latLong coordinates of the clicked location.

Property

Description

This only works in 3D mode and is not supported in the Core Map Control . For 2D, you can convert mapX and mapY to a latLong using the VEMap.PixelToLatLong Method method.

leftMouseButton

A Boolean object representing whether the left mouse button has been clicked.

rightMouseButton

A Boolean object representing whether the right mouse button has been clicked.

mapStyle

The current map style as a String. Valid String results are a, r, h, and o.

sceneID

If the map style is set to bird's eye (oblique), the unique identifier of the current bird's eye scene.

sceneOrientation

If the map style is set to bird's eye (oblique), the orientation of the current bird's eye scene.

shiftKey

A Boolean object representing whether the shift key was held when the key was pressed.

This is not supported in 3D mode.

clientX

The x coordinate of the mouse cursor relative to the browser window.

clientY

The y coordinate of the mouse cursor relative to the browser window.

screenX

The x coordinate of the mouse cursor relative to the screen.

This is not supported in 3D mode.

screenY

The y coordinate of the mouse cursor relative to the screen.

This is not supported in 3D mode.

mapX

The x coordinate of the map relative to the screen.

Property

Description

This is not supported in 3D mode.

mapY

The y coordinate of the map relative to the screen.

This is not supported in 3D mode.

zoomLevel

The current zoom level of the map.

See Also

VEMap Event Object Properties

VEMap.ondoubleclick Event

VEMap.ondoubleclick Event

Occurs when the left mouse button is double-clicked.

Syntax

VEMap.AttachEvent("ondoubleclick", function_name);

Return Value

A MapEvent object, which has the following properties:

Property

Description

altKey

A Boolean object representing whether the ALT key was held when the key was pressed.

This is not supported in 3D mode.

ctrlKey

A Boolean object representing whether the CTRL key was held when the key was pressed.

This is not supported in 3D mode.

elementID

The ID of the object associated with the event, usually a VEShape Class object or the base map.

eventName

A String object representing the type of event that occurred.

latLong

The latlong coordinates of the clicked location. This only works in 3D mode and is not

Property

Description

supported in the Core Map Control . For 2D, you can convert mapX and mapY to a latlong using the VEMap.PixelToLatLong Method .

mapStyle

The current map style as a String. Valid String results are a, r, h, and o.

sceneID

If the map style is set to bird's eye (oblique), the unique identifier of the current bird's eye scene.

sceneOrientation

If the map style is set to bird's eye (oblique), the orientation of the current bird's eye scene.

shiftKey

A Boolean object representing whether the shift key was held when the key was pressed.

This is not supported in 3D mode.

clientX

The x coordinate of the mouse cursor relative to the browser window.

clientY

The y coordinate of the mouse cursor relative to the browser window.

screenX

The x coordinate of the mouse cursor relative to the screen.

This is not supported in 3D mode.

screenY

The y coordinate of the mouse cursor relative to the screen.

This is not supported in 3D mode.

mapX

The x coordinate of the map relative to the screen.

This is not supported in 3D mode.

mapY

The y coordinate of the map relative to the screen.

This is not supported in 3D mode.

Property

Description

zoomLevel

The current zoom level of the map.

See Also

VEMap.onclick Event

VEMap.onmousedown Event

Occurs when a mouse button (left, right, or middle) is clicked but before it is released.

Syntax

VEMap.AttachEvent("onmousedown", function_name);

Return Value

A MapEvent object, which has the following properties:

Property

Description

altKey

A Boolean object representing whether the ALT key was held when the key was pressed.

This is not supported in 3D mode.

ctrlKey

A Boolean object representing whether the CTRL key was held when the key was pressed.

This is not supported in 3D mode.

elementID

The ID of the object associated with the event, usually a VEShape Class object or the base map.

eventName

A String object representing the type of event that occurred.

latLong

The latlong coordinates of the clicked location. This only works in 3D mode and is not supported in the Core Map Control . For 2D, you can convert mapX and mapX to a latlong using the VEMap.PixelToLatLong Method .

leftMouseButton

A Boolean object representing whether the left mouse button has been clicked.

rightMouseButton

A Boolean object representing whether the right

Property

Description

mouse button has been clicked.

mapStyle

The current map style as a String. Valid String results are a, r, h, and o.

sceneID