A blazing fast, zero-copy ISO 6709 geographic coordinate parser and writer in Rust.
Features
- Zero-copy: CRS identifiers borrow directly from the input string
no_stdcompatible: works without the standard library- All ISO 6709 notation forms: decimal degrees, degrees+minutes, DMS
- Altitude & CRS: optional altitude (meters) and coordinate reference system identifier
- Round-trip:
Displayimpls produce valid ISO 6709 output - DFA-powered lexer: logos-based tokenizer classifies components in a single pass
Installation
[]
= "0.1"
Quick Start
use parse;
// Decimal degrees (New York City)
let coord = parse.unwrap;
let : = coord.to_decimal_degrees;
assert!;
assert!;
// Degrees, minutes, seconds
let coord = parse.unwrap;
// With altitude and CRS (Mount Everest)
let coord = parse.unwrap;
assert!;
assert_eq!;
// Round-trip
let input = "+40.7128-074.0060/";
let coord = parse.unwrap;
assert_eq!;
Supported Formats
| Form | Latitude | Longitude | Example |
|---|---|---|---|
| Degrees | ±DD[.D+] |
±DDD[.D+] |
+40.7128-074.0060/ |
| Deg+Min | ±DDMM[.M+] |
±DDDMM[.M+] |
+4042.77-07400.36/ |
| DMS | ±DDMMSS[.S+] |
±DDDMMSS[.S+] |
+404243.0-0740002.0/ |
Optional trailing components: [±Altitude][CRS<id>]/
Benchmarks
Measured on Apple Silicon with cargo bench (Criterion). All times are per-operation.
Parse (single coordinate)
| Format | Time | Throughput |
|---|---|---|
Minimal (+00+000/) |
~18 ns | 424 MiB/s |
DMS integer (+404243-0740002/) |
~22 ns | 704 MiB/s |
Decimal degrees (+40.7128-074.0060/) |
~27 ns | 634 MiB/s |
Deg+Min (+4042.7700-07400.3600/) |
~30 ns | 708 MiB/s |
DMS decimal (+404243.123000-0740002.456000/) |
~34 ns | 840 MiB/s |
With altitude (+27.5916+086.5640+8848/) |
~32 ns | 680 MiB/s |
With altitude+CRS (+27.5916+086.5640+8848CRSepsg4326/) |
~37 ns | 884 MiB/s |
Round-trip (parse + Display)
| Format | Time |
|---|---|
| DMS integer | ~184 ns |
| Minimal | ~180 ns |
| DMS decimal | ~339 ns |
| Decimal degrees | ~489 ns |
| Deg+Min | ~497 ns |
| With altitude | ~556 ns |
| With altitude+CRS | ~622 ns |
Conversion
to_decimal_degrees() completes in ~1 ns regardless of input format.
Batch throughput
Parsing 1,000 mixed-format coordinates: ~48 µs (~430 MiB/s).
Run benchmarks yourself:
License
locat is under the terms of both the MIT license and the
Apache License (Version 2.0).
See LICENSE-APACHE, LICENSE-MIT for details.
Copyright (c) 2026 Al Liu.