Active Topics

 


Reply
Thread Tools
Posts: 1,548 | Thanked: 7,510 times | Joined on Apr 2010 @ Czech Republic
#31
Looking on how modRana does it (warning: modRana does some extra stuff there so the code is ore complex than necessarily needed) & trying to remember how I programmed it:
  • the PositionSource element has a coordinate property, which holds the current coordinate
  • the coordinate has a isValid property, which is used by modRana to decide if the coordinate is valid and should be used
  • to differentiate between 2D and 3D fix, modRana uses the altitudeValid property of the PositionSource instance

That seems to work reasonably well.

But it also depend how you define "has a fix" as by default the location backend on Sailfish OS first uses data from the mobile network and WiFi to get a rough position estimate while getting and actual GPS lock.

This is why you might see you position jump every 30 seconds for tens or hundreds of meters before it actually starts to track you position. It's the location backend sending data about local WiFi access points every 30 seconds to estimate your position while GPS is still acquiring the GPS lock.

The Info -> Location page in modRana displays detailed location data and you can nicely see the location converge from WiFi estimation to GPS fix there.
__________________
modRana: a flexible GPS navigation system
Mieru: a flexible manga and comic book reader
Universal Components - a solution for native looking yet component set independent QML appliactions (QtQuick Controls 2 & Silica supported as backends)
 

The Following 4 Users Say Thank You to MartinK For This Useful Post:
Posts: 1,746 | Thanked: 1,832 times | Joined on Dec 2010
#32
Originally Posted by MartinK View Post
Looking on how modRana does it (warning: modRana does some extra stuff there so the code is ore complex than necessarily needed) & trying to remember how I programmed it:
  • the PositionSource element has a coordinate property, which holds the current coordinate
  • the coordinate has a isValid property, which is used by modRana to decide if the coordinate is valid and should be used
  • to differentiate between 2D and 3D fix, modRana uses the altitudeValid property of the PositionSource instance

That seems to work reasonably well.

But it also depend how you define "has a fix" as by default the location backend on Sailfish OS first uses data from the mobile network and WiFi to get a rough position estimate while getting and actual GPS lock.

This is why you might see you position jump every 30 seconds for tens or hundreds of meters before it actually starts to track you position. It's the location backend sending data about local WiFi access points every 30 seconds to estimate your position while GPS is still acquiring the GPS lock.

The Info -> Location page in modRana displays detailed location data and you can nicely see the location converge from WiFi estimation to GPS fix there.
it works so and so tbh since am doing the same but i guess the user will just have to realise its nowhere near there location :P
 

The Following 2 Users Say Thank You to m4r0v3r For This Useful Post:
Posts: 58 | Thanked: 223 times | Joined on Apr 2017 @ Germany
#33
Originally Posted by rinigus View Post
I would suggest to install
https://build.merproject.org/package...s/mapboxgl-qml and just use MapboxMap together with the gesture area as in https://github.com/rinigus/mapbox-de...y/MainPage.qml . Then you don't even need to include MapboxGL as a submodule, can use regular gcc, and its all very simple. mapboxgl-qml would register the module in the system and all should just work. Please report bugs if it doesn't.
HI rinigus!
I am following your instructions but there is an error when opening the map page:
Code:
[ERROR] {QSGRenderThread}[Setup]: loading style failed: Problem with the SSL CA cert (path? access rights?): error setting certificate verify locations:
  CAfile: ca-bundle.crt
  CApath: none
This is what I did:
- installed mapboxgl-qml-1.1.0-10.27.1.jolla.armv7hl.rpm on the device (Oneplus X)
- took your basic example from here

Maybe there is a problem with the access token?
 

The Following 2 Users Say Thank You to jdrescher For This Useful Post:
Posts: 1,414 | Thanked: 7,547 times | Joined on Aug 2016 @ Estonia
#34
Originally Posted by jdrescher View Post
HI rinigus!
I am following your instructions but there is an error when opening the map page:
Code:
[ERROR] {QSGRenderThread}[Setup]: loading style failed: Problem with the SSL CA cert (path? access rights?): error setting certificate verify locations:
  CAfile: ca-bundle.crt
  CApath: none
