Learn R Programming

geographiclib (version 0.4.1)

geocoords_parse: Parse Geographic Coordinate Strings

Description

Parse coordinate strings in various formats (MGRS, UTM/UPS, DMS, decimal) and return latitude/longitude.

Usage

geocoords_parse(x)

Value

Data frame with columns:

  • lat - Latitude in degrees

  • lon - Longitude in degrees

  • zone - UTM/UPS zone number

  • northp - Logical, TRUE if in northern hemisphere

  • easting - UTM/UPS easting in meters

  • northing - UTM/UPS northing in meters

Arguments

x

Character vector of coordinate strings to parse

Details

Accepts coordinates in multiple formats:

  • MGRS: "33TWN0500049000"

  • UTM/UPS: "33N 505000 4900000"

  • DMS: "40d26'47\"N 74d0'21\"W"

  • Decimal: "40.446 -74.006"

See Also

mgrs_fwd(), mgrs_rev(), utmups_fwd(), utmups_rev(), dms_decode()

Examples

Run this code
# Parse MGRS
geocoords_parse("33TWN0500049000")

# Parse UTM
geocoords_parse("33N 505000 4900000")

# Parse DMS
geocoords_parse("40d26'47\"N 74d0'21\"W")

# Parse decimal
geocoords_parse("40.446 -74.006")

# Vectorized
geocoords_parse(c("33TWN0500049000", "40.446 -74.006"))

Run the code above in your browser using DataLab