#openstreetmap #geography #osm #google-maps

slippy_map_tilenames

Converts lon/lat coordinates to slippy map tile format (OpenStreetMap/Google Map format)

2 unstable releases

Uses old Rust 2015

0.2.0 Jan 29, 2018
0.1.0 Jan 4, 2018

#11 in #google-maps

42 downloads per month

MIT/Apache

13KB
80 lines

slippy_map_tilenames

A Rust crates that converts lon/lat coordinates to slippy map tile format. See this article by wiki.openstreetmap.org

Example

extern crate slippy_map_tilenames as smt;

fn main() {
    let t2l = smt::tile2lonlat(4376, 2932, 13); // (12.3046875, 45.460130637921)
    let l2t = smt::lonlat2tile(14.016667, 42.683333, 13); // (4414, 3019)    
    println!("Tile (4376, 2932) at zoom 13: {:?}", t2l);
    println!("lon 14.016667 E, lat 42.683333 N, at zoom 13: {:?}", l2t);
}

lib.rs:

Slippy Map Tilenames

The slippy_map_tilenames crate provides functions to convert lon/lat coordinates to slippy map tile format. See this article by wiki.openstreetmap.org

Some other functions to help in dealing with the slippy map format are provided as well.

Breaking Changes

This crate is designed for retrocompatibility; i.e., to provide functions that consistently have the same signature, no matter which version of the crate you will use.

Warning

All the functions provided by this crate do not check the validity of the data in input. However, since they are based on equations, some of them still give in output a result in presence of invalid input; this result is indeed meaningles.

The care of checking on the validity of the data in input is left to the user of this crate.

For further reference, see the sections Unexpected Behavior related to each function.

No runtime deps