1

Can I modify my installed Openlayers plugin files to add a new layers origin? If yes, what files?

2

Yes, it is possible by manually editing the python file openlayers_plugin.py in .qgis/python/plugins/openlayers_plugin and creating an additional html file in the html folder.

You have to set up a local server (like Apache by MS4W) if you want to use your own tiles as localhost.

Only disadvantage is that you have to do the adaptaion every time the plugin gets updated.

This is what I inserted:

   self.olLayerTypeRegistry.add( OlLayerType(self, 'myMapnik','osm_icon.png', 'myMapnik.html', True) )

And inside the myMapnik.html (a copy of osm.html):

        var myMapnik = new OpenLayers.Layer.OSM(
          "myMapnik",
          "http://localhost/myMapnik/${z}/${x}/${y}.png",
          {
            eventListeners: {
              "loadstart": layerLoadStart,
              "loadend": layerLoadEnd
            }
          }
        );
        map.addLayer(myMapnik);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.