Last active
December 22, 2015 09:19
-
-
Save gimoya/6450983 to your computer and use it in GitHub Desktop.
This script can be used with the QGIS OpenLayers Plugin to get tiles from Bergfex (= OEK 50, Austrian topographic map). See here: [http://gis.stackexchange.com/questions/70648/using-custom-source-for-qgis-openlayers-plugin] and here: [http://gis.stackexchange.com/questions/69907/easiest-way-to-create-historical-street-maps-using-qgis] for refere…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>OpenLayers Bergfex Topo Layer</title> | |
<link rel="stylesheet" href="qgis.css" type="text/css"> | |
<script src="OpenLayers.js"></script> | |
<script src="OlOverviewMarker.js"></script> | |
<script type="text/javascript"> | |
var map; | |
var loadEnd; | |
var oloMarker; // OpenLayer Overview Marker | |
function init() { | |
map = new OpenLayers.Map('map', { | |
theme: null, | |
controls: [], | |
projection: 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 bergfex = new OpenLayers.Layer.XYZ( | |
"Bergfex", | |
"http://static1.bergfex.at/images/amap/${z}$folder/${z}_${x}_${y}.png", | |
{ | |
getURL: function(bounds) { | |
var path = OpenLayers.Layer.XYZ.prototype.getURL.apply(this, arguments); | |
var parts = path.split("$folder/"); | |
var z = parseInt(parts[0].substr(-2)); | |
path = path.replace("$folder", z>=14 ? | |
"/" + parts[1].substr(3, 2 + z-14) : ""); | |
return path; | |
} | |
} ); | |
map.addLayer(bergfex); | |
map.addControl(new OpenLayers.Control.Attribution()); | |
map.setCenter(new OpenLayers.LonLat(0, 0), 2); | |
oloMarker = new OlOverviewMarker(map, getPathUpper(document.URL) + '/x.png'); | |
} | |
</script> | |
</head> | |
<body onload="init()"> | |
<div id="map"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment