Longitude property
Returns the longitude of the location. Read-only Double.
Applies to
Objects: Location
Syntax
object.Longitude
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 –180 to 180. A negative number indicates that the longitude is west of the prime meridian.
Example
Sub GetLongitude()
Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objLoc As MapPoint.Location
Dim strDir As String * 1
Dim dblLon 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 longitude of this location
dblLon = objLoc.Longitude
'If the longitude is positive, set direction to East
If dblLon > 0 Then
strDir = "E"
'If the longitude is negative, set direction to West
ElseIf dblLon < 0 Then
strDir = "W"
'Set blank if the longitude is zero
Else
strDir = ""
End If
'Display the longitude with degree symbol and E/W
MsgBox "Longitude: " + Format(Abs(dblLon), "0.00000") + Chr(176) + strDir
End Sub