Crate rain_viewer[][src]

Expand description

Rust bindings to the free Rain Viewer API

Provides easy access to satellite-imagery-style precipitation radar imagery for the entire world.


async fn main() {
    //Create requester for issuing requests
    let req = rain_viewer::WeatherRequester::new();
    // Query what data is available
    let maps = req.available().await.unwrap();

    // Pick the first past entry in the past to sample
    let frame = &maps.past_radar[0];

    // Setup the arguments for the tile we want to access
    // Parameters are x, y and zoom following the satellite imagery style
    let mut args = rain_viewer::RequestArguments::new_tile(4, 7, 6).unwrap();
    // Use this pretty color scheme
    // Enable showing snow in addition to rain
    // Smooth out the tile image (looks nicer from tile to tile)

    // Make an API call to get the time image data using our parameters
    let png = req.get_tile(&maps, frame, args)

    //Check for PNG magic to make sure we got an image
    assert_eq!(&png[0..4], &[0x89, 0x50, 0x4e, 0x47]);

[available] is the entry point to obtaining radar imagery. This returns historical data and forecast data that is available.

From there, most users call [get_tile] to download a PNG of a specific satellite tile.


Contains the kinds of imagery that are available

Indicates that radar or satellite data is available for the time given at path [path]

Arguments needed to pull a rain tile from rainviewer


The kinds of colors supported by rainviewer All have different visual attributes. See for more information

The error type for this library. Wraps api errors and error types from downstream crates

Indicates that an invalid parameter was passed to a library function Each variant contains the offending value and a string error message