https://github.com/amandasaurus/world_image_file_rust
Read, write, and project with World Files for georeferenced images
https://github.com/amandasaurus/world_image_file_rust
esri geo georeferencing geospatial world-files
Last synced: 4 months ago
JSON representation
Read, write, and project with World Files for georeferenced images
- Host: GitHub
- URL: https://github.com/amandasaurus/world_image_file_rust
- Owner: amandasaurus
- License: agpl-3.0
- Created: 2019-07-20T07:37:58.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-07-20T09:55:26.000Z (almost 6 years ago)
- Last Synced: 2025-01-16T14:47:07.693Z (5 months ago)
- Topics: esri, geo, georeferencing, geospatial, world-files
- Language: Rust
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `world_image_file`
[](https://travis-ci.org/rory/slippy-map-tiles-rs)
[](https://crates.io/crates/slippy-map-tiles)
[](https://docs.rs/slippy-map-tiles/)Read, writes and uses [World Files](https://en.wikipedia.org/wiki/World_file) for
[georeferenced images](https://en.wikipedia.org/wiki/Georeferencing).## Example
A world file can be created from a string, or read from a file with
`WorldFile::from_path(&path)`:```rust
use world_image_file::WorldFile;
let contents = "32.0\n0.0\n0.0\n-32.0\n691200.0\n4576000.0\n";
let w = WorldFile::from_string(&contents).unwrap();
```Coordinates can be converted from image pixel to 'world' coordinates, and vice-versa.
```rust
use world_image_file::WorldFile;
let contents = "32.0\n0.0\n0.0\n-32.0\n691200.0\n4576000.0\n";
let w = WorldFile::from_string(&contents).unwrap();
assert_eq!(w.image_to_world((171., 343.)), (696672., 4565024.));
assert_eq!(w.world_to_image((696672., 4565024.)), (171., 343.));
````
Pixel coordinates can be fractional. `(10.0, 2.0)` refers to the top left of pixel (10, 2).
`(10.5, 2.5)` is in the middle of pixel (10, 2).World Files do not store any SRID/spatial reference system (SRS)/coordinate reference system
(CRS) data. World Files were originally defined by
[ESRI](https://support.esri.com/en/technical-article/000002860).Currently `Result` is returned (i.e. all errors are flatted to `()`), but this
may change to be more descriptive, and would not be seen as a breaking change.## Copyright & Licence
Copyright [GNU Affero GPL v3 (or
later)](https://www.gnu.org/licenses/agpl-3.0.en.html). See the file
[LICENCE](LICENCE)