Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

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);
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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