The lightweight and modern Map SDK for Android and iOS

Overview

Open Mobile Maps




The lightweight and modern Map SDK for Android (6.0+) and iOS (10+)

openmobilemaps.io

Getting started

Readme Android

Readme iOS

Features

  • Multi-platform graphics engine based on OpenGL for Android and Metal for iOS
  • Touch and gesture handling
  • Tiled Map Layers
  • Polygon Layers

...and more to come! See our roadmap at openmobilemaps.io

Architecture

To support both the Android and iOS, most of the code-base is written in C++ and shared between the two platforms. The Kotlin and Swift interface bindings are generated with a fork of the Djinni library. The library intentionally is designed to have a modular structure, so that most parts of it can be adjusted or completely replaced with custom implementations. Most of the interfaces are also exposed to Swift and Kotlin, so extensions can also conveniently be programmed in those languages.

The internal structure of the project is split into two main modules: the graphics-core and the maps-core. While the first implements a generic structure for rendering basic graphic primitives on Android and iOS, the latter is a collection of classes that provide the basics for creating a digital map.

Graphics Core

MapCore diagram

The rendering concept in the graphics core is built around generic graphics primitives to achieve a versatile base structure. While the basic logic for organizing the primitives is shared, the implementations of those graphics object interfaces are platform-specific. For Android, the OpenGL code is kept in C++, while the Metal-implementations for iOS are written in Swift. The SceneInterface is the shared, central collection of the necessary interfaces for both creating and rendering such graphics objects.

Maps Core

MapCore diagram

Building on top of the graphics core, the MapCore wraps the generic render code into a more accessible collection of higher-level classes with the functionality to build and display a digital map.

MapView

On both platforms, the MapView builds the central ui element that can directly be added to the app and be interacted with. It handles the interactions between each platform and the shared library, the lifecycle of the view, as well as setting up relevant platform-specific components and exposing the necessary methods for manipulating all elements of the map.

MapScene

The MapScene, implementing the MapInterface, holds the necessary resources for interacting with the underlying render system and creating the graphics primitives, but also builds the main access point for the other components that are relevant for a functioning map. For instance, the map requires a configuration file, a camera, a touch handler and others. The MapScene also holds the collection of all layers in the scene and provides the necessary methods to adjust it.

Map Configuration & Coordinates

When setting up the map, a coordinate system for it needs to be specified. In the current implementation, the system is assumed to be a uniform, two-dimensional grid.

All map positions handled within maps core are of the type Coord. Along with the three-dimensional position values, it holds a coordinate system identifier with the purpose of specifically exposing to the system in which the values should be interpreted at that time. To switch between different coordinate systems, the MapScene holds a CoordinateConversionHelper. This helper uses pre-defined and additionally registered custom converters to transform coordinates between two systems, specified by their system identifier.

This library comes with the implementations for two prominent coordinate systems: EPSG:2056 (LV95/LV03+) and EPSG:3857 (Pseudo-Mercator). They can be created using the CoordinateSystemFactory.

Camera & Interaction

The camera attached to the MapScene defines the section of the map that is rendered when a frame is drawn. It also handles and interprets interaction events passed to it by a TouchHandler. MapCore contains an implementation for a simple orthographic camera moving in the x/y-plane and a DefaultTouchHandler for a matching gesture recognition. The camera component offers an interface for querying and setting its current position in the space defined by the map's coordinate system.

Layers

The graphical content displayed in the MapScene is grouped in layers. A layer contains one to many LayerObjects. These are collections of the information necessary to place a graphics primitive in the maps coordinate space and that define their appearance. Before a new frame is drawn, the MapScene queries all added layers for a configuration, specifying which graphics need to be drawn in which respective order.

Two layer types are available with MapCore: Tiled2dMapRasterLayer and PolygonLayer.

TiledRasterLayer

The content of most digital maps is split into hierarchical layers of map tiles. This layer supports both the loading and displaying of the relevant tiles for a given camera position and zoom-value. On creation of such a layer, a Tiled2dMapLayerConfig needs to be defined. It specifies the layers coordinate system by setting the bounds coordinates, as well as the different zoom layers and provides the url/identifier for loading the tiles.

