#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

#1501 in Algorithms

Download history 4/week @ 2024-01-15 26/week @ 2024-02-12 15/week @ 2024-02-19 17/week @ 2024-02-26 8/week @ 2024-03-04 7/week @ 2024-03-11 2/week @ 2024-03-18 46/week @ 2024-04-01 10/week @ 2024-04-08 6/week @ 2024-04-22

62 downloads per month
Used in tile_sorcerer

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