On Aug 8, 2011, at 12:45 , Julien Cigar wrote: > Hi, > > Normally the only thing to do is to use an "SRS" parameter, something like:
This is a common pitfall when using OpenLayers. The SRS parameter will be ignored. Always. Instead, WMS layers will be requested in the SRS used by your base layer. Andreas. > > var layer = new OpenLayers.Layer.WMS( > 'YOUR_LAYER_NAME', "http://YOUR_WMS_SERVER', { > layers: 'YOUR_LAYER', > transparent: true, > format: 'image/png', > SRS: 'EPSG:3857', > SLD: 'http://YOUR_SLD_ADDRESS' > }, { > isBaseLayer: false, > singleTile: true, > opacity: 0.8, > visibility: false > } > ) > > I don't know which WMS server you use, but if it's Mapserver don't forget to > add the supported projections in the WEB METADATA section, something like > "wms_srs" "EPSG:4326 EPSG:3857", otherwise it will not work. > > For example: > WEB > IMAGEPATH "/tmp/" > IMAGEURL "/tmp/" > > METADATA > "ows_enable_request" "*" > > ####### > # WMS # > ####### > > "wms_title" "my WMS server" > "wms_onlineresource" > "http://my/wms/address?map=/path/to/mapfile.map&" > "wms_srs" "EPSG:4326 EPSG:3857" > END > END > > Julien > > On 08/08/2011 12:26, Jan Henrik Øverland wrote: >> How do I request a specific SRS when creating a wms layer? >> >> >> On Fri, Aug 5, 2011 at 14:22, Jan Henrik Øverland >> <janhenrik.overl...@gmail.com <mailto:janhenrik.overl...@gmail.com>> wrote: >> >> Hi, my map is EPSG:900913 and running Google Maps nicely. The >> following WMS feed is served both as EPSG:4326 and EPSG:900913 (have >> a look at the WMS link in the table): >> >> >> http://iridl.ldeo.columbia.edu/SOURCES/.USGS/.LandDAAC/.MODIS/.1km/.8day/.version_005/.Aqua/.EAF/.Night/.LST/X+Y+fig-+colors+coasts+-fig+//LST/255./330./plotrange//T/3118./plotvalue/Y/1.5405659E-04/39.99557/plotrange//plotborder+72+psdef//plotaxislength+432+psdef//XOVY+null+psdef/ >> >> When I do this: >> >> var wms = new OpenLayers.Layer.WMS( >> "IRI", >> >> "http://iridl.ldeo.columbia.edu/SOURCES/.USGS/.LandDAAC/.MODIS/.1km/.8day/.version_005/.Aqua/.EAF/.Night/.LST/X+Y+fig-+colors+coasts+-fig+//LST/255./330./plotrange//T/3118./plotvalue/Y/1.5405659E-04/39.99557/plotrange//plotborder+72+psdef//plotaxislength+432+psdef//XOVY+null+psdef/wms.xml", >> { >> layers: "USGS LandDAAC MODIS 1km 8day version_005 Aqua EAF >> Night LST", >> } >> ); >> >> ..I get a 4326 base layer. But I want it to work with my 900913 map >> so I add to the params object: >> >> { >> layers: "USGS LandDAAC MODIS 1km 8day version_005 Aqua EAF >> Night LST", >> srs: "EPSG:900913", >> bbox: "-2000000,1,6900000,4400000" >> } >> >> but it does not work. The getFullRequestString() returns a string >> with the correct BBOX, but the SRS it still 4326. >> >> To me it looks like only the first tile has 900913 and the rest >> (twenty-something) have 4326. What am I doing wrong? >> >> Jan >> >> >> >> >> _______________________________________________ >> Users mailing list >> us...@lists.osgeo.org >> http://lists.osgeo.org/mailman/listinfo/openlayers-users > > > -- > No trees were killed in the creation of this message. > However, many electrons were terribly inconvenienced. > <jcigar.vcf>_______________________________________________ > Users mailing list > us...@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/openlayers-users -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers. _______________________________________________ Users mailing list us...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/openlayers-users