GenericMapProvider.cpp
static const QString serviceUrl = QStringLiteral("<serverUrl>/WMSServer?service=WMS&request=GetMap&layers=&styles=&format=image/png&transparent=true&version=1.1.1&width=512&height=512&srs=EPSG:3857&bbox=%1,%2,%3,%4");
QString serviceProvider::_getURL(const int x, const int y, const int zoom, QNetworkAccessManager* networkManager) {
Q_UNUSED(networkManager)
float north = tiley2lat(y, zoom);
float south = tiley2lat(y + 1, zoom);
float west = tilex2long(x, zoom);
float east = tilex2long(x + 1, zoom);
return serviceUrl.arg(west,0, 'f', 10).arg(south,0, 'f', 10).arg(east,0, 'f', 10).arg(north,0, 'f', 10);
}
float tilex2long(int x, int z)
{
float n = pow(2,z);
return (((x / n) * 360.0) - 180.0) * (20037508.34 / 180);
}
float tiley2lat(int y, int z)
{
double n = M_PI - 2.0 * M_PI * y / (double)(1 << z);
float lat = 180.0 / M_PI * atan(0.5 * (exp(n) - exp(-n)));
lat = log(tan((90 + lat) * (M_PI / 360))) / (M_PI / 180);
return (lat * (20037508.34 / 180));
}
and this is what I inserted in FlightMap.qml file
_map is the base map from whatever has been selected in App Settings.
Map {
id: trafficMap
anchors.fill: parent
color: 'transparent' // Necessary to make this map transparent
plugin: Plugin { name: "QGroundControl" }
opacity: 0.77
property string mapName: 'defaultMap2'
gesture.enabled: false
center: _map.center
minimumFieldOfView: _map.minimumFieldOfView
maximumFieldOfView: _map.maximumFieldOfView
minimumTilt: _map.minimumTilt
maximumTilt: _map.maximumTilt
minimumZoomLevel: _map.minimumZoomLevel
maximumZoomLevel: _map.maximumZoomLevel
zoomLevel: _map.zoomLevel
tilt: _map.tilt;
bearing: _map.bearing
fieldOfView: _map.fieldOfView
...
...
}
Here is the result
OpenSeaMap for my baselayer and the marine traffic on top! I used a simple timer to redraw the tiles for updated traffic info.