maps-engine-rust 0.1.0

Zero-dependency map engine core in Rust — Web Mercator projection, tiles, geofencing, clustering, navigation math.
Documentation
  • Coverage
  • 61.38%
    89 out of 145 items documented0 out of 72 items with examples
  • Size
  • Source code size: 48.2 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 971.1 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • gnoudisme

map-engine-rust 🦀🗺️

Zero-dependency map engine core in Rust — a port of the TypeScript maps-engine.

Provides the math every slippy-map needs, without any rendering or DOM:

Module What it does
projection Web Mercator lon/lat ↔ pixel math
tile XYZ tile ids, bounds, quadkeys, children/parent
geo Haversine distance, bearing, destination point
geofence Polygon & circle geofences, point-in-polygon
view Camera state: center, zoom, bearing, pitch
cluster Grid-based marker clustering
heatmap Heatmap intensity grids
draw Drawing session with undo/redo
measure Distance/area measurement + human formatting
navigation Turn-by-turn maneuver detection (VI/EN), progress tracking
geojson Minimal GeoJSON types

Usage

[dependencies]
map_engine = "0.1.0"
use map_engine::{LonLat, projection, tile, geo};

let hanoi = LonLat::new(105.85, 21.02);

// Web Mercator projection
let (px, py) = projection::to_pixels(hanoi.lon, hanoi.lat, 14);

// Tile containing the point
let t = tile::Tile::from_lon_lat(hanoi.lon, hanoi.lat, 14);
println!("tile {}/{}/{} quadkey {}", t.x, t.y, t.z, t.quadkey());

// Distance
let haiphong = LonLat::new(106.68, 20.86);
println!("{:.1} km", geo::haversine(hanoi, haiphong) / 1000.0);

Development

cargo test          # 43 unit tests
cargo clippy        # lint, must be clean
cargo fmt --check   # formatting

map-engine-rust 🦀🗺️ (Tiếng Việt)

Nhân bản đồ (map engine) thuần Rust, không phụ thuộc thư viện ngoài — port từ bản TypeScript maps-engine.

Cung cấp toàn bộ phép toán mà bản đồ trượt (slippy-map) cần, không dính dáng gì đến render hay DOM. Xem bảng module ở trên.

Dùng thử

cargo test          # 43 test
cargo clippy        # lint phải sạch
cargo fmt --check   # format

License

MIT