Native Maps for Web, Mobile and Desktop

Related tags

GUI maplibre-rs
Overview

mapr

Logo

preview
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 [email protected]/maxammann/mapr

and then build it for running on a desktop:

cargo build

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.

cargo doc --open

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

Comments
  • Render directly to lower-level graphics surface

    Render directly to lower-level graphics surface

    Like maplibre-gl-native, this library could support rendering to lower-level graphics surfaces, ideally

    • OpenGL framebuffer
    • Metal surface
    • DirectX surface

    This would allow easier integration to custom apps or other libraries like Qt.

    feature-request 
    opened by ntadej 12
  • Refactor crate structure

    Refactor crate structure

    .
    ├── .cargo
    ├── .github
    ├── docs
    ├── maplibre
    ├── maplibre-android
    ├── maplibre-apple
    ├── maplibre-benches
    ├── maplibre-renderer
    ├── maplibre-example
    ├── maplibre-web
    ├── maplibre-style-spec
    ├── maplibre-tilejson-spec
    ├── maplibre-wgsl-validate
    ├── justfile
    ├── Cargo.toml
    ├── LICENSE
    ├── README.md
    ├── rust-toolchain.toml
    ├── .gitignore
    
    opened by maxammann 8
  • Create a struct for `ZoomLevel`

    Create a struct for `ZoomLevel`

    We probably should add a struct for ZoomLevel.

    Originally posted by @maxammann in https://github.com/maplibre/maplibre-rs/pull/87#discussion_r867936765

    🤔 Expected Behavior

    Zoom is a f64 which represents the current zoom on the map. It needs to be a floating number because we want to be able to zoom smoothly on the map.

    ZoomLevel is a u8 which represents the level of a tile within the map's quad tree. ZoomLevel 0 would be one tile that contains the entire map, ZoomLevel 1 would be a part of the map if it was split in 4, etc.

    We can derive the current ZoomLevel from the Zoom using the constant ZOOM_BOUNDS defined in the coords.rs file.

    😯 Current Behavior

    Currently ZoomLevel is always stored as a u8 directly.

    💁 Possible Solution

    We should create a custom type or a struct to store the zoom level.

    🔦 Context

    It would make the code easier to read.

    💻 Examples

    The function below could be changed from:

    pub fn scale_to_zoom_level(&self, z: u8) -> f64
    

    to:

    pub fn scale_to_zoom_level(&self, z: ZoomLevel) -> f64
    
    good first issue feature-request 
    opened by Drabble 6
  • Reduce znear so the map is not cut when we tilt the camera

    Reduce znear so the map is not cut when we tilt the camera

    When we tilt the camera using the R and F keys, the map clips. If we decrease the near clip plane to 1 it no longer does that.

    Fixing this highlights another problem which should be resolved separately in another pr/issue. When tilting the screen we get thread 'main' panicked at 'Error in Queue::write_buffer: copy of 0..4216 would end up overrunning the bounds of the Destination buffer of size 2176'. We should: limit the data we write to the buffer; display a lower zoom level for far away tiles when we tilt the screen.

    💻 Examples

    Here is a screen shot with the map clipping due to a big znear value.

    Screenshot 2022-06-15 at 12 53 45

    🚨 Test instructions

    Run the maplibre demo and press R or F.

    ✔️ PR Todo

    -

    opened by Drabble 5
  • "cargo test" fails with "android-ndk-sys only supports compiling for Android"

    I'm trying to work on one of the issues labelled with good first issue and to ensure that my changes aren't breaking anything, I would like to run the tests, but it's failing.

    🤔 Expected Behavior

    I expect the tests to be executed when I run cargo test.

    😯 Current Behavior

    I forked the repository and installed the toolchain with cargo --version > /dev/null as seen in the justfile. I then executed cargo test and it failed with the error:

    error: android-ndk-sys only supports compiling for Android
      --> /home/johndoe/.cargo/registry/src/github.com-1ecc6299db9ec823/ndk-sys-0.2.2/src/lib.rs:22:1
       |
    22 | compile_error!("android-ndk-sys only supports compiling for Android");
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    error: could not compile `ndk-sys` due to previous error
    warning: build failed, waiting for other jobs to finish...
    error: build failed
    

    🌍 Your Environment

    • Desktop
      • Operating System: Linux (NixOS)
      • Display Server: Xorg
    bug 
    opened by dmarcoux 5
  • Android improvements

    Android improvements

    This PR includes multiples improvements for Android:

    1. Add x86 as a target in addition to x86_64 and arm64.
    2. Unify minSDK to 21 which is the lowest version that support OpenGL ES 3.1 on Android.
    3. Unify targetSDK to 31.
    4. Update https://github.com/mozilla/rust-android-gradle to version 0.9.3 and remove the custom config related to this issue since it has been fixed in the new version. This custom configuration didn't work on non-linux operating systems.
    5. Remove limits and leave only downlevel_defaults for Android because downlevel_defaults has the defaults for OpenGL ES 3.1.

    💻 Examples

    -

    🚨 Test instructions

    Run the Android demo project with Android Studio. The documentation has been improved in #102.

    ✔️ PR Todo

    • [x] Make all the improvements in the list above.
    android 
    opened by Drabble 5
  • Maplibre rs logo

    Maplibre rs logo

    Gear + MapLibre pushpin combined to form maplibre-rs logo.

    Basic readme added to comply with rust logo license terms. Feel free to expand/replace as needed.

    opened by drwestco 5
  • docs: update README.md

    docs: update README.md

    • correct article agreement
    • fix broken rendering of logo HTML
    • correct spelling of macOS
    • fix the broken link to documentation
    • add punctuation to increase readability
    opened by vladdoster 5
  • Clippy fixes

    Clippy fixes

    Fixes a number of clippy issues:

    • Implement Default for various types
    • Remove some useless format/mut
    • Simplify some if let match
    • Fix some cases where variables are never read because they are immediatly overwritten
    opened by julienr 4
  • Limit the tiles in view

    Limit the tiles in view

    Previously we allowed infinitely many tiles in view. This caused buffer overflows.

    This works around this issue:

    thread 'main' panicked at 'Error in Queue::write_buffer: copy of 0..4216 would end up overrunning the bounds of the Destination buffer of size 2176'
    
    opened by maxammann 4
  • Problem in running

    Problem in running "Maplibre-demo" in windows 10

    C:\Users\Aa\Desktop\map\maplibre-rs> cargo run -p maplibre-demo
       Compiling prost-build v0.10.4
    warning: constant is never used: `MUNICH_X` 
     --> maplibre\build.rs:8:1
      |
    8 | const MUNICH_X: u32 = 17425;
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: `#[warn(dead_code)]` on by default
    
    warning: constant is never used: `MUNICH_Y`
     --> maplibre\build.rs:9:1
      |
    9 | const MUNICH_Y: u32 = 11365;
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    warning: constant is never used: `MUNICH_Z`
      --> maplibre\build.rs:10:1
       |
    10 | const MUNICH_Z: u8 = 15;
       | ^^^^^^^^^^^^^^^^^^^^^^^^
    
    warning: function is never used: `generate_type_def`
      --> maplibre\build.rs:16:4
       |
    16 | fn generate_type_def() -> Option<u32> {
       |    ^^^^^^^^^^^^^^^^^
    
    warning: `maplibre` (build script) generated 4 warnings
    error: failed to run custom build command for `prost-build v0.10.4`
    
    Caused by:
      process didn't exit successfully: `C:\Users\Aa\Desktop\map\maplibre-rs\target\debug\build\prost-build-1754dd19457489c8\build-script-build` (exit code: 101)       
      --- stdout
      cargo:rerun-if-changed=C:\Users\Aa\.cargo\registry\src\github.com-1ecc6299db9ec823\prost-build-0.10.4\third-party\protobuf\cmake
      CMAKE_TOOLCHAIN_FILE_x86_64-pc-windows-msvc = None
      CMAKE_TOOLCHAIN_FILE_x86_64_pc_windows_msvc = None
      HOST_CMAKE_TOOLCHAIN_FILE = None
      CMAKE_TOOLCHAIN_FILE = None
      CMAKE_GENERATOR_x86_64-pc-windows-msvc = None
      CMAKE_GENERATOR_x86_64_pc_windows_msvc = None
      HOST_CMAKE_GENERATOR = None
      CMAKE_GENERATOR = None
      CMAKE_PREFIX_PATH_x86_64-pc-windows-msvc = None
      CMAKE_PREFIX_PATH_x86_64_pc_windows_msvc = None
      HOST_CMAKE_PREFIX_PATH = None
      CMAKE_PREFIX_PATH = None
      CMAKE_x86_64-pc-windows-msvc = None
      CMAKE_x86_64_pc_windows_msvc = None
      HOST_CMAKE = None
      CMAKE = None
      running: "cmake" "C:\\Users\\Aa\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\prost-build-0.10.4\\third-party\\protobuf\\cmake" "-G" "Visual Studio 17 2022" "-Thost=x64" "-Ax64" "-Dprotobuf_BUILD_TESTS=OFF" "-DCMAKE_INSTALL_PREFIX=C:\\Users\\Aa\\Desktop\\map\\maplibre-rs\\target\\debug\\build\\prost-build-3f1fccf677fd4ea0\\out" "-DCMAKE_C_FLAGS= -nologo -MD -Brepro" "-DCMAKE_C_FLAGS_DEBUG= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS_DEBUG= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS_DEBUG= -nologo -MD -Brepro" "-DCMAKE_BUILD_TYPE=Debug"
      -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
      --
      -- 3.19.4.0
      -- Configuring done
      -- Generating done
      -- Build files have been written to: C:/Users/Aa/Desktop/map/maplibre-rs/target/debug/build/prost-build-3f1fccf677fd4ea0/out/build
      running: "cmake" "--build" "." "--target" "install" "--config" "Debug" "--parallel" "4"
      Microsoft (R) Build Engine version 17.2.1+52cd2da31 for .NET Framework
      Copyright (C) Microsoft Corporation. All rights reserved.
    
        libprotobuf-lite.vcxproj -> C:\Users\Aa\Desktop\map\maplibre-rs\target\debug\build\prost-build-3f1fccf677fd4ea0\out\build\Debug\libprotobuf-lited.lib
        gzip_stream.cc
      C:\msys64\mingw64\include\zconf.h(475,14): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory [C:\Users\Acer\Desktop\map\maplibre-rs\target\debug\build\prost-build-3f1fccf677fd4ea0\out\build\libprotobuf.vcxproj]
    
      --- stderr
      thread 'main' panicked at '
      command did not execute successfully, got: exit code: 1
    
      build script failed, must exit now', C:\Users\Aa\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.48\src\lib.rs:975:5
      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
    

    🤔 Expected Behavior

    😯 Current Behavior

    💁 Possible Solution

    🔦 Context

    💻 Code Sample

    🌍 Your Environment

    • Desktop
      • Operating System: Windows
    bug 
    opened by Shawn-Fan 4
  • Debug line width depends on zoom

    Debug line width depends on zoom

    Currently the width of the debug lines depends on the zoom.

    🤔 Expected Behavior

    Lines should always have the same pixel-width on the screen.

    😯 Current Behavior

    The width changes.

    💁 Possible Solution

    Multiply the line width in the debug shader with a scaling factor: https://github.com/maxammann/maplibre-rs/blob/07bddd2a8c42f0cb906586f01eaaefb94dc34f7a/maplibre/src/render/shaders/tile.vertex.wgsl#L31

    good first issue feature-request 
    opened by maxammann 0
  • Limit work done per frame

    Limit work done per frame

    Even thought his can be done by newcomers, this issue is HARD

    We need to do some work on the main thread:

    • Receive data from threads or WebWorkers
    • upload data to GPU

    Here for example we process all the data we receive in the event loop:

    https://github.com/maxammann/maplibre-rs/blob/2b917e9e0850d95c876bfcf0f0f3c777f56b842d/maplibre/src/stages/populate_tile_store_stage.rs#L41-L43

    We could limit this to a certain amount of messages or the message sizes.

    🤔 Expected Behavior

    No frames should be dropped.

    😯 Current Behavior

    Sometimes frames are dropped because of uploads.

    💁 Possible Solution

    Limit the time spend on uploading or other work. This can either be done by measuring time (low level), or by restricting it on a higher level, e.g. the amount of work items.

    Steps for this issue:

    1. Check where the most time is spent during the render loop using the Tracy profiler
    2. Reduce it by doing less work per frame.
    good first issue feature-request 
    opened by maxammann 0
  • Use Spiral iterator for ViewRegion

    Use Spiral iterator for ViewRegion

    The idea of this PR is to iterate in a spiral over the 2D view region instead of left-right -> top-bottom.

    Implementation taken from here: https://stackoverflow.com/questions/398299/looping-in-a-spiral

    opened by maxammann 0
Owner
MapLibre
MapLibre
Build beautiful desktop apps with flutter and rust. 🌠 (wip)

flutter-rs Build flutter desktop app in dart & rust. Get Started Install requirements Rust flutter sdk Develop install the cargo flutter command cargo

null 2k Dec 26, 2022
SixtyFPS is a toolkit to efficiently develop fluid graphical user interfaces for any display: embedded devices and desktop applications. We support multiple programming languages, such as Rust, C++ or JavaScript.

SixtyFPS is a toolkit to efficiently develop fluid graphical user interfaces for any display: embedded devices and desktop applications. We support multiple programming languages, such as Rust, C++ or JavaScript.

SixtyFPS 5.5k Jan 1, 2023
ZeroTier Desktop Tray Application and UI

ZeroTier Desktop Tray Application and User Interface This is (as of ZeroTier 1.8) the system tray application and user interface for controlling a loc

ZeroTier, Inc. 102 Dec 20, 2022
A react-inspired UI library for building multimedia desktop apps with rust and vulkan.

narui A react-inspired UI library for building multimedia desktop apps with rust and vulkan. declarative UI with Ergonomics similar to React with hook

apertus° - open source cinema 42 Jan 1, 2023
A powerful desktop widget app for windows, built with Vue and Tauri.

DashboardX Widgets A powerful desktop widget app for windows, built with Vue and Tauri. Still in development Currently only runs on windows (uses nati

DashboardX Widgets 3 Oct 25, 2023
Access German-language public broadcasting live streams and archives on the Linux Desktop

Deutsche Version Televido Televido (“Television” in Esperanto) lets you livestream, search, play and download media from German-language public televi

David C. 10 Nov 4, 2023
Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.

libui: a portable GUI library for C This README is being written. Status It has come to my attention that I have not been particularly clear about how

Pietro Gagliardi 10.4k Dec 31, 2022
OS-native file dialogs on Linux, OS X and Windows

nfd-rs nfd-rs is a Rust binding to the library nativefiledialog, that provides a convenient cross-platform interface to opening file dialogs on Linux,

Saurav Sachidanand 152 Nov 9, 2022
A tiny, neat C library that portably invokes native file open and save dialogs.

Native File Dialog A tiny, neat C library that portably invokes native file open, folder select and save dialogs. Write dialog code once and have it p

Michael Labbe 1.5k Dec 28, 2022
OS native dialogs for Windows, MacOS, and Linux

?? nfd2 nfd2 is a Rust binding to the nativefiledialog library, that provides a convenient cross-platform interface to opening file dialogs on Windows

Embark 33 May 15, 2022
Desktop GUI Framework

Azul - Desktop GUI framework WARNING: The features advertised in this README may not work yet. Azul is a free, functional, immediate mode GUI framewor

Maps4Print 5.4k Jan 1, 2023
Better GNOME Desktop Experience

Better GNOME Desktop Experience Tired of having the best feeling DE with the worst defaults? This app is for you. Transform the default GNOME look to:

Dimitar Dimitrov 3 May 10, 2022
Azul - Desktop GUI framework

Azul - Desktop GUI framework Azul is a free, functional, reactive GUI framework for Rust and C++, built using the WebRender rendering engine and a CSS

Felix Schütt 5.4k Dec 31, 2022
A desktop application wrapper for CovidValidator.app

A desktop application wrapper for CovidValidator.app Check EU Digitial Covid Certificates with ease and validate them against local or country rules.

Timo Koenig 2 Mar 15, 2022
A data-first Rust-native UI design toolkit.

Druid A data-first Rust-native UI toolkit. Druid is an experimental Rust-native UI toolkit. Its main goal is to offer a polished user experience. Ther

null 8.2k Dec 31, 2022
Rust bindings to the minimalist, native, cross-platform UI toolkit `libui`

Improved User Interface A cross-platform UI toolkit for Rust based on libui iui: ui-sys: iui is a simple (about 4 kLOC of Rust), small (about 800kb, i

Rust Native UI Group 865 Dec 27, 2022
Truly cross platform, truly native. multiple backend GUI for rust

WIP: Sauron-native a rust UI library that conquers all platforms ranging from desktop to mobile devices. An attempt to create a truly native, truly cr

Jovansonlee Cesar 627 Jan 5, 2023
Cross-platform native Rust menu library

A cross-platform Rust library for managing the native operating system menus.

Mads Marquart 16 Jan 6, 2023
Native Rust library for FastCGI

The FastCGI Rust implementation. Description gfcgi is a native Rust library for FastCGI. This library supports multithreaded socket listeners and HTTP

Andrey Gridchin 9 Aug 7, 2022