Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Reading GeoTIFFs in Rust, nothing else!

License

NotificationsYou must be signed in to change notification settings

georust/geotiff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

geotiff on crates.io

Important

This crate is currently undergoing a significant refactoring process to be built ontop of thetiff crate, so expect breaking changesas we work towards a v0.1.0 release sometime in 2024 (contributions are welcome!). Seethe thread at#7 for more details.

Motivation (pre-2020)

I needed this library to import elevation models for a routing library. As elevation models usually come in GeoTIFF format, but no such library was available for Rust, I created this library, taking other libraries as inspiration:

The purpose of this library is to simply read GeoTIFFs, nothing else. It should work for other TIFFs as well, I guess, but TIFFs come in many flavors, and it's not intended to cover them all.

In its current state, it works for very basic GeoTIFFs, which sufficed to extract elevation data for use in the routing library. In case you want to extend the library or have suggestions for improvement, feel free to contact me, open an issue ticket or send a pull request.

You might also consider theGDAL bindings for Rust. Depending on your usecase, it might be easier to use.

Library Usage

The library exposes aTIFF struct that can be used to open GeoTIFFs and interact with them. Its use is simple:

TIFF::open("geotiff.tif");

TIFF::open(...) returns anOption, depending if the open operation was successful or not. Individual values can then be read (for the moment, only at pixels) using:

x.get_value_at(longitude, latitude);

Wherelongitude corresponds to theimage_length andlatitude to theimage_width. This might be a bit counter intuitive, but seems consistent with GDAL (have to look into this).

Caution: thelongitude andlatitude are only in pixels, no coordinate transformations are applied!

Development and Testing

Simply run the tests using:

cargo test

TIFF Basics

Several documents describe the structure of a (Geo)TIFF:

About

Reading GeoTIFFs in Rust, nothing else!

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp