Skip to main content

Crate use_map_scale

Crate use_map_scale 

Source
Expand description

§use-map-scale

Primitive map scale vocabulary for RustUse.

use-map-scale provides small descriptive types for scale ratios, map scale, map resolution, and zoom levels without implementing map tile behavior.

§Non-goals

  • tile math
  • slippy-map logic
  • map rendering
  • map-tile fetching

§Example

use use_map_scale::{MapResolution, MapScale, ScaleRatio, ZoomLevel};

let ratio = ScaleRatio::new(25_000)?;
let scale = MapScale::new(ratio);
let resolution = MapResolution::new(2.5)?;
let zoom = ZoomLevel::new(10);

assert_eq!(scale.to_string(), "1:25000");
assert_eq!(resolution.units_per_pixel(), 2.5);
assert_eq!(zoom.level(), 10);

Structs§

MapResolution
MapScale
ScaleRatio
ZoomLevel

Enums§

MapScaleError