AI Features

Maps

Learn how to create beautiful maps with Rust.

Mapping in Rust

Sadly, there are no tools in pure Rust to create maps. There are tools to handle GIS and geography, but nothing is completely devoted to map creation.

Therefore, we only have a few options to choose from, which might be appreciated by those who need to handle geographic data in Rust.

Currently, we have two main options:

  • Use what the ecosystem provides, even if it is incomplete and labor intensive.
  • Integrate the Rust ecosystem with other tools, such as creating interactive maps with JavaScript to show in a browser.

We’ll show an example of both methods.

Vega_lite_3

The crate vega_lite_3 is devoted to charting data. It is a little bit more complicated than poloto, but it is much more powerful.

The vega_lite_3 crate employs the builder pattern. We can create the default builder with VegaliteBuilder::default() and then add all the information and data to our charts with a method applied to the builder.

We use build()? to get the graph built and ready to display. At the end, with ...