krpanomaps – SwissTopo as Tile Provider

  • A little information for Swiss krpano coders: it's possible to use the free map service of SwissTopo, the Swiss Federal Office of Topography, as a tile provider for krpano, allowing you to have a map in a panorama with the distinctive look and feel of Swiss maps. Map tiles and satellite view tiles are supplied by SwissTopo. They are bounded by the country's borders, which presupposes that the panorama was photographed in Switzerland.

    All you need to do is declare two new “tilesproviders”, under the existing ones, in the kpranomaps plugin in the following form:

    Then complete the call to krpanomaps.customParseTilePath in the plugin:

    JavaScript
        else if (image.maptype == "swisstopo" || image.maptype == "swissimage")
                {
                    // SwissTopo/Swissimage tile placeholders
                    path = path.split("{x}").join(1*h-1);
                    path = path.split("{y}").join(1*v-1);
                    path = path.split("{z}").join(1*levelindex+3);
                }

    Actions can then be used to call up these tiles (for my part, I superimposed two buttons on the map).

    XML
    <action name="map_view_ch_road" scope="local">
         set(layer[krpanomaps].tileprovider, 'swisstopo_road');
    </action>
    
    <action name="map_view_ch_sat" scope="local">
         set(layer[krpanomaps].tileprovider, 'swisstopo_sat');
    </action>

    Thanks to Klaus for the krpanomaps plugin and the Austrian example that served as the basis for this little exploration. (By the way, the Austrian demo is no longer functional as basemap_at has changed the URLs of the tile servers, see https://cdn.basemap.at/basemap.at_URL_Umstellung_2023.pdf)

  • With pleasure !

    After playing with the multiresthreshold parameter, it seems that the best compromise in terms of fluidity and display speed lies at -0.3/-0.4.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!