Knowasiak
Mapr: Native cross platform maps in Rust using WebGPU

Mapr: Native cross platform maps in Rust using WebGPU

Hello reader! Welcome, let's start-

I love modules, because they are adorable!!

Native Maps for Web, Mobile and Linux

A map rendering library written in Rust.

Project State
This project is in a proof-of-concept state. The proof of concept is done except for text rendering.
The Rust ecosystem is suited very well for this project.

In the future this project could be adopted and supported by Maplibre to implement a
next-gen mapping solution.

Description
mapr is a portable and performant vector maps renderer. We aim to support the web, mobile and desktop applications. This
is achieved by the novel WebGPU specification. Plenty of native implementations are
already implementing this specification. On the web it is implemented by Firefox, Chrome and Safari. There are also
standalone implementations which directly use Vulkan, OpenGL or Metal as a backend. Those backends allow mapr to run on
mobile and desktop applications.

Rust is used as a Lingua-franka on all platforms. This is made possible by WebAssembly which allows us to use Rust for
web development.

The goal of mapr is to render maps in order to visualize data. Right now the goal of mapr is not to replace existing
vector map renderers like Google Maps, Apple Maps or MapLibre. The current implementation serves as a proof-of-concept
of the used technology stack. It is unclear whether the high-performance requirements of rendering maps using vector
graphics are achievable using the current stack.

Talk: World in Vectors

World.in.Vectors.mp4

(YouTube)

Current Features

Runs on Linux, Android, iOS, MacOS, Firefox and Chrome
Render a vector tile dataset
Simple navigation powered by winit
Multithreaded on all platforms
Querying feature data

Missing Features

Rendering Text
Per-Feature Rendering
Rendering:

Raster data
3D terrain
Hill-shade (DEM)

Support for:

GeoJSON

API for:

TypeScript
Swift
Java/Kotlin

Repository Layout
(Note: to be changed)

.
├── docs # Documentation for mapr
├── src # The source code of the mapr library
├── libs # Libraries which will eventually be published as separate crates
│ ├── mbtiles # Library for extracting .mbtiles files
│ ├── style_spec # Library for interpreting MapLibre style specifications
│ └── wgsl_validate # Library for validating WGSL shaders
├── apple # Platform specific files for Apple (iOS and MacOS)
├── web # Platform specific files for Web (WebGL and WebGPU)
├── benches # Benchmarks for specific parts of the library
├── examples # Examples which can be run
└── test-data # Geo data which can be used for tests (Usually as .mbtiles)
Building & Running
Now, to clone the project:

git clone –recursive git@github.com/maxammann/mapr
and then build it for running on a desktop:

After that you can run it on your desktop:

cargo run –example desktop —
More information about building for different platforms can be
found here.

Note for Mac: Before opening the XCode project, you need to build manually using the following command:
cargo build –target aarch64-apple-darwin –lib

After that, open the XCode project and run it.
(XCode seems to set some environment variables which cause problems with the build directly within XCode)

Rust Setup
Install rustup because this is the recommended way of setting Up Rust toolchains.

The toolchain will be automatically downloaded when building this project.
See ./rust-toolchain.toml for more details about the toolchain.

Documentation
This generates the documentation for this crate and opens the browser. This also includes the documentation of every
dependency.

You can also view the Up-to-date documentation here.

Read More
Share this on knowasiak.com to discuss with people on this topicSign Up on Knowasiak.com now if you’re not registered yet.

About the author: Charlie
Fill your life with experiences so you always have a great story to tell
Advertisements

Get involved!

Get Connected!
One of the Biggest Social Platform for Entrepreneurs, College Students and all. Come and join our community. Expand your network and get to know new people!

Discussion(s)

No comments yet
Knowasiak We would like to show you notifications so you don't miss chats & status updates.
Dismiss
Allow Notifications