I've managed to setup a local OSM server and would like to use it as my application's tile provider. However, I am facing some difficult to make the Qt Location application to connect to the local server. The following code is a simple QML application that configures the "osm.mapping.host" plugin's property with the local server address. I noticed that the Plugin ignores the configuration and retrieves the tiles from MapQuest.
I would like to know if have anyone accomplished to connect the OSM plugin to connect on a different server than the default one ?
Window {
visible: true
Plugin {
id: mapPlugin
name: "osm"
PluginParameter { name: "osm.useragent"; value: "map" }
PluginParameter { name: "osm.mapping.host"; value: "http://127.0.0.1/osm_tiles/" }
PluginParameter { name: "osm.mapping.copyright"; value: "All mine" }
}
Map {
id: map
plugin: mapPlugin
anchors.fill: parent
center {
latitude: -23.5475
longitude: -46.636110
}
zoomLevel: 10
gesture.enabled: true
}
}
I just figured out that in order to force the OSM Map plugin to retrieve the tiles from the local server, ones must ensure that the Map's property activeMapType
is set equal to MapType.CustomType
. The Qt Location OSM Plugin's documentation is not clear about this. The following code worked for me.
Window {
visible: true
width: 800
height: 600
Plugin {
id: mapPlugin
name: "osm"
PluginParameter { name: "osm.mapping.host"; value: "http://127.0.0.1/osm_tiles/" }
}
Map {
id: map
anchors.fill: parent
center {
latitude: -23.5475
longitude: -46.636110
}
zoomLevel: 10
gesture.enabled: true
plugin: mapPlugin
//Make sure to set activeMapType equal to MapType.CustomType
activeMapType: supportedMapTypes[7]
}
}