Expand description
§parse-dms — parse coordinate strings into decimal latitude/longitude
Parse a geographic coordinate written in degrees/minutes/seconds (or decimal degrees), with optional hemisphere letters, into decimal degrees:
use parse_dms::{parse_dms, Dms};
let c = parse_dms("59°12'7.7\"N 002°15'39.6\"W").unwrap();
assert_eq!(c, Dms::Coordinates { lat: Some(59.20213888888889), lon: Some(-2.261) });
// A bare value with no hemisphere returns a single decimal number.
assert_eq!(parse_dms("-51.5").unwrap(), Dms::Decimal(-51.5));A faithful Rust port of the parse-dms npm
package. Accepts a wide range of punctuation for the degree/minute/second separators
(°º:d, '’‘′, "″''), inferring latitude/longitude from hemisphere letters or, when
there are two hemisphere-less coordinates, from their order.
Enums§
- Dms
- The result of parsing a coordinate string.
- Parse
Error - An error from
parse_dms.
Functions§
- parse_
dms - Parse a coordinate string into decimal degrees.