Share via


RenderServiceSoap.GetBestMapView Method

Creates a single, best map view for displaying a set of locations. A best map view is the largest scale map that can be centered over the set of locations while displaying the entire location along with a small buffer. Returns a MapViewRepresentations object for a specified Location object or array of Location[] objects.

Public NotOverridable Function GetBestMapView ( ByVal locations As
  [Namespace].Location(), ByVal dataSourceName As String )
  As [Namespace].MapViewRepresentations
    Member of [Namespace].RenderServiceSoap
[C#]
public [Namespace].MapViewRepresentations GetBestMapView
  ( [Namespace].Location[] locations ,
  System.String dataSourceName )
    Member of [Namespace].RenderServiceSoap

Parameters

  • locations
    An array of locations (Location[] objects) from which the Entity, BestMapView, or LatLong property is used to generate a best map view. Valid array size is 1 through 500.
  • dataSourceName
    A string representing the name of the data source (DataSource.Name property) for the locations. String.

Remarks

  • Largest scale map means that the map is zoomed in as close as possible.

  • Does not return an array of views for a set of locations; instead, the returned MapViewRepresentations object contains the best map view for the entire set.

  • Because a Location object can contain multiple objects, the order of precedence in determining the best map view is:

    1. Location.Entity property
    2. Location.BestMapView property
    3. Location.LatLong property

    The Location.Address property is ignored.

  • If the Location.Entity property is not null, only the Entity.ID property is used, and the other properties are ignored.

  • The dataSourceName parameter must represent a data source with a CanFindPlaces capability (DataSourceCapability enumeration) or the locations passed in the locations parameter must have only Location.BestMapView and Location.LatLong properties; otherwise, a SOAP fault is returned.

  • To return the properties of a data source, use the CommonServiceSoap.GetDataSourceInfo method.

  • For a table of the available data sources and the functions that can be performed on the data source, see MapPoint Web Service Data Sources and Capabilities.

  • For best results, do not use the GetBestMapView method for a single location.

  • To render a map of a best map view, you can pass a ViewByBoundingLocations object to the RenderServiceSoap.GetMap method.

Example

 
[Visual Basic] 
'This example assumes that the MapPoint Web Service namespace 
'has been imported 

'Get the best view of two locations
Dim myLocations(1) As Location
myLocations(0) = New Location()
myLocations(1) = New Location()
myLocations(0).LatLong = New LatLong()
myLocations(1).LatLong = New LatLong()
myLocations(0).LatLong.Latitude = 40
myLocations(0).LatLong.Longitude = -120
myLocations(1).LatLong.Latitude = 41
myLocations(1).LatLong.Longitude = -121

Dim renderService As New RenderServiceSoap()
Dim mapRepresentations As MapViewRepresentations
mapRepresentations = renderService.GetBestMapView(myLocations, "MapPoint.NA")

 
[C#]
//This example assumes that the MapPoint Web Service namespace 
//has been imported 

//Get the best view of two locations
Location[] myLocations = new Location[2];
myLocations[0] = new Location();
myLocations[1] = new Location();
myLocations[0].LatLong = new LatLong();
myLocations[1].LatLong = new LatLong();
myLocations[0].LatLong.Latitude = 40;
myLocations[0].LatLong.Longitude = -120;
myLocations[1].LatLong.Latitude = 41;
myLocations[1].LatLong.Longitude = -121;

RenderServiceSoap renderService  = new RenderServiceSoap();
MapViewRepresentations mapRepresentations;
mapRepresentations = renderService.GetBestMapView(myLocations, "MapPoint.NA");

 

See Also

RenderServiceSoap Class | MapViewRepresentations Class | Location Class | DataSource.Name Property | Entity.ID Property | DataSourceCapability Enumeration | CommonServiceSoap.GetDataSourceInfo Method | MapPoint Web Service Data Sources and Capabilities | ViewByBoundingLocations Class | RenderServiceSoap.GetMap Method