This is what I did:
- installed mapboxgl-qml-1.1.0-10.27.1.jolla.armv7hl.rpm on the device (Oneplus X)
- took your basic example from here

Maybe there is a problem with the access token?
No, access token is still fine. However, I get the same error on this simple example as well as when using Poor Maps GL and trying to access Mapbox maps. Sounds like some HTTPS certificate bug that prevents us from getting the style downloaded. Hopefully, its mis-configuration of their servers and will be resolved. I'll look into it from here later

For now, you could use OSM Scout Server. For that, install it, configure for use of Mapbox GL tiles by selecting a profile with the vector tiles, download the region of interest and replace style URL in the simple example by

http://localhost:8553/v1/mbgl/style?style=osmbright

That should make it possible to use and test the widget. The access key is not required then, but you could just keep it as it is.
 

The Following 2 Users Say Thank You to rinigus For This Useful Post:
Posts: 1,414 | Thanked: 7,547 times | Joined on Aug 2016 @ Estonia
#35
Looks like an issue is in HTTPS certs. Namely, it seems not to find the certificates needed for HTTPS access to Mapbox. I don't know whether they just now switched to HTTPS or not, but I can get Poor Maps GL working by

* download https://raw.githubusercontent.com/ba.../ca-bundle.crt

* in the directory where ca-bundle.crt is stored, run sailfish-qml harbour-poor-maps-gl

Now I wonder, whether it happened when I moved QMapboxGL plugin to libcurl or was anyone able to access Mapbox online maps AFTER updating mapbox-qml plugin to 1.1.0?

The simple example QML that I posted seems still need some additional Silica wrapper. While it nicely downloads all required maps/fonts when started from directory with the certificates (as shown using urlDebug switch), map is not displayed and it complains about the absence of __silica_applicationwindow_instance. So, don't forget to wrap it into some Silica app QMLs.

PS I will look into the certificate problem and resolve it within few days
 

The Following 2 Users Say Thank You to rinigus For This Useful Post:
Posts: 58 | Thanked: 223 times | Joined on Apr 2017 @ Germany
#36
OK thanks, I will try to make it work with OSM Scout server. Just a few more questions:
- Jolla 1 won't work with MapBox, right?
- OSM Scout Server: user has to decide if he wants to keep the classic map or a vector map for MapBox. Is it possible to keep both maps on the phone (although that would need very much space on the SD card)?
- if I want to release my app with the MapBox QML component, the users also need mapboxgl-qml-1.1.0-10.27.1.jolla.armv7hl.rpm on their devices. How can I deliver it to them? Do they have to install it manually?
- does a user of my app need to enter his own token for MapBox?
 

The Following 2 Users Say Thank You to jdrescher For This Useful Post:
Posts: 1,414 | Thanked: 7,547 times | Joined on Aug 2016 @ Estonia
#37
Originally Posted by jdrescher View Post
OK thanks, I will try to make it work with OSM Scout server. Just a few more questions:
- Jolla 1 won't work with MapBox, right?
Right, Mapbox GL is not working on J1. Unless someone will come out and manage to fix it.

Originally Posted by jdrescher View Post
- OSM Scout Server: user has to decide if he wants to keep the classic map or a vector map for MapBox. Is it possible to keep both maps on the phone (although that would need very much space on the SD card)?
No, user can choose all possible backends by choosing corresponding settings. As a shortcuts, there are two options - just vector maps (Mapbox GL) or vector (Mapbox GL) and raster-generated on device (Mapnik). It would require larger space on the storage (SD Card).

Originally Posted by jdrescher View Post
- if I want to release my app with the MapBox QML component, the users also need mapboxgl-qml-1.1.0-10.27.1.jolla.armv7hl.rpm on their devices. How can I deliver it to them? Do they have to install it manually?
Its packaged at OpenRepos: https://openrepos.net/content/rinigu...indings-qt-qml

