[OpenLayers-Users] Re: WMS object

Jan Henrik Øverland janhenrik.overland at gmail.com
Mon Aug 8 06:57:47 EDT 2011


Thanks, what I learned from your comments is that it's probably a good idea
to have my WMS layers as overlays, not base layers. It seems to make things
a lot easier. Thanks again.

On Mon, Aug 8, 2011 at 12:45, Julien Cigar <jcigar at ulb.ac.be> wrote:

> Hi,
>
> Normally the only thing to do is to use an "SRS" parameter, something like:
>
> 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& <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.overland at gmail.com <mailto:janhenrik.overland@**gmail.com<janhenrik.overland at 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/<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<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
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/**mailman/listinfo/openlayers-**users<http://lists.osgeo.org/mailman/listinfo/openlayers-users>
>>
>
>
> --
> No trees were killed in the creation of this message.
> However, many electrons were terribly inconvenienced.
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110808/27d7d9e8/attachment.html


More information about the Users mailing list