https://github.com/georust/tilejson
Library for serializing the TileJSON file format
https://github.com/georust/tilejson
mapbox rust serialization tilejson
Last synced: 5 months ago
JSON representation
Library for serializing the TileJSON file format
- Host: GitHub
- URL: https://github.com/georust/tilejson
- Owner: georust
- License: apache-2.0
- Created: 2017-11-27T16:08:26.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2023-12-09T14:33:39.000Z (almost 2 years ago)
- Last Synced: 2024-10-29T18:54:05.801Z (about 1 year ago)
- Topics: mapbox, rust, serialization, tilejson
- Language: Rust
- Size: 794 KB
- Stars: 9
- Watchers: 19
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
- Awesome-Geospatial - tilejson - tilejson is a crate for serializing/deserializing the TileJSON format. (Rust)
README
# tilejson
[](https://github.com/georust/tilejson)
[](https://crates.io/crates/tilejson)
[](https://docs.rs/tilejson)
[](https://github.com/georust/tilejson/blob/main/LICENSE-APACHE)
[](https://github.com/georust/tilejson/actions)
[](https://app.codecov.io/gh/georust/tilejson)
`tilejson` is a crate for serializing/deserializing the [TileJSON](https://github.com/mapbox/tilejson-spec) format — an open standard for representing map metadata.
## Examples
### Reading
```rust
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:?}");
}
```
### Writing
```rust
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}");
}
```
## Contributing
Contributions are welcome! Have a look at the [issues](https://github.com/georust/tilejson/issues), and open a pull request if you'd like to add an algorithm or some functionality.
## Development
* This project is easier to develop with [just](https://github.com/casey/just#readme), a modern alternative to `make`.
Install it with `cargo install just`.
* To get a list of available commands, run `just`.
* To run tests, use `just test`.
## License
Licensed under either of
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or )
* MIT license ([LICENSE-MIT](LICENSE-MIT) or )
at your option.
### Contribution
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.