Latitude property
Returns the latitude of the location. Read-only Double.
Applies to
Objects: Location
Syntax
object.Latitude
Parameters
Part |
Description |
---|---|
object |
Required. An expression that returns a Location object. |
Remarks
- Microsoft MapPoint returns a floating point number representing decimal degrees in the range –90 to 90. A negative number indicates that the latitude is south of the equator.
Example
Sub GetLatitude()
Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objLoc As MapPoint.Location
Dim strDir As String * 1
Dim dblLat As Double
'Set up the application
Set objMap = objApp.ActiveMap
objApp.Visible = True
objApp.UserControl = True
'Find an address
Set objLoc = objMap.FindAddressResults("1 Microsoft Way", "Redmond", "WA")(1)
'Get latitude of this location
dblLat = objLoc.Latitude
'If the latitude is positive, set direction to North
If dblLat > 0 Then
strDir = "N"
'If the latitude is negative, set direction to South
ElseIf dblLat < 0 Then
strDir = "S"
'Set blank if the latitude is zero
Else
strDir = ""
End If
'Display the latitude with degree symbol and N/S
MsgBox "Latitude: " + Format(Abs(dblLat), "0.00000") + Chr(176) + strDir
End Sub