tile_grid/
lib.rs

1//! A library for using OGC TileMatrixSets (TMS).
2
3//! ## Load tile set matrix and get bounds of a tile
4//!
5//! ```rust
6//! use tile_grid::{tms, BoundingBox, Xyz};
7//!
8//! let tms = tms().lookup("WebMercatorQuad").unwrap();
9//!
10//! // Get the bounds for tile Z=4, X=10, Y=10 in the input projection
11//! let bounds = tms.xy_bounds(&Xyz::new(10, 10, 4));
12//! assert_eq!(
13//!     bounds,
14//!     BoundingBox::new(
15//!         5009377.085697308,
16//!         -7514065.628545959,
17//!         7514065.628545959,
18//!         -5009377.085697308
19//!     )
20//! );
21//!
22//! // Get the bounds for tile Z=4, X=10, Y=10 in LatLon (WGS84)
23//! let bounds = tms.bounds(&Xyz::new(10, 10, 4)).unwrap();
24//! assert_eq!(
25//!     bounds,
26//!     BoundingBox::new(45.0, -55.77657301866769, 67.5, -40.97989806962013)
27//! );
28//! ```
29//!
30//! ## Find tile for lat/lon
31//!
32//! ```rust
33//! # use tile_grid::{tms, Xyz};
34//! # let tms = tms().lookup("WebMercatorQuad").unwrap();
35//! let tile = tms.tile(159.31, -42.0, 4).unwrap();
36//! assert_eq!(tile, Xyz::new(15, 10, 4));
37//!
38//! // Or using coordinates in input CRS
39//! let tile = tms.xy_tile(17734308.1, -5160979.4, 4);
40//! assert_eq!(tile, Xyz::new(15, 10, 4));
41//! ```
42
43mod hilbert;
44mod quadkey;
45mod registry;
46mod tile;
47mod tile_matrix_set;
48mod tms;
49mod tms_iterator;
50mod transform;
51mod wmts;
52
53pub use registry::{RegistryError as Error, *};
54pub use tile::*;
55pub use tile_matrix_set::*;
56pub use tms::*;
57pub use tms_iterator::*;
58pub use wmts::*;