Share via


LocationFromOSGridReference method

Returns a Location object for a given U.K. Ordnance Survey Grid reference string. Does not change the map view.

Applies to

Objects: Map

Syntax

object.LocationFromOSGridReference(OSGridDescriptionAs String, [altitude as Double])

Parameters

Part

Description

object

Required. An expression that returns a Map object.

OSGridDescription

Required String. This text defines a point in O.S. Grid notation. It can be a 2-, 4-, or 8-digit reference with letters (for example, "TQ1232 1232") or a 12-digit reference (for example, "054455 025889"). Spaces are not required.

Altitude

Optional Double. The height above the earth's surface from which the map is viewed, in GeoUnits. If not specified, the resulting Location object uses the current altitude for the GoTo method.

Example

  Sub ZoomToLocation()


  'Zooms to a spot near Washington, England.
  Dim objApp As New MapPoint.Application
  Dim objMap As MapPoint.Location

  'Get the location of a spot in the U.K. using OS Grid reference.
  Set objLoc = objApp.ActiveMap.LocationFromOSGridReference( _
    "TQ12321232", 100)
  objLoc.GoTo

  End Sub

Note   This sample code is for illustration purposes only.