<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Map with WMS</title> <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css"> <style> html, body, #map { height: 100%; width: 100%; margin: 0; padding: 0; } body { background-color: #FFF; overflow: hidden; font-family: "Trebuchet MS"; } </style> <script src="http://js.arcgis.com/3.9/"></script> <script> var map; require(["esri/map", "esri/layers/WMSLayer", "esri/config","esri/layers/WMSLayerInfo","esri/geometry/Extent","esri/layers/FeatureLayer"], function(Map, WMSLayer, esriConfig, WMSLayerInfo,Extent,FeatureLayer,parser) { map = new Map("map", { extent: new Extent({xmin:-8.64846,ymin:49.8638,xmax:1.76767,ymax:60.8612,spatialReference:{wkid:4326}}), zoom: 2, // basemap: "streets" }); addNorway(WMSLayer,WMSLayerInfo,Extent); addBGS(WMSLayer,WMSLayerInfo,Extent); }); function addBGS(WMSLayer,WMSLayerInfo,Extent){ var layer20 = new WMSLayerInfo({name:"GBR_BGS_625k_BLS",title:"GBR BGS 1:625k Bedrock Lithology"}); var resourceInfo20 = { extent: new Extent(-8.64846,49.8638,1.76767,60.8612,{wkid: 4326}), layerInfos: [] }; var wmsLayer20 = new WMSLayer("http://ogc.bgs.ac.uk/cgi-bin/BGS_Bedrock_and_Superficial_Geology/wms", { resourceInfo: resourceInfo20, visibleLayers: ["GBR_BGS_625k_BLS"] } ); map.addLayers([wmsLayer20]); wmsLayer20.setVisibility(true); } function addNorway(WMSLayer,WMSLayerInfo,Extent){ var layer10 = new WMSLayerInfo({name:"Quadrants",title:"NO Quads"}); var resourceInfo10 = { extent: new Extent(-10.0,50.0,20.0,65.0,{wkid: 4326}), layerInfos: [layer10], version:"1.1.1" }; var wmsLayer10 = new WMSLayer("http://npdwms.npd.no/NPD_FactMap.asp", {resourceInfo: resourceInfo10, visibleLayers: ["Quadrants","pl_all","Fields","Exploration","Development"] } ); map.addLayers([wmsLayer10]); } </script> </head> <body> <div id="map"> </div> </body> </html>
wmsLayer.spatialReferences[0] = 3857
&CRS=EPSG:102100
&CRS=EPSG:3857
function addBGS(WMSLayer,WMSLayerInfo,Extent,lang){ var layerInfo = new WMSLayerInfo({name:"GBR_BGS_625k_BLS",title:"GBR BGS 1:625k Bedrock Lithology"}); var resourceInfo = { extent: new Extent(-8.64846,49.8638,1.76767,60.8612,{wkid: 4326}), layerInfos: [layerInfo] }; var wmsLayer = new WMSLayer("http://ogc.bgs.ac.uk/cgi-bin/BGS_Bedrock_and_Superficial_Geology/wms", { resourceInfo: resourceInfo, visibleLayers: ["GBR_BGS_625k_BLS"] } ); wmsLayer.spatialReferences[0] = 3857; map.addLayer(wmsLayer); }
HTTP/1.1 200 OK Date: Thu, 29 May 2014 13:02:01 GMT Server: Apache Access-Control-Allow-Origin: * Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/xml 278 <?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?> <ServiceExceptionReport version="1.3.0" xmlns="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wms/1.3.0/exceptions_1_3_0.xsd"> <ServiceException code="InvalidSRS"> msWMSLoadGetMapParams(): WMS server error. Invalid CRS given : CRS must be valid for all requested layers. msProcessProjection(): Projection library error. proj error "no options found in 'init' file" for "init=epsg:102100" </ServiceException> </ServiceExceptionReport> 0
I know it's late, but can you mark this as the correct answer? This helped several people already (one of them linked me here) and can help even more if available without scrolling through whole discussion.
Thanks!
Pavel