Convert DMS to GeoPoint

Supported in: Batch, Streaming

Converts a geospatial coordinate string in degrees, minutes, seconds (DMS) format to a GeoPoint in accordance to user-provided formats. The default formats are DDD*°MM*'SS*"H and DDD*MMSSssH. The formats are run in order, and the first matching format will be returned. See formatting guide on how to write user-generated formats.

Expression categories: Geospatial

Declared arguments

  • Coordinates - DMS coordinates to convert to a GeoPoint.
    Expression<String>
  • optional Formats - Formats default to DDD*°MM*'SS*"H and DDD*MMSSssH.
    List<Literal<String>>

Output type: GeoPoint

Examples

Example 1: Base case

Argument values:

  • Coordinates: coordinates
  • Formats: null
coordinatesOutput
078261594N075220923E{
latitude: 78.43776111111112,
longitude: 75.36923055555555,
}
046115095S069524119W{
latitude: -46.19748611111111,
longitude: -69.87810833333333,
}
023°45'55"N 069°52'11"W{
latitude: 23.76527777777777,
longitude: -69.86972222222222,
}
-123°55'55"N 069°53'00"W{
latitude: -123.93194444444445,
longitude: -69.88333333333334,
}
123456789N23456789E{
latitude: 123.76885833333333,
longitude: 23.768858333333334,
}

Example 2: Base case

Argument values:

  • Coordinates: coordinates
  • Formats: [H[orth][est][ast][outh] DDD* degrees, MM* minutes, and SS*.sss* seconds]
coordinatesOutput
North 75 degrees, 3 minutes, and 0.33 seconds; East 123 degrees, 22 minutes, and 17.2 seconds{
latitude: 75.05009166666666,
longitude: 123.37144444444444,
}
South 75 degrees, 3 minutes, and 0.33 seconds; West 123 degrees, 22 minutes, and 17.2 seconds{
latitude: -75.05009166666666,
longitude: -123.37144444444444,
}

Example 3: Base case

Argument values:

  • Coordinates: coordinates
  • Formats: null
coordinatesOutput
hSllo, World!null
02345N123456789Enull
023456784R123456789Enull
023456784N123456789null
023456784R123456789null
078261594N075220923E075220923Nnull
078261594Nnull
23°°45'55"N 069°52'11"Wnull
23° 45' 55"N 069° 52' 11"Wnull
23°55"N 069°52'11"Wnull
23°452233'55"N 069°52'11"Wnull

Example 4: Base case

Argument values:

  • Coordinates: coordinates
  • Formats: [DDD``minutes:``MM``seconds:``SS]
coordinatesOutput
degrees: 123 minutes: 45 seconds: 67, degrees: 087 minutes: 54 seconds: 32{
latitude: 123.76861111111111,
longitude: 87.9088888888889,
}

Example 5: Edge case

Argument values:

  • Coordinates: coordinates
  • Formats: [SSSSSSSSS*.sssssss*H]
coordinatesOutput
123452.4222N 98544.333E{
latitude: 34.2923395,
longitude: 27.373425833333332,
}

Example 6: Edge case

Argument values:

  • Coordinates: coordinates
  • Formats: [DDD*:MM*H]
coordinatesOutput
123:45:24222N 98:54:4333E{
latitude: 123.75672833333333,
longitude: 98.91203611111112,
}
078261594N075220923Enull
-123°55'55"N 069°53'00"Wnull