Working with Map Views

MapPoint Web Service is deprecated and will be retired November 18, 2011. Please go to for information about upgrading to Bing Maps.

The MapView class defines the part of the world that you want rendered on a map. In many cases, you can use one of the map views that MapPoint Web Service provides for you (MapViewRepresentations object). For example, if you want to display a map of Canada, you can use the FindServiceSoap.Find method to find the entity in MapPoint Web Service that represents Canada. In the resulting FindResult object, MapPoint Web Service returns map views of the found entity that are defined using different measures. Passing one of these map views into the RenderServiceSoap.GetMap method returns a map image of Canada.

If you want to perform pan and zoom navigation operations once you have a map, you can identify the factor by which you want to pan or zoom in the MapSpecifications.Options property passed to the GetMap method. The resulting MapImage object includes a map view that can then be used for a subsequent pan or zoom operation.

The four different ways that MapPoint Web Service defines map views are contained in the following objects, which are derived from the MapView object:


A map view based on a set of locations that must be within the coverage area.


A map view based on a specific height, width, and center point.


A map view based on a specific map scale and center point.


A map view based on a minimum bounding rectangle.

ViewByBoundingLocations class

This map view is used only as input to the GetMap method, and is defined by the set of locations (Location[] objects) for which you want the best map view. A best map view is the largest scale map that can be centered over the location (or set of locations), while displaying the entire location along with a small buffer. The map views returned with the map image are of the three other types of map views. (To return these best map views without rendering a map, you can pass an array of Location[] objects directly to the RenderServiceSoap.GetBestMapView method.)

ViewByHeightWidth class

The CenterPoint property defines the point on the world that is at the center of a map image. The Height and Width properties define the distance in kilometers or miles on the Earth's surface that the map view contains. This combination of properties implies a rectangle, as in the following illustration.


MapPoint Web Service returns a map image that includes at least the area of the map you have requested. The returned map view differs from the requested map view when the aspect ratio of the requested map image (that is, the height and width of the image in pixels that you specify in the MapOptions.Format property, which is passed in the MapSpecifications.Options property to the GetMap method) does not match that of the requested map view. The returned map view represents a larger area than the requested map view to display the entire requested map view. Using the rectangle from the previous illustration as the requested map view, the following example shows how the returned map view is affected by changes in the requested image size.


Changing the size of the image (but not the aspect ratio) makes a different-sized image of the same part of the Earth.

ViewByScale class

The properties of the ViewByScale class (CenterPoint and Scale) alone do not define a map view. In this case, the map view is only defined when used in conjunction with the image size. Scale—which is unitless—is a ratio of units on the displayed map to units on the ground. The Scale property is defined by the denominator from a map scale ratio representing the number of units in the real world that a single unit on the map represents, as displayed on the screen—such as 1:50,000, where the Scale property is 50,000.

For example, to display the Earth as having a diameter of one inch on a map image, set the Scale property to 502,000,000 (the actual diameter of the Earth is approximately 502,000,000 inches). Similarly, to make a five–inch image of the Earth, set the Scale property to 100,400,000, which is 502,000,000 / 5.

The aspect ratio of an image does not affect the scale. Setting the scale to 100,400,000 renders the Earth as 480 pixels (96 x 5), whether the image size is 480 x 480 pixels or 2,000 x 2,000 pixels. (The MapPoint Web Service assumed display resolution is 96 dots per inch (dpi), the MapPointConstants.AssumedDpi property.)

Note   if you know the actual resolution of a display device, you can use the mappoint web service assumed dpi to modify the scale property. for example, if you know that you are displaying on a 120 dpi monitor, you can multiply the scale property you pass in by 96/120 to have the map rendered at the scale you want. for example, if you want one inch of the map on the monitor to represent 20,000 inches on the earth, pass in a scale of 16,000 (which is 20,000 × 96 / 120).

The following illustration shows how you can use image size and scale to affect a map image.


ViewByBoundingRectangle class

The BoundingRectangle property specifies an area of the globe by defining its northeast and southwest corners. MapPoint Web Service uses this area as the basis to define a map view that includes all the requested area.

The defined area is not an actual rectangle on the Earth because lines of latitude and longitude are not straight on a sphere.


Because the area defined by the BoundingRectangle property is not an actual rectangle, the returned map view includes some of the area outside the boundaries of the BoundingRectangle to display the entire requested map view, as shown in the following image.


Similarly, the ViewByBoundingRectangle object returned with an image is smaller than the other returned map views and is not a rectangle, as depicted by the red lines in the previous image. The smaller the scale of the map, the closer a BoundingRectangle property is to being a true rectangle.

Note   the aspect ratio of the image also affects the final map view as in the case of the viewbyheightwidth class.