QT Map ItemsOverlay and MapItemView

Since we have a number of QT/QML mapping experts here I thought I’d ask here. I’ve done primitive navigation (the QT location examples are pretty good) testing in QML and wanted to implement a simple map overlay. But I’m not sure where to begin when creating overlay layers. It’s pretty simple in javascript in conjunction with the leaflet library, and I think there are probably 12 different solutions.

As I understand it, I make a base Map item and then add plugin type items overlay for a second Map item. But, looking at the api I’m using, I thought maybe I’m looking in the wrong direction. I’m bascially doing:

(where L.TileLayer is a call to leaflet)

            var source = new L.TileLayer(apiData.host + frame.path + '/' + optionTileSize + '/{z}/{x}/{y}/' + colorScheme + '/' + smooth + '_' + snow + '.png', {
                tileSize: 256,
                opacity: 0.01,
                zIndex: frame.time
            });

This get’s me the overlay rain radar images which are just swapped out one frame.time at a time given z/x/y as from the ‘base layer’ (which is osm). This is obviously a tile service :wink:

I don’t think MapItemView is the right approach, but… maybe @rinigus or @karry have an idea where I should start (and yeah, I’m looking at your code :wink:

EDIT: my code is mostly just : rainviewer-api-example/rainviewer-api-example.html at master · rainviewer/rainviewer-api-example · GitHub

Simple …
https://api.rainviewer.com/public/weather-maps.json

@poetaster: Our Qt/QML is so old that it is too painful to develop maps with it. Unfortunately, as I didn’t use the included Qt/QML framework, I cannot comment much on it.

Thanks anyway! I have some ideas but as you suggest, it’s a pain to try to locate what can be done from the current state. Still, the WebView approach sucks :slight_smile:

Hi. I have no experience with Qt map api either. OSM Scout is using own QML components for maps and its overlays… I am aware that Jolla allowed new apis in Harbour recently, but dont look what exactly is possible now. Sorry

Thanks anyway! I’ll just try to build a ‘text book’ provider type.

One question, the primary overlays you do are GPX or?

OSM Scout allows to add custom objects (POIs, waypoints, gpx tracks, navigation routes) to its standard map rendering pipeline. As overlay there may simple primitives or WMTS (raster tiles), like hillshading.

So, for weather overlay (in form of raster tiles), you can use libosmscout. But the integration of this library require some work. Do you want to help with that?

As far I know, @rinigus’s Pure maps is using MapLibre GL Native component. I have no idea if it supports overlay, but I would guess that yes.

I will definitely take a look. It’s a simple raster tiles overlay that I need to do :slight_smile:

Just for reference, one CAN use rainradars tile server with oms: https://tilecache.rainviewer.com//v2/radar/1666357800/256/9/53/13/2/1_0.png since it’s compatible. BUT, this can’t be used in an OSM plugin context because you have timestamp frames (so the uri changes with time), so it’s going to require more work :slight_smile: Was probably obvious.

Is there a notion of a tileserver uris changing path in libosmscout (beyond xyz)?

I would also be interested in a relatively easy solution to place some shapes (geoJSON or similar) with a color shading over a base map, in best case using plain QML (which is a task pretty simple with leaflet). I would have naively classified this as an absolute basic feature. :nerd_face:

1 Like

Did you look at the examples in qt/qtlocation.git - Qt Location ? among others, there’s a geojson example and planespotter …

You could use Mapbox GL QML plugin that I developed for interfacing Mapbox GL Native (MapLibre GL Native is used now). It’s the one used by Pure Maps for showing the maps and interaction. Possibilities can be looked up in the tutorial at Tutorials | Help | Mapbox - you would have to adjust to QML though. QML API is at mapbox-gl-qml/api.md at master · rinigus/mapbox-gl-qml · GitHub , demos in that repo could be outdated.

1 Like

I just checked and the geojson example won’t fly. The planespotter I’m going to make an SFOS version of.

Hmm, interesting find, thanks for the hint! Maybe difficult with Location 5.4 or 5.6, however. Let’s see.

I would love to use another (not mapbox) TMS and maybe stay harbor compliant as well.

no idea what it means.

Edited: Sorry, Mapbox GL QML is compatible with Harbour. See Pure Maps in it :). (forgot about it for a sec)

So that is true for other applications also using the plugin? That would be great, indeed! Can we import it simply?

With TMS i meant Tile Map Server. But maybe that’s also possible with your plugin. Should be something about the Map Sources. Probably I need this. I, indeed, have to investigate further!

See pure-maps/harbour-pure-maps.spec at master · rinigus/pure-maps · GitHub and look for jollastore. For building, I would recommend to either do it at OBS or add Chum repo for pulling development dependencies. As for RPM, Requires: mapboxgl-qml should do.

Regarding map sources, yes, there are several. See as examples Pure Maps pure-maps/maps at master · rinigus/pure-maps · GitHub for a list and corresponding URLs. If you will start getting many hits on tile servers then you would be on the same boat as me with free requests being denied. These days, MapTiler at least shuts down the service and will not welcome you with an invoice, as MapBox would do. But then, there are several services available, some not used in Pure Maps (yet?).

Also, you could obviously then use OSM Scout Server tiles. Again, link is available in JSON file there.

2 Likes

Replied too fast. Yes, you can set those with the plugin. See styleJson or styleUrl at mapbox-gl-qml/api.md at master · rinigus/mapbox-gl-qml · GitHub

1 Like

Yeah, the old geoservices-osm plugin is, even if it’s newer than 5.6, broken. I just posted a bug report since there was discussion around that point last year. I hope it’s just a bug an not either license or age that’s in the way.

1 Like