{"id":507,"date":"2018-06-16T21:37:19","date_gmt":"2018-06-16T20:37:19","guid":{"rendered":"http:\/\/www.hilltop-cottage.info\/blogs\/adam\/?p=507"},"modified":"2018-06-16T22:03:41","modified_gmt":"2018-06-16T21:03:41","slug":"adding-british-geological-survey-bgs-wms-layers-to-geojson-io","status":"publish","type":"post","link":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/adding-british-geological-survey-bgs-wms-layers-to-geojson-io\/","title":{"rendered":"Adding British Geological Survey (BGS) WMS Layers to geojson.io"},"content":{"rendered":"<p>This took a little while to do; there doesn&#8217;t seem to be anywhere explaining how to add WMS layers and controls in simple terms&#8230; so here it is for anyone else. Pieced together from various places, the leaflet documentation, and some guesswork, here is how to add <a href=\"http:\/\/www.bgs.ac.uk\/data\/services\/digmap50wms.html\">WMS layers for BGS solid and superficial deposit geology and linear features<\/a> to a <a href=\"http:\/\/geojson.io\">geojson.io<\/a> view. The layer opacity has been set to 0.5 to allow the base map to be seen.<\/p>\n<p>You will need to access the developers&#8217; console (F12 on Firefox).<\/p>\n<p>It will look like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-508 alignnone\" src=\"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-content\/\/2018\/06\/js-console.png\" alt=\"\" width=\"452\" height=\"243\" srcset=\"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-content\/2018\/06\/js-console.png 452w, https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-content\/2018\/06\/js-console-300x161.png 300w\" sizes=\"auto, (max-width: 452px) 100vw, 452px\" \/><\/p>\n<p>Enter the following commands where the &#8220;&gt;&gt;&#8221; is:<\/p>\n<pre>var solid = L.tileLayer.wms(\"https:\/\/map.bgs.ac.uk\/arcgis\/services\/BGS_Detailed_Geology\/MapServer\/WMSServer\", {layers: 'BGS.50k.Bedrock', format: 'image\/png', version: '1.3.0'});\r\nvar drift = L.tileLayer.wms(\"https:\/\/map.bgs.ac.uk\/arcgis\/services\/BGS_Detailed_Geology\/MapServer\/WMSServer\", {layers: 'BGS.50k.Superficial.deposits', format: 'image\/png', version: '1.3.0'});\r\nvar linear = L.tileLayer.wms(\"https:\/\/map.bgs.ac.uk\/arcgis\/services\/BGS_Detailed_Geology\/MapServer\/WMSServer\", {layers: 'BGS.50k.Linear.features', format: 'image\/png', version: '1.3.0'});\r\nvar layer_control = {\"Solid\": solid, \"Drift\": drift, \"Linear Features\": linear};\r\nsolid.setOpacity(0.5);\r\ndrift.setOpacity(0.5);\r\nlinear.setOpacity(0.5);\r\nwindow.api.map.addLayer(drift);\r\nwindow.api.map.addLayer(solid);\r\nwindow.api.map.addLayer(linear);\r\nL.control.layers(null, layer_control).addTo(window.api.map);<\/pre>\n<p>I find I have to leave the console now.<\/p>\n<p>One thing to note is that the BGS WMS will not return an image if you are very &#8220;zoomed out&#8221;. Zoom in until the scale bar shows 500m or 1km.<\/p>\n<p>&nbsp;<\/p>\n<p>Other BGS WMS layers to add:<\/p>\n<pre>var artificial = L.tileLayer.wms(\"https:\/\/map.bgs.ac.uk\/arcgis\/services\/BGS_Detailed_Geology\/MapServer\/WMSServer\", {layers: 'BGS.50k.Artificial.ground', format: 'image\/png', version: '1.3.0'});\r\nvar movement = L.tileLayer.wms(\"https:\/\/map.bgs.ac.uk\/arcgis\/services\/BGS_Detailed_Geology\/MapServer\/WMSServer\", {layers: 'BGS.50k.Mass.movement', format: 'image\/png', version: '1.3.0'});<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This took a little while to do; there doesn&#8217;t seem to be anywhere explaining how to add WMS layers and&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-507","post","type-post","status-publish","format-standard","hentry","category-geology-and-mines","post-archive"],"_links":{"self":[{"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/posts\/507","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/comments?post=507"}],"version-history":[{"count":7,"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/posts\/507\/revisions"}],"predecessor-version":[{"id":515,"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/posts\/507\/revisions\/515"}],"wp:attachment":[{"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/media?parent=507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/categories?post=507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/tags?post=507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}