[Interest] QtLocation Maps and own tile server
Petric Frank
pfrank at gmx.de
Wed Aug 16 08:20:49 CEST 2023
Hello
Am Dienstag, 15. August 2023, 22:05:17 CEST schrieb Petric Frank:
> Hello,
>
> i've set up an own tile server according the docs from
> https://switch2osm.org/
> serving-tiles/manually-building-a-tile-server-debian-12/
>
> It is working well when i use leaflet tool as shown in the document above.
> The URL is http://192.168.2.180/hot/
>
> Now i took use the following qml to display the map using my tile server.
> But it seems to still access the default tile server (shows "API Key
> Required" water mark):
> -------------- cut ----------------
> import QtQuick 2.15
> import QtLocation 5.15
> import QtPositioning 5.15
>
> Item {
> id: item
>
> property real latCoordinate: <lat>
> property real lngCoordinate: <lng>
>
> Plugin {
> id: mapPlugin
> name: "osm"
> PluginParameter {
> name: "osm.mapping.custom.host"
> value: "http://192.168.2.180/hot/"
> }
> }
>
> Map {
> id: mapDisplay
> objectName: "mapDisplay"
> anchors.fill: parent
> plugin: mapPlugin
> center: QtPositioning.coordinate(latCoordinate, lngCoordinate)
> zoomLevel: 16
> }
> }
> -------------- cut ----------------
after some testing and debugging i found the possible solution.
I have to add in the Map block:
activeMapType: mapDisplay.supportedMapTypes[6]
The suggested solution provided by the docs to use
activeMapType: mapDisplay.supportedMapTypes[MapType.CustomMap]
does not work because MapType.CustomMap evaluates to 100 (here at Qt 5.15).
I don't know is this is a bug or intentional.
I do not like hardcoded values (here: 6) because it may change in future. Any
way to solve this ?
kind regards
Petric
More information about the Interest
mailing list