Skip to content

necessary-nu/nominatim-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nominatim-rs

Nominatim-rs is a rust binding for the Nominatim api. It does reverse geolocation (finding a place from coordinates), lookup and search.

Please conform to the Nominatim ToS

Example

This example searches for a location and prints out the JSON

#[tokio::main]
async fn main() {
    let client = nominatim_rs::Client::new(
        reqwest::Url::parse("https://nominatim.openstreetmap.org/").unwrap(),
        "nominatim-rust/0.1.0 test-suite".to_string(),
        Some("[email protected]".to_string()),
    )
    .unwrap();

    let search = client
        .search(
            nominatim_rs::SearchQueryBuilder::default()
                .address_details(true)
                .location_query(nominatim_rs::LocationQuery::Generalised {
                    q: "bakery in berlin wedding".to_string(),
                })
                .limit(Some(1))
                .build()
                .unwrap(),
        )
        .await
        .unwrap();

    println!("{}", serde_json::to_string_pretty(&search).unwrap());
}

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages