Search code examples
qtqmlopenstreetmaptiles

QML OpenStreetMap custom tiles


I would like to use OSM plugin in my QML project. But I don't really like how default tiles which Qt provides look.

I've found out, that I can specify osm.mapping.custom.host for url string of a custom tile server. I also chose tiles ("Humanitarian map style") which I would like to use from tile servers list https://wiki.openstreetmap.org/wiki/Tile_servers.

I would like know, what should I provide in osm.mapping.custom.host field to change default tiles with Humanitarian map style tiles?


Solution

  • Basically this is everything you need to write to add a custom tiles. 'Value' is on of the tile servers based on OpenStreetMap data (more can be found here, use 'tiles url' and don't forget to erase '${z}/${x}/${y}.png')

    Map
    {
        id: map
        anchors.fill: parent
        plugin: Plugin
        {
            name: "osm"
            PluginParameter
            {
                name: "osm.mapping.custom.host"
                value: "http://a.tile.openstreetmap.fr/hot/"
            }
        }
        activeMapType: supportedMapTypes[supportedMapTypes.length - 1]
    }