I have my own local Z/X/Y map tile server and want to use it as a map background in a QML application. Looking at sample code it appears that this is done by:-
Plugin {
id: osmPlugin
name: "osm"
}
So I need to write my own plugin. But the documentation seems sparse and I cannot find the source code for the osm version or installation instructions.
Is this relatively easy to do, or can it be done without writing a new plugin?
You can set the osm.mapping.host like this:
Plugin {
id: osmPlugin
name: "osm"
PluginParameter { name: "osm.mapping.host"; value: "https://tile.openstreetmap.org/" }
PluginParameter { name: "osm.geocoding.host"; value: "https://nominatim.openstreetmap.org" }
PluginParameter { name: "osm.routing.host"; value: "https://router.project-osrm.org/viaroute" }
PluginParameter { name: "osm.places.host"; value: "https://nominatim.openstreetmap.org/search" }
PluginParameter { name: "osm.mapping.copyright"; value: "" }
PluginParameter { name: "osm.mapping.highdpi_tiles"; value: true }
}
But don't forget to set Custom Map type using the following code:
Map {
id: map
height: parent.width
width: parent.width
plugin: osmPlugin
Component.onCompleted: {
for( var i_type in supportedMapTypes ) {
if( supportedMapTypes[i_type].name.localeCompare( "Custom URL Map" ) === 0 ) {
activeMapType = supportedMapTypes[i_type]
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With