Hi Philipp,
the function OpenLayers.Layer.WMS.prototype.getFullRequestString have to be
load after the OpenLayers script(s) are loaded (the function overwrites the
original function from OpenLayers) and before the declaration of the Layer.WMS.
It should be something in this way:
...
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
OpenLayers.Layer.WMS.prototype.getFullRequestString = function(newParams,altUrl)
{
try{
var projectionCode=typeof this.options.projection == 'undefined' ?
this.map.getProjection() : this.options.projection;
}catch(err){
var projectionCode=this.map.getProjection();
}
this.params.SRS = projectionCode=="none" ? null : projectionCode;
return
OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments);
}
function init()
{
var boundaries = new OpenLayers.Layer.WMS( "Boundaries",
"http://ag-0988a/ArcGIS/services/StateBoundaries_WGS84_WM_102113/MapServer/WMSServer?",
//parameter
{ layers: '0',
format: 'image/png',
transparent: true
},
//options
{ visibility: true,
isBaseLayer: false,
singleTile: false,
projection : 'EPSG:102113'
}
);
...
}
</script>
</head>
<body onload="init()">
...
Good Luck
Arnd
_____
Von: Philipp Gaertner [mailto:[email protected]]
Gesendet: Mittwoch, 3. März 2010 01:56
An: Arnd Wippermann
Betreff: Re: [OpenLayers-Users] WMS from ArcGIS Server on top of google maps
-Parameter 'srs' contains unacceptable value.
Hi Arnd,
thank you for the response, unfortunately I don't know where to use or replace
your code snippet in my .js file.
The WMS I work on has the following parameters.
var boundaries = new OpenLayers.Layer.WMS( "Boundaries",
"http://ag-0988a/ArcGIS/services/StateBoundaries_WGS84_WM_102113/MapServer/WMSServer?",
{layers: '0',
//projection: 'EPSG:102113',
format:
'image/png',
transparent: true
},{
visibility: true,
isBaseLayer: false,
singleTile: false }
);
I added the projection: 'EPSG:102113' but it didn't seem to change anything.
Where would go your code? Would it replace the the whole section of var
boundaries or would it be an additional part?
I'm a little lost.
Regards, Philipp
On 3 March 2010 05:54, Arnd Wippermann <[email protected]> wrote:
Hi,
i use this code to be able to pass a different projection code to the
getFullRequestString of the Layer.WMS.
If in the options for the Layer.WMS projection is set, then it will be used
instead of the map.projection.
OpenLayers.Layer.WMS.prototype.getFullRequestString = function(newParams,altUrl)
{
try{
var projectionCode=typeof this.options.projection == 'undefined' ?
this.map.getProjection() : this.options.projection;
}catch(err){
var projectionCode=this.map.getProjection();
}
this.params.SRS = projectionCode=="none" ? null : projectionCode;
return
OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments);
}
Arnd
_____
Von: [email protected] [mailto:[email protected]] Im
Auftrag von Philipp Gaertner
Gesendet: Dienstag, 2. März 2010 03:05
An: [email protected]
Betreff: [OpenLayers-Users] WMS from ArcGIS Server on top of google maps
-Parameter 'srs' contains unacceptable value.
Hi list,
I have a layer of the states and territories of Australia and would like to
overlay it on google maps using openlayers.
The Australia layer is a WMS which is on my ArcGIS Server. I use EPSG:102113
which represents in the ESRI world the WGS_1984_Web_Mercator.
The WMS has following capabilities:
<Layer queryable="1">
<Name>0</Name>
<Title>StateBoundaries_1</Title>
<Abstract>StateBoundaries_1</Abstract>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<CRS>EPSG:102113</CRS>
−
<EX_GeographicBoundingBox>
<westBoundLongitude>0.000870</westBoundLongitude>
<eastBoundLongitude>0.001429</eastBoundLongitude>
<southBoundLatitude>-0.000393</southBoundLatitude>
<northBoundLatitude>-0.000082</northBoundLatitude>
</EX_GeographicBoundingBox>
<BoundingBox CRS="CRS:84" minx="0.000870" miny="-0.000393" maxx="0.001429"
maxy="-0.000082"/>
<BoundingBox CRS="EPSG:4326" minx="-0.000393" miny="0.000870" maxx="-0.000082"
maxy="0.001429"/>
<BoundingBox CRS="EPSG:102113" minx="96.816766" miny="-43.740510"
maxx="159.109219" maxy="-9.142176"/>
the openlayer setup looks like this
var geographic = new OpenLayers.Projection("EPSG:4326");
var mercator = new OpenLayers.Projection("EPSG:900913"); //aka EPSG:3785
var gda94 = new OpenLayers.Projection("EPSG:4283");
var world = new
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)
var mapOptions = {
projection: mercator,
displayProjection: geographic, //for Mouse Position
maxExtent: world,
restrictedExtent: world,
units: 'm',
numZoomLevels: 22,
maxResolution: 156543.0339,
controls: [new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.KeyboardDefaults()]
};
var map = new OpenLayers.Map( 'map', mapOptions );
//Google Physical
var gphy = new OpenLayers.Layer.Google("Google Physical",
{type: G_PHYSICAL_MAP,
sphericalMercator: true,
isBaseLayer: true,
numZoomLevels: 22,
maxExtent: new
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)
});
map.addLayer(gphy);
var boundaries = new OpenLayers.Layer.WMS( "Boundaries",
"http://ag-0988a/ArcGIS/services/StateBoundaries_WGS84_WM_102113/MapServer/WMSServer?",
{layers: '0',//srs: 'EPSG:102113',
format: 'image/png',
transparent: true
},{
visibility: true,
isBaseLayer: false,
singleTile: false
}
);
map.addLayer(boundaries);
The error message is Parameter 'srs' contains unacceptable value.
I know that the google layer is defined with EPSG:900913 and my WMS has
EPSG:102113, but I can't set the EPSG to 900913 because ESRI doesn't support
it.
How do I go from here, what are my options? I need to use Google as baselayer
but can reproject all WMS as I like.
Any suggestions are more than welcome.
Regards, Philipp
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users