Code Monkey home page Code Monkey logo

mapbox-gl-qml's Introduction

Unofficial Mapbox GL Native bindings for Qt QML

These bindings were originally developed for supporting Mapbox GL Native for platforms that lack Qt/QML 5.9 support, such as Sailfish OS, and application that are targeting Mapbox GL Native maps specifically. These bindings provide an alternative API that can be used to access Mapbox GL Native functionality in QML applications.

These bindings are used by few applications, such as Pure Maps and Laufhelden.

The code is based on QtLocation 5.9 Mapbox GL plugin, Qt/QML bindings developed as a part of Mapbox GL Native by Mapbox team before merging QML bindings with QtLocation. Please note that the origin of each file is noted in the comment at the top of the file.

Since QtLocation 5.9 is distributed with LGPL3.0, the code written for these bindings is distributed with the same license. The original code developed as a part of Mapbox GL Native has a license at https://github.com/mapbox/mapbox-gl-native/blob/master/LICENSE.md

For Sailfish, the bindings are available as a package at OpenRepos. For desktop Linux, unless packaged for your distribution, compilation from source is needed. Instructions for compilation are here

The description of API: api.md

Demo for Sailfish OS is at the separate repository: https://github.com/rinigus/mapbox-demo-sfos

Included demo (app subfolder) is for C++. Note that if the plugin is installed in the system, its easier to use it from QML directly. Just add import MapboxMap 1.0 to your QML and you would have access to it without any C++ code requirements.

To use Mapbox GL tiles and styles provided by Mapbox, please register on their site and obtain access key. The key can be either used to specify accessToken property of MapboxMap (see API description) or using environment variable MAPBOX_ACCESS_TOKEN.

mapbox-gl-qml's People

Contributors

jdrescher2006 avatar otsaloma avatar puretryout avatar rinigus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mapbox-gl-qml's Issues

Make a distinction between swipe and tap

Currently when I tap, e.g. a POI icon on the map, the map usually moves a little bit, which I assume means that the tap is detected as both a swipe (pan) and a tap. It looks quite distracting. Can you make a distinction between these โ€“ some kind tolerance that a swipe has to cross? For comparison, QtLocation gets this right.

track location api

add api that would allow to team position given in lat,lon on screen

method to add location with it's id

signal emitted when position on screen changes including visibility flag

remove location tracking for all or specified id

Expose style JSON as it is used

Currently, style JSON can be provided by user. However, we may need sometimes to know real JSON that's used. Since the library provides all the signals,we just need to hook it to the plugin and expose JSON as it is loaded from the net.

How to add images to the map at location

I am trying to add a PNG image to the map at a given location. The API description is pretty unclear to me regarding images. While I was able to paint a circle as given by the examples, calling map.addImagePath("position-icon", Qt.resolvedUrl("qrc:///graphics/myimage.png")) returns false. According to the docs it should return true when the image was successfully added.

I can add a qml image like so:

   Image {
      z: 100
      source: "qrc:///graphics/myimage.png"
      x: 0
      y: 0
      width: 100
      height: 100
   }

And it will display just fine, so, the image exists, and can be accessed via qrc:///graphics/myimage.png. Why does the function return false?

Also, I fail to understand how I could assign a location to the added image. Do I need to add a source? How do I tie source and image?

Sidequestion:
I guess MapboxMap does not just plain support MapQuickItem so any QML item could be added to the map?

Allow clearing cache

Sometimes it's needed to clear the cache, to make sure the maps are up-to-date. This can be done by removing the file, but that's very inconvenient and I'd like to add a button to WhoGo Maps to clear the cache. Is that something you could add to the API? Can you remove or truncate the cache database while a Mapbox GL app is running?

add interface for coordinateZoomForBounds

coordinateZoomForBounds can be used to ensure that we can visualize all given points.

Two interfaces should be done:

  • query for given list of coordinates returning zoom and the center

  • setter to move the camera position so that the given list of coordinates would be shown.

All this is done for the current pitch and bearing.

center offset

Qt API has functions that should allow to implement offsetting the "center" of the map, as done when in navigation mode. Use setBearing(double degrees, const QPointF &center), moveBy, and methods transferring between pixel and coordinate spaces.

API should allow to set the center and (in ratios) position on the map (like 0.5, 0.25)

sometimes map is not rendered fully

when starting or changing map, map shows only pois. as soon as its moved, all layers come up. probably have to update it one extra time on loading.

Crash at high zoom levels for RTL countries

As reported by @Planetos in rinigus/pure-maps#121

Unfortunately now the app closes/crashes if I zoom into an OSM map as soon as I reach zoom-level 1km - according to the measure in lower left corner. This happens where languages are written from right to left.
Tested on Sailfish on ARM.

Further observations:

I can reproduce it with Lebanon, on phone (SFOS) and on desktop. When using QtLocation based map viewer there is no crash. So, something is wrong with BiDi handling in QMapboxGL version compiled by me. In my version, the library is compiled with use_icu flag that uses platform/default/bidi.cpp to render RTL languages correctly (same didn't work with platform/qt/src/bidi.cpp).

Would have to check how to make platform/qt/src/bidi.cpp to work correctly and not lead to rinigus/pure-maps#121 . I presume that Qt version is used in QtLocation and there it works as expected.

/cc @Planetos

Delay with map gestures

When I tap something on the map, there's a slight delay, maybe half a second or so, before I see the result. So, when tapping a POI icon in WhoGo Maps, the bubble doesn't appear right away and that's a bad user experience. For comparison, the north arrow and attribution icons in WhoGo are perceivably instant. So, where does the delay originate from and can you shorten it?

Updating source layer many times (7000) could lead to crash

As reported by @jdrescher2006 at TMO:

I have a problem in my app regarding the mapbox plugin. (https://github.com/jdrescher2006/Laufhelden)

After loading an autosave file, I would go through all recorded positions and then add each coordinate to an array. You can see the for statement in line 118 (https://github.com/jdrescher2006/Laufhelden/blob/17153d2ba4bab65c8a52cd90bff161ee3b0ac48f/qml/pages/RecordPage.qml#L118).
Then in line 632, I would add each coordinate point to the map track.

And this line 632 is the problem. If the autosave is big enough e.g. >7000 coordinate points, the app will crash. Sometimes my phone even reboots then. Do you have an idea what could cause the problem?

Originally Posted by rinigus: And one more question: does it mean that you call updateSourceLine 7000 times (once per each point) during startup or is it all factored into one call?

That's correct, 7000 times during startup. And then somewhere in between it gets stuck and crashs.

While during workout it is called once every second. And it seems that this also leads to the crash after 2 hours or something.

Runtime styling

Add support for runtime styling. In particular, we need to be able to change map language.

Background for raster sources

With raster sources, I'm seeing the Sailfish ambience background where no tiles have yet been loaded. It's easiest to test by setting a bogus tile URL, where all tile downloads fail. A good default would be "#e6e6e6", which works well for most light background maps.

long hold event problems

A user of Poor Maps GL has noticed variability in addition new POI by long press. Have to look into it and check whether we can reduce processing.

Maybe, the coordinate can be checked for and cached already while holding a point before full event gets initiated.

Include MouseArea into plugin

When MouseArea is developed, make it a part of the plugin. Have to think through the signals that are emitted by it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.