In addition to the configuration, an implementation of the TextureLoaderInterface needs to be supplied. A default implementation to load tiles from a given URL is contained in maps core on both platforms.

PolygonLayer

The PolygonLayer provides an interface to create and draw uniformly colored polygons in the map space.

License

This project is licensed under the terms of the MPL 2 license. See the LICENSE file.

Comments
  • Zoom value is always 1

    Zoom value is always 1

    I followed the README.md example in order to get the map to work using an open street map URL but the Tiled2dMapLayerConfig always returns 1 as the zoom. My getTileUrl() function looks like this:

     override fun getTileUrl(x: Int, y: Int, zoom: Int): String {
                Log.d(TAG, "getTileUrl x:$x , y:$y , zoom:$zoom")
                return"https://tile.openstreetmap.org/$zoom/$x/$y.png"
            }
    

    The logs tell me that the zoom is always 1 even if I pinch zoom in or out: getTileUrl x:1081 , y:659 , zoom:1 The Map looks like this: activity_open_mobile_maps_dynamic

    If I hardcode the zoom value to 15 for example:

     override fun getTileUrl(x: Int, y: Int, zoom: Int): String {
                Log.d(TAG, "getTileUrl x:$x , y:$y , zoom:$zoom")
                return"https://tile.openstreetmap.org/15/$x/$y.png"
            }
    

    I initially see only ocean: activity_open_mobile_maps_zoomed_out_hardcoded

    but if I zoom in using pinch gestures I can at some point see the map: activity_open_mobile_maps_zoomed_in_hardcoded

    I uploaded the Activity here.

    Any idea how I can make it work?

    opened by nicolaiendios 2
  • iOS: Graphics object race conditions

    iOS: Graphics object race conditions

    Currently a race condition can happen if the properties of a graphics object are updated while the object is being rendered. If an object is updated very frequently there is a good chance this happens. Therefore I introduced the concept of locking in iOS graphics objects. The locking mechanism used is os_unfair_lock since it is the faster mechanism on iOS according to: https://serhiybutz.medium.com/swift-mutex-benchmark-b21ee293d9ad

    opened by stmitt 0
  • Vector Tile Origin

    Vector Tile Origin

    • Standard braucht TOP_LEFT
    • Wir handeln nun auch andere Möglichkeiten
    • getVectorSettings() bei Layer Config
    • Anpassung weniger Memory bei Berechnung im GeometryHandler und Zusammenfassung Berechnung Koordinate
    • Keine Sortierung der Koordinaten bevor rect an GeometryHandler gegeben wird
    opened by zimmermannubique 0
  • Couldn't get targetSdkVersion for package com.android.accelerometergraph

    Couldn't get targetSdkVersion for package com.android.accelerometergraph

    I encounter a lot of crashes/exceptions during runtime:

    E/JavaBinder: *** Uncaught remote exception! (Exceptions are not yet supported across processes.) java.lang.RuntimeException: android.os.RemoteException: Couldn't get targetSdkVersion for package com.android.accelerometergraph at android.os.Parcel.writeException(Parcel.java:2222) at android.os.Binder.execTransactInternal(Binder.java:1239) at android.os.Binder.execTransact(Binder.java:1179) Caused by: android.os.RemoteException: Couldn't get targetSdkVersion for package com.android.accelerometergraph at com.android.server.pm.PackageManagerService$PackageManagerNative.getTargetSdkVersionForPackage(PackageManagerService.java:32748) at android.content.pm.IPackageManagerNative$Stub.onTransact(IPackageManagerNative.java:297) at android.os.Binder.execTransactInternal(Binder.java:1220) at android.os.Binder.execTransact(Binder.java:1179)  E/inertial-anchor: [CalibrationManager]: Unknown sensor_type used in SetCalibration.

    Samsung Galaxy A52 with Android 12 lib-open-swiss-maps-sdk version 1.1.4:

    opened by Shibynator 0
  • IllegalStateException

    IllegalStateException

    During runtime we discovered this exception within our crashlytics, we're using the lib-open-swiss-maps-sdk version 1.1.4:

    Fatal Exception: java.lang.IllegalStateException: GpsLayer is already destroyed! at io.openmobilemaps.gps.GpsLayer.requireLayerInterface(GpsLayer.kt:1) at io.openmobilemaps.gps.GpsLayer.onCompassUpdate(GpsLayer.kt:1) at io.openmobilemaps.gps.compass.CompassProvider.onSensorChanged(CompassProvider.kt:11) at android.hardware.SystemSensorManager$SensorEventQueue.dispatchSensorEvent(SystemSensorManager.java:982) at android.os.MessageQueue.nativePollOnce(MessageQueue.java) at android.os.MessageQueue.next(MessageQueue.java:335) at android.os.Looper.loopOnce(Looper.java:186) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8669) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java

    With the following Device: Samsung Galaxy A52 with Android 12

    opened by tdascoli 0
  • RUN TIME ERROR

    RUN TIME ERROR

    JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.ClassNotFoundException: Didn't find class "io.openmobilemaps.mapscore.shared.MapsCoreSharedModule$CppProxy" on at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:230)

    MY CODE IS : FRAGMENT: binding.mapViewDealers.setupMap(MapConfig(CoordinateSystemFactory.getEpsg3857System())) binding.mapViewDealers.registerLifecycle(lifecycle)

    XML: <io.openmobilemaps.mapscore.map.view.MapView android:id="@+id/mapViewDealers" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" />

    opened by mohammedelnady 0
