VEMap.Import3DModel Method

You are not viewing the latest version of the AJAX control. Bing Maps AJAX V7 is the recommended JavaScript control for Bing Maps. If you need this documentation, it is available in as a CHM or PDF download.

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:

Imports a model data file and displays a 3D model on the map.

VEMap.Import3DModel(modelShapeSource, callback, latLong, orientation, scale);


Parameter Description


A VEModelSourceSpecification Class object specifying the model data to import.


The name of the function that is called after the data has been imported. See below for the arguments received by the callback.


A VELatLong Class object that specifies the point at which to place the origin of the model.


A VEModelOrientation Class object that specifies the orientation of the model on the map.


A VEModelScale Class object that specifies the scale of the model.

A VEShape Class object corresponding to the pushpin associated with the 3D model. This is also returned to the function specified in the callback parameter.

The function defined in the callback parameter receives the following arguments, in the order shown:

  • A VEShape Class object corresponding to the pushpin associated with the 3D model. This is the same object returned by the Import3DModel method.

  • A VEModelStatusCode Enumeration value indicating the status of the 3D model import. This status code only indicates if the model data was successfully imported. It does not indicate whether or not the model rendered properly.

3D models support VEShape Class methods that have pushpin support.

Information about file support is found in the VEModelFormat Enumeration topic.

The function specified in the callback parameter is called if the user switches to VEMapMode.Mode3D from VEMapMode.Mode2D.

The function specified in the callback parameter is called when the following methods are used: VEShape.Show Method, VEShape.SetZIndex Method, VEShape.SetMaxZoomLevel Method, VEShape.SetMinZoomLevel Method, VEShape.ShowIcon Method, and VEShape.HideIcon Method.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
      <title>Import 3D Model</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src=""></script>

      <script type="text/javascript">
         var map = null;
         function GetMap()
            map = new VEMap('myMap');

         function AddModel(type)
            var center = map.GetCenter();

            var layer = new VEShapeLayer();
            var modelSpec = new VEModelSourceSpecification(VEModelFormat.OBJ, document.getElementById('txtSource').value, layer);
            map.Import3DModel(modelSpec, onModelLoad, center, null, null);

            // Zoom in so you can see the model

         function onModelLoad(model, status)
            if (status == VEModelStatusCode.Success)
               alert("The 3D model has been loaded.");
            if (status == VEModelStatusCode.InvalidURL)
               alert("The URL given for the model data is invalid.");
            if (status == VEModelStatusCode.Failed)
               alert("There was a problem loading the 3D model.");
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:600px; height:400px;"></div>
      <input id="txtSource" type="text" value="" name="txtSource">
      <input id="btnAddModel" type="button" value="Load 3D Model"