Crate tile_grid

source ·
Expand description

A library for using OGC TileMatrixSets (TMS).

Load tile set matrix and get bounds of a tile

use tile_grid::{tms, BoundingBox, Xyz};

let tms = tms().lookup("WebMercatorQuad").unwrap();

// Get the bounds for tile Z=4, X=10, Y=10 in the input projection
let bounds = tms.xy_bounds(&Xyz::new(10, 10, 4));
assert_eq!(
    bounds,
    BoundingBox::new(
        5009377.085697308,
        -7514065.628545959,
        7514065.628545959,
        -5009377.085697308
    )
);

// Get the bounds for tile Z=4, X=10, Y=10 in LatLon (WGS84)
let bounds = tms.bounds(&Xyz::new(10, 10, 4)).unwrap();
assert_eq!(
    bounds,
    BoundingBox::new(45.0, -55.77657301866769, 67.5, -40.97989806962013)
);

Find tile for lat/lon

let tile = tms.tile(159.31, -42.0, 4).unwrap();
assert_eq!(tile, Xyz::new(15, 10, 4));

// Or using coordinates in input CRS
let tile = tms.xy_tile(17734308.1, -5160979.4, 4);
assert_eq!(tile, Xyz::new(15, 10, 4));

Re-exports

Modules

Structs

  • A xmin,ymin,xmax,ymax coordinates tuple.
  • Minimum bounding rectangle surrounding a 2D resource in the CRS indicated elsewere
  • A x,y Coordinates pair.
  • Default CRS for coordinates with height Coordinate Reference System (CRS)
  • Geographic extent
  • Min and max grid cell numbers
  • Tile grid
  • Level-by-level iterator
  • Hyperlink to enable Hypermedia Access
  • A resource describing useful to create an array that describes the limits for a tile set [TileMatrixSet] based on the OGC TileSet Metadata Standard
  • A definition of a tile matrix set following the Tile Matrix Set standard. For tileset metadata, such a description (in tileMatrixSet property) is only required for offline use, as an alternative to a link with a http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme relation type.
  • A minimal tile matrix set element for use within a list of tile matrix sets linking to a full definition.
  • Registry of tile matrix sets
  • A resource describing a tileset based on the OGC TileSet Metadata Standard. At least one of the ‘TileMatrixSet’, or a link with ‘rel’ tiling-scheme“
  • A minimal tileset element for use within a list of tilesets linking to full description of those tilesets.
  • Tile Matrix Set API.
  • Variable Matrix Width data structure
  • TileMatrixSet X,Y,Z tile indices.
  • Level-by-level iterator

Enums

Constants

Functions

Type Definitions