Releases(1.4.1)
  • 1.4.1(Aug 16, 2022)

    • iOS: updates device to ppi mapping
    • iOS: fixes masked line groups
    • iOS: fixes bug that caused the map to be cropped if display zoom is enabled
    • iOS: fixes metal crash when attempting to load empty texture
    • fixes a error in MapCamera2d::getPaddingCorrectedBounds

    Full Changelog: https://github.com/openmobilemaps/maps-core/compare/1.4.0...1.4.1

    Source code(tar.gz)
    Source code(zip)
  • 1.4.0(Jun 20, 2022)

    • Includes earcut.hpp dependency for polygon triangulation
    • Adds polygon and line group rendering objects which can be used to efficiently render many objects with a limited number of styles
    • Expands line style options
    • Adds masking methods to the layerInterface
    • Adds scissoring methods to the layerInterface
    • Adds option to display tiled raster layer density dependent
    • Adds off screen rendering helpers
    • Many improvements and bugfixes
    Source code(tar.gz)
    Source code(zip)
  • 1.3.3(Aug 16, 2021)

  • 1.3.2(Aug 13, 2021)

  • 1.3.1(Aug 11, 2021)

  • 1.3.0(Apr 19, 2021)

    • Native library and relevant header files are now properly included in the published dependency
    • Added a Circle2dLayerObject
    • Bugfixes & improvements
    • Fixes iOS retain cycle
    Source code(tar.gz)
    Source code(zip)
  • 1.2.0(Mar 3, 2021)

    • Add WMTS capability parsing capabilities
    • Add icon layer implementation
    • implemented camera movement inertia
    • improves animation handling
    • bugfixes and improvements
    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Feb 28, 2021)

  • 1.0.0(Feb 19, 2021)

Owner
Open Mobile Maps
The Lightweight And Modern Map SDK
Open Mobile Maps
Indexes points and lines and generates map tiles to display them

Datamaps This is a tool for indexing large lists of geographic points or lines and dynamically generating map tiles from the index for display. Depend

Eric Fischer 329 Dec 6, 2022
iOS 10.x 32 and 64 bit jailbreak with spicy autoexecution

ap0110 ap0110 is an autoexecuting jailbreak for iOS 10.x, on 32 and 64-bit. Developed by the Athenus Dev Team and w212. <3 Credits tihmstar - h

Athenus Dev Team 22 Aug 24, 2022
A cross-platform protocol library to communicate with iOS devices

libimobiledevice A library to communicate with services on iOS devices using native protocols. Features libimobiledevice is a cross-platform software

libimobiledevice 5.4k Dec 30, 2022
A WIP "Vulnerable by Design" kext for iOS/macOS to play & learn *OS kernel exploitation

