Crates.io | latlon |
lib.rs | latlon |
version | 0.1.3 |
source | src |
created_at | 2020-04-23 22:13:48.445575 |
updated_at | 2021-01-24 09:59:30.381485 |
description | Parse latitude/longitude from many common formats |
homepage | |
repository | https://git.ondrovo.com/packages/latlon |
max_upload_size | |
id | 233424 |
size | 52,485 |
Parse geographic coordinates from string.
A wide range of commonly used formats is supported. See the unit tests for a complete reference.
If a format you need is missing, please submit a merge request (including unit tests).
// parse a coord
let coord : geo::Point = latlon::parse("N 50°5.30385', E 14°26.94732'").unwrap();
// individual lat/lng parsing
let lat : f64 = latlon::parse_lat("N 50°5.30385'").unwrap();
let lng : f64 = latlon::parse_lng("E 14°26.94732'").unwrap();
Example of supported formats:
40° 26' 46" N 79° 58' 56" W
N 40° 26' 46" W 79° 58' 56"
40° 26.767' N 79° 58.933' W
40° 26' 46" 79° 58' 56"
, 40° 26' 46", 79° 58' 56"
, ...N 40° 26.767' W 79° 58.933'
40° 26.767' 79° 58.933'
, 40° 26.767', 79° 58.933'
, ...N 40.446° W 79.982°
40.446° N 79.982° W
40.446° 79.982°
, 40.446,79.982
, etc.,
) may be used as an alternate decimal separator.’
, ”
) are supported
for minutes and seconds.,
), semicolon (;
), whitespace, or nothing
at all, if not ambiguous.