Crates.io | tilejson |
lib.rs | tilejson |
version | 0.4.1 |
source | src |
created_at | 2017-11-27 16:40:47.085558 |
updated_at | 2023-12-09 14:34:03.434675 |
description | Library for serializing the TileJSON file format |
homepage | https://github.com/georust/tilejson |
repository | https://github.com/georust/tilejson |
max_upload_size | |
id | 40746 |
size | 61,226 |
tilejson
is a crate for serializing/deserializing the TileJSON format — an open standard for representing map metadata.
use tilejson::TileJSON;
fn main() {
let tilejson_str = r#"{
"tilejson": "3.0.0",
"name": "compositing",
"scheme": "tms",
"tiles": [
"http://localhost:8888/admin/1.0.0/world-light,broadband/{z}/{x}/{y}.png"
]
}"#;
// Parse JSON
let mut tilejson: TileJSON = serde_json::from_str(&tilejson_str).unwrap();
println!("{tilejson:?}");
// Add missing default values per TileJSON specification
tilejson.set_missing_defaults();
println!("{tilejson:?}");
}
use tilejson::tilejson;
fn main() {
let tilejson = tilejson! {
"http://localhost:8888/admin/1.0.0/world-light,broadband/{z}/{x}/{y}.png".to_string(),
name: "tileset name".to_string(),
description: "some description".to_string(),
};
let serialized_tilejson = serde_json::to_string(&tilejson).unwrap();
println!("{serialized_tilejson}");
}
Contributions are welcome! Have a look at the issues, and open a pull request if you'd like to add an algorithm or some functionality.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.