Thread: [SailfishOS] Mapbox GL Native QML plugin
View Single Post
Posts: 1,414 | Thanked: 7,547 times | Joined on Aug 2016 @ Estonia
#1
This is an announcement of Mapbox GL Native (https://github.com/mapbox/mapbox-gl-native) QML plugin that can be used to display and interact with the maps in QML application. This is a fast, OpenGL accelerated, high-quality rendering-providing map component that should be easy to use for app developers.

It is recommended to use this as QML plugin and use it through QML interface. It is possible to use the developed plugin by incorporating it on C++ source level, but then you will need newer gcc (>=4.9). When using QML interface, older gcc provided with SFOS is sufficient.

I am starting this thread to provide simple to find information on this QML plugin and to mark the readiness of the plugin for general development of map applications. This thread could be considered as a continuation of "brainstorm" thread https://talk.maemo.org/showthread.php?t=93358 and the step towards implementation of the original brainstorm request.

Project GitHub page: https://github.com/rinigus/mapbox-gl-qml

Documentation: https://github.com/rinigus/mapbox-gl.../master/api.md

License: LGPL3. For the gesture area interaction component, MIT.

Requirements: Qt >= 5.6

SFOS packaging:

OBS: https://build.merproject.org/package...s/mapboxgl-qml

OpenRepos: https://openrepos.net/content/rinigu...indings-qt-qml

C++ development library

QMapboxGL for C++ development is packaged using https://github.com/rinigus/pkg-mapbox-gl-native and available at https://build.merproject.org/package...maps/qmapboxgl.

Example code

As an example, see a QML item that would show a map that can be zoomed and panned

Code:
import QtQuick 2.0
import Sailfish.Silica 1.0
import MapboxMap 1.0
import QtPositioning 5.3

Page 
{
    id: page

    MapboxMap {
        id: map
        anchors.fill: parent

        center: QtPositioning.coordinate(60.170448, 24.942046)
        zoomLevel: 4.0
        minimumZoomLevel: 0
        maximumZoomLevel: 20
        pixelRatio: 3.0

        accessToken: "INSERT_MAPBOX_ACCESS_TOKEN_HERE"
        cacheDatabaseMaximalSize: 20*1024*1024
        cacheDatabasePath: "/tmp/mbgl-cache.db"

        styleUrl: "mapbox://styles/mapbox/outdoors-v10"

        MapboxMapGestureArea {
            map: map
        }
    }
}
Donations: https://liberapay.com/rinigus

Current issues

Issues are followed on GitHub project page at https://github.com/rinigus/mapbox-gl-qml/issues

Current main issue is crashes on Jolla 1 and Photon Q.

Obligatory screenshots

Poor Maps prototype showing
  • a road found by routing component incorporated into the map under the layer with the labels
  • POIs drawn on the map with the labels and interactive QML dialog following geographical location of POI
.
Attached Images
  

Last edited by rinigus; 2017-12-16 at 21:13. Reason: Recomended API is via QML
 

The Following 29 Users Say Thank You to rinigus For This Useful Post: