rstiff 0.2.0

A Rust library for high-precision, type-preserving GeoTiff I/O powered by GDAL.
use rstiff::GeoTiff;
use std::error::Error;
use std::path::Path;

fn main() -> Result<(), Box<dyn Error>> {
    let p = Path::new("./data/Hawaiin_part.tif");
    if !p.exists() {
        println!("Please provide ./data/Hawaiin_part.tif to run this example.");
        return Ok(());
    }

    // 1. Read
    let tif = GeoTiff::read(p)?;
    println!(
        "Read GeoTiff: {:?}, Size: {:?}, Type: {:?}",
        p,
        tif.data.dim(),
        tif.original_type
    );

    // 2. Reproject (WGS84 -> UTM 4N)
    let target_epsg = 32604;
    println!("Reprojecting to EPSG:{}...", target_epsg);
    let tif_projected = tif.reproject(target_epsg)?;

    // 3. Write
    let output_path = Path::new("./data/reproject_example.tif");
    tif_projected.write(output_path)?;
    println!("Saved reprojected file to: {:?}", output_path);

    Ok(())
}