2

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

&lthtml xmlns="http://www.w3.org/1999/xhtml">
  &lthead>
    &lttitle>OpenLayers FreeMap Layer
    &ltlink rel="stylesheet" href="qgis.css" type="text/css">
    &ltscript src="OpenLayers.js">
    &ltscript src="OlOverviewMarker.js">
    &ltscript 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');
        }
    &lt/script>
  &lt/head>
  &ltbody onload="init()">
    &ltdiv id="map">&lt/div>
  &lt/body>
&lt/html>

The problem is that QGIS does not open map:

QGIS Freemap layer

While the browser opens fine:

browser showing data

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

&lt!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
&lthtml>&lthead>
&lttitle>302 Found&lt/title>
&lt/head>&ltbody>
&lth1>Found&lt/h1>
&ltp>The document has moved &lta href="http://a.freemap.sk/core_allinone.php?/T/1/0/-1.png">here&lt/a>.&lt/p>
&lt/body>&lt/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
nmtoken
  • 13,355
  • 5
  • 38
  • 87
MarekP
  • 21
  • 1

1 Answers1

2
  1. Install quickmapservices plugin in QGIS.
  2. Open search panel (Web->QuickMapServices->Search QMS)
  3. Type freemap
  4. Push "Add button"

You can add your own services here: https://qms.nextgis.com/

enter image description here

enter image description here

Attention! The service has limits for zoom levels (8-16) and bounds.

Dmitry Baryshnikov
  • 3,221
  • 13
  • 17