Skip to content

A thin rust wrapper to download data from naturaearthdata

Notifications You must be signed in to change notification settings

PMassicotte/naturalearthdata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

naturalearthdata

A thin wrapper to download the data from Natural Earth Data.

At present, the crate offers basic functionality, mainly focusing on downloading data from the Natural Earth website.

Data that can be downloaded

Cultural Vectors and Physical Vectors are available for download at three scales:

  • Large (1:10m)
  • Medium (1:50m)
  • Small (1:110m)

Usage

use naturalearthdata::Scale;
use naturalearthdata::{download::ne_download, CulturalType};

fn main() {
    // Download the Admin 0 Countries at large scale (1:10m)
    // https://www.naturalearthdata.com/downloads/10m-cultural-vectors/
    let mut reader = ne_download(CulturalType::Admin0Countries, Scale::Large).unwrap();

    // Read the schema
    let schema = reader.schema().unwrap();
    println!("{:?}", schema);

    // Read the forth column of the table
    for batch_result in reader.take().unwrap() {
        match batch_result {
            Ok(batch) => {
                let value = batch.column(4);
                println!("{:?}", value);
            }
            Err(e) => eprintln!("Error reading batch: {:?}", e),
        }
    }
}

To run the example in the examples directory, use the following command:

cargo run --example=main

About

A thin rust wrapper to download data from naturaearthdata

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published