I have a problem with adding a new layer to QGIS 2.6 OpenLayers and I need help. It is a source of maps www.freemap.sk
Examples of working with the server are:
http://wiki.freemap.sk/LayerAllInOne
http://wiki.freemap.sk/TileDistributionTest
Now I created a file freemap.html in the directory:
~/.qgis2/python/plugins/openlayers_plugin/weblayers/html
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>OpenLayers FreeMap Layer <link rel="stylesheet" href="qgis.css" type="text/css"> <script src="OpenLayers.js"> <script src="OlOverviewMarker.js"> <script type="text/javascript"> var map; var loadEnd; var oloMarker; // OpenLayers Overview Marker function init() { map = new OpenLayers.Map('map', { theme: null, controls: [], // projection: new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:3857"), units: "m", maxResolution: 156543.0339, maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34) }); loadEnd = false; function layerLoadStart(event) { loadEnd = false; } function layerLoadEnd(event) { loadEnd = true; } var osm = new OpenLayers.Layer.OSM( "FreeMapTuristika", "http://a.freemap.sk/T/${z}/${x}/${y}.png", { numZoomLevels: 16, eventListeners: { "loadstart": layerLoadStart, "loadend": layerLoadEnd } } ); map.addLayer(osm); map.addControl(new OpenLayers.Control.Attribution()); map.setCenter(new OpenLayers.LonLat(19.41,48.52).transform( new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:3857") ), 11 ); // map.setCenter(new OpenLayers.LonLat(4485,2841),13); oloMarker = new OlOverviewMarker(map, getPathUpper(document.URL) + '/x.png'); } </script> </head> <body onload="init()"> <div id="map"></div> </body> </html>
The problem is that QGIS does not open map:
While the browser opens fine:
When I watched the network traffic, I found that QGIS was sending erroneous requests to the server:
GET /T/1/0/-1.png HTTP/1.1 User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.21 (KHTML, like Gecko) QGIS2 Safari/537.21 Accept: */* Connection: Keep-Alive Accept-Encoding: gzip Accept-Language: en-US,* Host: a.freemap.sk HTTP/1.1 302 Found Server: nginx/1.6.2 Date: Wed, 05 Nov 2014 09:56:41 GMT Content-Type: text/html; charset=iso-8859-1 Location: http://a.freemap.sk/core_allinone.php?/T/1/0/-1.png Cache-Control: max-age=0 Expires: Wed, 05 Nov 2014 09:56:41 GMT X-Varnish: 10693744 Age: 0 Via: 1.1 varnish-v4 Content-Length: 235 Connection: keep-alive <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>302 Found</title> </head><body> <h1>Found</h1> <p>The document has moved <a href="http://a.freemap.sk/core_allinone.php?/T/1/0/-1.png">here</a>.</p> </body></html> GET /core_allinone.php?/T/1/0/-1.png HTTP/1.1 User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.21 (KHTML, like Gecko) QGIS2 Safari/537.21 Accept: */* Connection: Keep-Alive Accept-Encoding: gzip Accept-Language: en-US,* Host: a.freemap.sk HTTP/1.1 500 Internal Server Error Server: nginx/1.6.2 Date: Wed, 05 Nov 2014 09:56:41 GMT Content-Type: text/html; charset=UTF-8 Content-Length: 0 X-Powered-By: PHP/5.6.2 Cache-Control: max-age=172800, public Vary: User-Agent X-Varnish: 10693746 Age: 0 Via: 1.1 varnish-v4 Connection: keep-alive