Share via


Union method

Returns a Location object that represents the best map view to display all of the specified locations.

Applies to

Objects: Map

Syntax

object.Union(ArrayOfLocations)

Parameters

Part

Description

object

Required. An expression that returns a Map object.

ArrayOfLocations

Required Object. An array of Location objects to display on the map.

Remarks

  • For an array of locations that cover a larger part of the globe than can be shown in globe view, first change the Projection property of the Map object to geoFlatViewWhenZoomedOut.

Example

Sub TwoLocationsInView()

Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objLoc1 As MapPoint.Location
Dim objLoc2 As MapPoint.Location

'Set up the application
Set objMap = objApp.ActiveMap
objApp.Visible = True
objApp.UserControl = True

'Ensure two locations can be viewed on the map, zoom out
Set objLoc1 = objMap.FindResults("Seattle, WA").Item(1)
Set objLoc2 = objMap.FindResults("Spokane, WA").Item(1)
objMap.Union(Array(objLoc1, objLoc2)).GoTo

End Sub

Note   This sample code is specifically for use in MapPoint North America; it is for illustration purposes only.