Vulnerable Kext A WIP (work-in progress) "Vulnerable by Design" kext for iOS/macOS to play/learn with *OS kernel exploitation Usage Documentation can

Chaithu 221 Dec 11, 2022
Random stuff about lower level iOS

Lower Level iOS Random stuff about lower level iOS Topics Macho Parser - study note of Mach-O format Dynamic Linking Exported Symbol - details of how

Qing Yang 113 Dec 27, 2022
Open Source iOS 15 Jailbreak Project

Fugu Fugu is the first open source jailbreak tool based on the checkm8 exploit. UPDATE: Fugu will now install Sileo, SSH and Substitute automatically!

epeth0mus 264 Dec 18, 2022
Unofficial C++ beta SDK for the top.gg API.

topgg-cpp-sdk (Beta) Unofficial C++11 beta SDK for the top.gg API. Please note that the library is currently not completed yet! Requirements: libcurl

7 Nov 16, 2021
Modify Android linker to provide loading module and hook function

fake-linker Chinese document click here Project description Modify Android linker to provide loading module and plt hook features.Please check the det

sanfengAndroid 216 Jan 4, 2023
Juice the carrots from ウマ娘プリティーダービー (Umamusume Pretty Derby) - Android implementation

Riru-CarrotJuicer Hooks the decryption function in libnative.so of ウマ娘プリティーダービー (Umamusume Pretty Derby), to allow inspecting the packets. For Windows

Huang Yue 27 Aug 9, 2022
A simple library to expose the linker namespace functionality in Android 9+ together with symbol hooking

Android Linker Namespace Bypass Library Provides access to the hidden linker namespace functionality in Android 9+ and exposes an interface for hookin

Billy Laws 10 Jan 6, 2023
Simple and lightweight pathname parser for C. This module helps to parse dirname, basename, filename and file extension .

Path Module For C File name and extension parsing functionality are removed because it's difficult to distinguish between a hidden dir (ex: .git) and

Prajwal Chapagain 3 Feb 25, 2022
MMUit is a lightweight toolkit to explore and modify address translation for ARM64.

Overview MMUit is a lightweight toolkit to explore and modify address translation for ARM64. C/C++ interface detailed information on VA, TTE, TCR etc

Alexander Hude 37 Feb 13, 2022
The goal of arrowvctrs is to wrap the Arrow Data C API and Arrow Stream C API to provide lightweight Arrow support for R packages

The goal of arrowvctrs is to wrap the Arrow Data C API and Arrow Stream C API to provide lightweight Arrow support for R packages to consume and produce streams of data in Arrow format. Right now it’s just a fun way for me to learn about Arrow!

Dewey Dunnington 30 Aug 5, 2022
match(it): A lightweight header-only pattern-matching library for C++17 with macro-free APIs.

match(it): A lightweight header-only pattern-matching library for C++17 with macro-free APIs. Features Easy to get started. Single header library. Mac

Bowen Fu 434 Dec 27, 2022
Lightweight state machine implemented in C++

Intro This is my second take on C++ state machine implementation. My first attempt can be found here. The main goals of the implementation are: No dyn

Łukasz Gemborowski 22 Dec 30, 2022
An attempt to restore and adapt to modern Win10 version the Rootkit Arsenal original code samples

rootkit-arsenal-guacamole An attempt to restore and adapt to modern Win10 version the Rootkit Arsenal original code samples All projects have been por

Matteo Malvica 51 Nov 6, 2022
A compile-time enabled Modern C++ library that provides compile-time dimensional analysis and unit/quantity manipulation.

mp-units - A Units Library for C++ The mp-units library is the subject of ISO standardization for C++23/26. More on this can be found in ISO C++ paper

Mateusz Pusz 679 Dec 29, 2022
The most powerful and customizable binary pattern scanner written on modern C++

Sig The most powerful and customizable binary pattern scanner written on modern C++ ✔ Capabilities: Support for all common pattern formats: Pattern +

Александр 153 Dec 21, 2022
A Template Engine for Modern C++

Inja is a template engine for modern C++, loosely inspired by jinja for python. It has an easy and yet powerful template syntax with all variables, lo

pantor 1.2k Jan 8, 2023