Ah!<br>Indeed, I already thought the solution would be trivial! Thanks, this solved my problem.<br><br>As I am new to OpenLayers, I started off here:<br><a href="http://docs.openlayers.org/">http://docs.openlayers.org/</a><br>
<br>Too bad I couldn't find any hints on OL's defaulting when it comes to projection, units, extents etc. In fact, I expect many newbies wanting to deviate from the default EPSG:4326...<br><br>May I suggest to insert the below lines of code on this page: <a href="http://docs.openlayers.org/library/introduction.html">http://docs.openlayers.org/library/introduction.html</a><br>
<span><font color="#0000ff" face="Arial" size="2"> //set always mapOptions, if you use a
projection other than EPSG:4326<br> mapOptions =
{<div class="im"><br> projection: new
OpenLayers.Projection("EPSG:28992"),<br></div>
units: "m",<br> numZoomLevels:
18,<br> maxResolution:
5,<br> maxExtent: new
OpenLayers.Bounds(131110,447700,131830,448310)<br>
};<br> map = new OpenLayers.Map('map',
mapOptions);</font></span><br><br>Ciao,<br>Rob<br><br><div class="gmail_quote">2011/4/22 Arnd Wippermann <span dir="ltr"><<a href="mailto:arnd.wippermann@web.de">arnd.wippermann@web.de</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">hi,</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">if you declare your map without options, then OL takes the
default (see Map.js):</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"> projection: "EPSG:4326",
<br> units: 'degrees',<br> maxResolution:
1.40625,<br> maxExtent: new
OpenLayers.Bounds(-180,-90,180,90),<br></font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">But it seems, when you declare a projection in your baselayer,
then this projection overwrites the map projection and is used for the SRS
parameter of the WMS request. But the maxExtent are still the default
ones.</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">You should use map options to overwrite the
default.</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"> //set always mapOptions, if you use a
projection other than EPSG:4326<br> mapOptions =
{<div class="im"><br> projection: new
OpenLayers.Projection("EPSG:28992"),<br></div>
units: "m",<br> numZoomLevels:
18,<br> maxResolution:
5,<br> maxExtent: new
OpenLayers.Bounds(131110,447700,131830,448310)<br>
};<br> map = new OpenLayers.Map('map',
mapOptions);<br></font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Arnd</font></span></div>
<div dir="ltr" align="left"><span></span> </div>
<div dir="ltr" align="left">
<hr>
</div>
<div dir="ltr" align="left"><font face="Tahoma" size="2"><b>Von:</b>
<a href="mailto:openlayers-users-bounces@lists.osgeo.org" target="_blank">openlayers-users-bounces@lists.osgeo.org</a>
[mailto:<a href="mailto:openlayers-users-bounces@lists.osgeo.org" target="_blank">openlayers-users-bounces@lists.osgeo.org</a>] <b>Im Auftrag von
</b>InterRob<br><b>Gesendet:</b> Donnerstag, 21. April 2011 23:37<br><b>An:</b>
<a href="mailto:openlayers-users@lists.osgeo.org" target="_blank">openlayers-users@lists.osgeo.org</a><br><b>Betreff:</b> [OpenLayers-Users]
WMS-layer: BBOX and SRS not being detected<br></font><br></div><div><div></div><div class="h5">
<div></div>Dear list,
<div><br></div>
<div>Today I set up a MapServer WMS service. The service seems to work just
fine, as I tested it with QGIS. Even the SRS is recognized automatically:
EPSG:28992 (Dutch CS).</div>
<div>At the bottom of this message, I copy/pasted the
GetCapabilites-response.</div>
<div><br></div>
<div>The bit of JavaScript used to load the OpenLayers control + map + layer, is
classical:</div>
<div><br></div>
<div>============</div>
<div>
<div><br></div>
<div> var map, layer;</div>
<div> function init(){</div>
<div> map = new OpenLayers.Map( 'map' );</div>
<div> layer = new OpenLayers.Layer.WMS( "OpenLayers
WMS", "<a href="http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&" target="_blank">http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&</a>",
{ layers : 'pgn_verwachting' }, { units : 'm', projection : new
OpenLayers.Projection("EPSG:28992"), singleTile : true, buffer :
0, ratio : 1 } );</div></div>
<div><br></div>
<div>============</div>
<div><br></div>
<div>In my browser, OpenLayers does load nicely (zoom and pan tools become
available in the upper right corner of an empty map-div) and then does the
following GET to fetch that single tile:</div>
<div><a href="http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&LAYERS=pgn_verwachting&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fjpeg&SRS=EPSG%3A28992&BBOX=-281.25,-210.9375,281.25,210.9375&WIDTH=800&HEIGHT=600" target="_blank">http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&LAYERS=pgn_verwachting&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fjpeg&SRS=EPSG%3A28992&BBOX=-281.25,-210.9375,281.25,210.9375&WIDTH=800&HEIGHT=600</a></div>
<div><br></div>
<div>I don't see how I can get the BBOX parameter right... What am I missing?
When I edit the above URL, it works just fine, obviously...</div>
<div><br></div>
<div>And shouldn't the SRS be detected automatically as well?</div>
<div><br></div>
<div>Hints are much appreciated!</div>
<div><br></div>
<div>Kind regards,</div>
<div><br></div>
<div><br></div>
<div>Rob</div>
<div><br></div>
<div><br></div>
<div><br></div>
<div>=============== GetCapabilities response ======================</div>
<div><?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?></div>
<div>
<div><!DOCTYPE WMT_MS_Capabilities SYSTEM "<a href="http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd" target="_blank">http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd</a>"</div>
<div> [</div>
<div> <!ELEMENT VendorSpecificCapabilities EMPTY></div>
<div> ]> <!-- end of DOCTYPE declaration --></div>
<div><br></div>
<div><WMT_MS_Capabilities version="1.1.1"></div>
<div><br></div>
<div><!-- MapServer version 5.6.6 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG
OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE
SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER
SUPPORTS=WFS_CLIENT SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS INPUT=EPPL7
INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE --></div>
<div><br></div>
<div><Service></div>
<div> <Name>OGC:WMS</Name></div>
<div> <Title>Beleidskaart_Binnenstad</Title></div>
<div> <OnlineResource xmlns:xlink="<a href="http://www.w3.org/1999/xlink" target="_blank">http://www.w3.org/1999/xlink</a>"
xlink:href="<a href="http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp" target="_blank">http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp</a>;"/></div>
<div> <ContactInformation></div>
<div> </ContactInformation></div>
<div></Service></div>
<div><br></div>
<div><Capability></div>
<div> <Request></div>
<div> <GetCapabilities></div>
<div>
<Format>application/vnd.ogc.wms_xml</Format></div>
<div> <DCPType></div>
<div> <HTTP></div>
<div> <Get><OnlineResource
xmlns:xlink="<a href="http://www.w3.org/1999/xlink" target="_blank">http://www.w3.org/1999/xlink</a>"
xlink:href="<a href="http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp" target="_blank">http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp</a>;"/></Get></div>
<div> <Post><OnlineResource
xmlns:xlink="<a href="http://www.w3.org/1999/xlink" target="_blank">http://www.w3.org/1999/xlink</a>"
xlink:href="<a href="http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp" target="_blank">http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp</a>;"/></Post></div>
<div> </HTTP></div>
<div> </DCPType></div>
<div> </GetCapabilities></div>
<div> <GetMap></div>
<div> <Format>image/gif</Format></div>
<div> <Format>image/png</Format></div>
<div> <Format>image/png;
mode=24bit</Format></div>
<div> <Format>image/jpeg</Format></div>
<div>
<Format>image/vnd.wap.wbmp</Format></div>
<div> <Format>image/tiff</Format></div>
<div> <Format>image/svg+xml</Format></div>
<div> <DCPType></div>
<div> <HTTP></div>
<div> <Get><OnlineResource
xmlns:xlink="<a href="http://www.w3.org/1999/xlink" target="_blank">http://www.w3.org/1999/xlink</a>"
xlink:href="<a href="http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp" target="_blank">http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp</a>;"/></Get></div>
<div> <Post><OnlineResource
xmlns:xlink="<a href="http://www.w3.org/1999/xlink" target="_blank">http://www.w3.org/1999/xlink</a>"
xlink:href="<a href="http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp" target="_blank">http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp</a>;"/></Post></div>
<div> </HTTP></div>
<div> </DCPType></div>
<div> </GetMap></div>
<div> <GetFeatureInfo></div>
<div> <Format>text/plain</Format></div>
<div>
<Format>application/vnd.ogc.gml</Format></div>
<div> <DCPType></div>
<div> <HTTP></div>
<div> <Get><OnlineResource
xmlns:xlink="<a href="http://www.w3.org/1999/xlink" target="_blank">http://www.w3.org/1999/xlink</a>"
xlink:href="<a href="http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp" target="_blank">http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp</a>;"/></Get></div>
<div> <Post><OnlineResource
xmlns:xlink="<a href="http://www.w3.org/1999/xlink" target="_blank">http://www.w3.org/1999/xlink</a>"
xlink:href="<a href="http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp" target="_blank">http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp</a>;"/></Post></div>
<div> </HTTP></div>
<div> </DCPType></div>
<div> </GetFeatureInfo></div>
<div> <DescribeLayer></div>
<div> <Format>text/xml</Format></div>
<div> <DCPType></div>
<div> <HTTP></div>
<div> <Get><OnlineResource
xmlns:xlink="<a href="http://www.w3.org/1999/xlink" target="_blank">http://www.w3.org/1999/xlink</a>"
xlink:href="<a href="http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp" target="_blank">http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp</a>;"/></Get></div>
<div> <Post><OnlineResource
xmlns:xlink="<a href="http://www.w3.org/1999/xlink" target="_blank">http://www.w3.org/1999/xlink</a>"
xlink:href="<a href="http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp" target="_blank">http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp</a>;"/></Post></div>
<div> </HTTP></div>
<div> </DCPType></div>
<div> </DescribeLayer></div>
<div> <GetLegendGraphic></div>
<div> <Format>image/gif</Format></div>
<div> <Format>image/png</Format></div>
<div> <Format>image/png;
mode=24bit</Format></div>
<div> <Format>image/jpeg</Format></div>
<div>
<Format>image/vnd.wap.wbmp</Format></div>
<div> <DCPType></div>
<div> <HTTP></div>
<div> <Get><OnlineResource
xmlns:xlink="<a href="http://www.w3.org/1999/xlink" target="_blank">http://www.w3.org/1999/xlink</a>"
xlink:href="<a href="http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp" target="_blank">http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp</a>;"/></Get></div>
<div> <Post><OnlineResource
xmlns:xlink="<a href="http://www.w3.org/1999/xlink" target="_blank">http://www.w3.org/1999/xlink</a>"
xlink:href="<a href="http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp" target="_blank">http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp</a>;"/></Post></div>
<div> </HTTP></div>
<div> </DCPType></div>
<div> </GetLegendGraphic></div>
<div> <GetStyles></div>
<div> <Format>text/xml</Format></div>
<div> <DCPType></div>
<div> <HTTP></div>
<div> <Get><OnlineResource
xmlns:xlink="<a href="http://www.w3.org/1999/xlink" target="_blank">http://www.w3.org/1999/xlink</a>"
xlink:href="<a href="http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp" target="_blank">http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp</a>;"/></Get></div>
<div> <Post><OnlineResource
xmlns:xlink="<a href="http://www.w3.org/1999/xlink" target="_blank">http://www.w3.org/1999/xlink</a>"
xlink:href="<a href="http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp" target="_blank">http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp</a>;"/></Post></div>
<div> </HTTP></div>
<div> </DCPType></div>
<div> </GetStyles></div>
<div> </Request></div>
<div> <Exception></div>
<div>
<Format>application/vnd.ogc.se_xml</Format></div>
<div>
<Format>application/vnd.ogc.se_inimage</Format></div>
<div>
<Format>application/vnd.ogc.se_blank</Format></div>
<div> </Exception></div>
<div> <VendorSpecificCapabilities /></div>
<div> <UserDefinedSymbolization SupportSLD="1" UserLayer="0"
UserStyle="1" RemoteWFS="0"/></div>
<div> <Layer></div>
<div> <Name>Beleidskaart_Binnenstad</Name></div>
<div> <Title>Beleidskaart_Binnenstad</Title></div>
<div>
<Abstract>Beleidskaart_Binnenstad</Abstract></div>
<div> <SRS>EPSG:28992</SRS></div>
<div> <LatLonBoundingBox minx="5.03953" miny="52.0181"
maxx="5.05006" maxy="52.0236" /></div>
<div> <BoundingBox SRS="EPSG:28992"</div>
<div> minx="131110"
miny="447700" maxx="131830" maxy="448310" /></div>
<div> <Layer queryable="0" opaque="0"
cascaded="0"></div>
<div>
<Name>pgn_verwachting</Name></div>
<div>
<Title>pgn_verwachting</Title></div>
<div> <LatLonBoundingBox minx="5.04025"
miny="52.0182" maxx="5.04993" maxy="52.0236" /></div>
<div> <BoundingBox SRS="EPSG:28992"</div>
<div>
minx="131160" miny="447707" maxx="131821" maxy="448305" /></div>
<div> <Style></div>
<div>
<Name>default</Name></div>
<div>
<Title>default</Title></div>
<div> <LegendURL width="147"
height="41"></div>
<div>
<Format>image/png</Format></div>
<div> <OnlineResource
xmlns:xlink="<a href="http://www.w3.org/1999/xlink" target="_blank">http://www.w3.org/1999/xlink</a>"
xlink:type="simple" xlink:href="<a href="http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&version=1.1.1&service=WMS&request=GetLegendGraphic&layer=pgn_verwachting&format=image/png&STYLE=default" target="_blank">http://localhost/mapserv?map=/var/www/geo/binnenstad_wms.map&amp;version=1.1.1&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=pgn_verwachting&amp;format=image/png&amp;STYLE=default</a>"/></div>
<div> </LegendURL></div>
<div> </Style></div>
<div> </Layer></div>
<div> </Layer></div>
<div></Capability></div>
<div></WMT_MS_Capabilities></div></div>
<div><br></div></div></div></div>
</blockquote></div><br>