# RasterFakeRS A Rust library and CLI tool for generating fake GeoTIFF files. Perfect for testing GIS applications, creating fixtures, and generating sample raster data. ## Features - Generate GeoTIFF files with customizable dimensions, bands, and data types - Support for COG creation - Multiple built-in data patterns (gradient, sine wave, noise) - Support for custom data generation patterns - Configurable parameters (projection, transform) - Available as both a library and CLI tool - Supports various data types (u8, u16, i16, u32, i32, f32, f64) ## Installation ### As a Library Add this to your `Cargo.toml`: ```toml [dependencies] rasterfakers = "0.2.0" ``` ### As a CLI Tool ```bash cargo install rasterfakers --force ``` Note: RasterFakers depends on the GDAL library. Please ensure GDAL is installed on your system. ## Usage ### Library Usage ```rust use rasterfakers::{FakeGeoTiffBuilder, GeoTransform, SineWavePattern}; // Create a Cloud Optimized GeoTIFF with custom settings let geotiff = FakeGeoTiffBuilder::new() .dimensions(256, 256)? .bands(3)? .projection("EPSG:4326") .geotransform(GeoTransform::default()) .output_path("output_cog.tiff") .data_generator(Box::new(SineWavePattern)) .cloud_optimized(true) .build::()?; geotiff.write()?; ``` ### CLI Usage ```bash # Generate a basic GeoTIFF rasterfakers -o output.tiff # Generate a Cloud Optimized GeoTIFF rasterfakers -o cog_output.tiff --cloud-optimized # Customize dimensions, data type, and pattern rasterfakers -o custom_cog.tiff -w 512 -e 512 -t f32 -n sine --cloud-optimized # Specify projection and resolution rasterfakers -o projected_cog.tiff -p "EPSG:4326" -r "0.1,0.1" -c "30.0,10.0" --cloud-optimized ``` ## CLI Options ```bash Options: -o, --output Output file path -w, --width Width of the GeoTIFF [default: 256] -e, --height Height of the GeoTIFF [default: 256] -b, --bands Number of bands [default: 1] -t, --data-type Data type (u8, u16, i16, u32, i32, f32, f64) [default: f64] -p, --projection Projection (e.g., EPSG:4326) [default: EPSG:4326] -r, --pixel-resolution Pixel resolution (e.g., "0.25,0.25") [default: "1.0,1.0"] -c, --upper-left-corner Upper-left corner coordinates [default: "0.0,0.0"] -n, --pattern Data pattern (gradient, sine, noise) [default: gradient] --cloud-optimized Generate a Cloud Optimized GeoTIFF -h, --help Print help -V, --version Print version ``` ## Examples Check out the [examples](examples/) directory for more detailed usage examples: - `examples/basic_usage.rs`: Simple library usage - `examples/custom_pattern.rs`: Creating custom data patterns - `examples/cli_examples.sh`: Various CLI usage examples ## Custom Data Patterns You can create custom data patterns by implementing the `DataGenerator` trait: ```rust use rasterfakers::DataGenerator; struct CustomPattern; impl DataGenerator for CustomPattern { fn generate(&self, x: usize, y: usize, band: usize) -> f64 { // Your custom pattern logic here (x * y * band) as f64 } } ``` ## Contributing Contributions are welcome! Please feel free to submit a Pull Request. ## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.