So, you could ask them to add my repository into their list of repositories and add mapboxgl-qml (name of the package) as dependency. This is probably the best way since it allows them to get the latest version with the bugs fixed (as the one I am fixing now).

The package is built at OBS, so they or you can take it from there (https://build.merproject.org/package...s/mapboxgl-qml).

You could also add this package into your repository. But that would require that you would be updating it as well.

Originally Posted by jdrescher View Post
- does a user of my app need to enter his own token for MapBox?
No, it doesn't have to be. Usually, its expected that you will put your API token. Right now, it allows you to get 50000 map tile downloads for free (see mapbox pricing) and then the developer would have to pay. I would suggest to keep an eye and if you start approaching that limit (wouldn't come overnight), cut it off or ask users for money.

However, there are alternatives. In addition to OSM Scout Server, @otsaloma setup his own server as a part of Poor Maps package. You could ask him for access key and suggest users to donate to him for this service. In addition, there are also other providers for map tiles which have free tier as well (Mapzen, for example).

And an update regarding the SSL bug. Looks like I missed testing online sources when we were searching for solution for localhost connection in offline mode. When switched to CURL-based downloads, the online sources broke if they use HTTPS. Its caused by adding hard-coded certificate file by Mapbox GL (https://github.com/mapbox/mapbox-gl-...ource.cpp#L249). In our phones (and on my Linux PC), the file with such name is missing. Now I am testing a patch without this hard-coded filename and checking if the default libcurl settings are good enough. On PC, it fixed an issue. On phone, I'll learn later tonight.
 

The Following 3 Users Say Thank You to rinigus For This Useful Post:
Posts: 213 | Thanked: 414 times | Joined on Nov 2010
#38
Originally Posted by rinigus View Post
As of today, offline support for Mapbox GL vector tiles has been released as a part of OSM Scout Server and the first full-blown application using the widget has been released as a temporary fork of Poor Maps. So, it should be possible to use it daily and the infrastructure for this maps widget is all in place.
Does the widget have an api for drawing on the map, using, eg QGeoPath/QGeoShape etc ?
 

The Following User Says Thank You to piggz For This Useful Post:
Posts: 1,414 | Thanked: 7,547 times | Joined on Aug 2016 @ Estonia
#39
Originally Posted by piggz View Post
Does the widget have an api for drawing on the map, using, eg QGeoPath/QGeoShape etc ?
Sure. It doesn't use QtLocation-based approach, but keeps it close to the original Mapbox GL sources. So, you add objects using GeoJSON usually, but you could also add images and maybe even videos on the map.

If you take Poor Maps GL as an example, I can add POIs (dots with text), route as a line, and widgets that will follow geo-location of the point of interest.

I'll copy-and-paste description of it from OSM Scout Server thread:

Example codes:

Vector maps are different from raster in the interactivity with them, you can insert/remove/modify your objects. So, API has to be richer than before.

To learn, I would suggest to
  • Make an account at Mapbox, go to Mapbox Studio and try to edit one of their styles. Just play a little bit with it (10-15 min) to get the feeling of interaction between sources/layers/properties
  • Take a brief look into https://www.mapbox.com/mapbox-gl-js/style-spec (10-15 min); later you will need to read sections on the need basis
  • API for the widget is documented at https://github.com/rinigus/mapbox-gl.../master/api.md . Look through, you don't need every property/signal, just get a feeling
  • Start hacking on the basis of examples
  • Don't hesitate to ask for help.

How well does the learning process go, I don't know. I am pretty sure @jdrescher and maybe others can tell better from their experience. In particular, where do we have to document more or better.
 

The Following 3 Users Say Thank You to rinigus For This Useful Post:
Posts: 1,414 | Thanked: 7,547 times | Joined on Aug 2016 @ Estonia
#40
Bugfix release published, please update on OpenRepos (https://openrepos.net/content/rinigu...indings-qt-qml). Online and offline servers should work now, as intended. Please let me know if it fixed for you as well and surely report issues that you have with the widget.
 

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


 
Forum Jump


All times are GMT. The time now is 17:43.