Convert to Decimal Degrees
Last Modified: February 25, 2024 18:18 CEST

Convert-ToDecimalDegrees #

SYNOPSIS #

This PowerShell function converts coordinates in Degrees-Minutes-Seconds (DMS) format to Decimal Degrees (DD). Source code on GitHub.

SYNTAX #

Convert-ToDecimalDegrees [[-degrees] <Int32>] [[-minutes] <Int32>] [[-seconds] <Int32>] [[-direction] <String>]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION #

This function takes coordinates in Degrees-Minutes-Seconds (DMS) format, along with a direction (N,S,E,W), and converts them to Decimal Degrees (DD) format. For southern latitudes and western longitudes, the DD value will be negative. Make sure that the values you input are valid DMS coordinates

EXAMPLES #

Example 1: Converts coordinates to Decimal Degrees #

PS C:\> Seconds of the DMS coordinate. Should be an integer between 0 and 59.

Returns: 52.52

PARAMETERS #

-degrees #

Degrees of the DMS coordinate. Should be an integer between 0 and 180.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-direction #

The direction of the DMS coordinate. Should be one of ‘N’, ‘S’, ‘E’, ‘W’ (case insensitive).

Type: String
Parameter Sets: (All)
Aliases:
Accepted values: N, S, E, W

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-minutes #

Minutes of the DMS coordinate. Should be an integer between 0 and 59.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-seconds #

Seconds of the DMS coordinate. Should be an integer between 0 and 59.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters #

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS #

None #

OUTPUTS #

System.Object #

NOTES #

Get-Distance