summaryrefslogtreecommitdiffstats
path: root/media/jslib/CaveView/lib/BGS.js
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2021-04-02 19:02:10 +0100
committerPhilip Sargent <philip.sargent@klebos.com>2021-04-02 19:02:10 +0100
commit371542fb1eafb721fe44fe9fbed3f37f2aeafe5e (patch)
treed6460ba94ef0c951765e51b7d5610bc74f401054 /media/jslib/CaveView/lib/BGS.js
parentb71f2c4ebb61940ec85b61d7e4d8aa11338c280b (diff)
downloadtroggle-371542fb1eafb721fe44fe9fbed3f37f2aeafe5e.tar.gz
troggle-371542fb1eafb721fe44fe9fbed3f37f2aeafe5e.tar.bz2
troggle-371542fb1eafb721fe44fe9fbed3f37f2aeafe5e.zip
Caveview enabled - local copy 3MB
Diffstat (limited to 'media/jslib/CaveView/lib/BGS.js')
-rw-r--r--media/jslib/CaveView/lib/BGS.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/media/jslib/CaveView/lib/BGS.js b/media/jslib/CaveView/lib/BGS.js
new file mode 100644
index 0000000..f10a0ab
--- /dev/null
+++ b/media/jslib/CaveView/lib/BGS.js
@@ -0,0 +1,35 @@
+
+function BGSTileURL ( x, y, z ) {
+
+ var earthRadius = 6378137; // in meters
+
+ var tileCount = Math.pow( 2, z );
+ var tileSize = earthRadius * 2 * Math.PI / tileCount;
+
+ var x1, x2, y1, y2;
+
+ x = x - tileCount / 2;
+ y = tileCount / 2 - y;
+
+ x1 = x * tileSize;
+ y1 = y * tileSize;
+
+ x2 = x1 + tileSize;
+ y2 = y1 + tileSize;
+
+
+ var url = 'https://map.bgs.ac.uk/arcgis/services/BGS_Detailed_Geology/MapServer/WMSServer?REQUEST=GetMap&VERSION=1.3.0&LAYERS=BGS.50k.Bedrock&STYLES=default&FORMAT=image/png&CRS=EPSG:3857&WIDTH=450&HEIGHT=450';
+ var bbox = '&BBOX=' + x1 + ',' + y1 + ',' + x2 + ',' + y2;
+
+ console.log( 'BGS: ', bbox );
+
+// var img = document.createElement( 'img' );
+
+// img.src = url + bbox;
+// img.crossOrigin = '';
+
+// document.body.appendChild( img );
+
+ return url + bbox;
+
+} \ No newline at end of file