[OpenLayers-Users] Layer.WMS trying to request a WMS in 3785

David Fawcett david.fawcett at gmail.com
Fri Jan 8 23:27:27 EST 2010


I have a basic OpenLayers WMS app that requests tiles in the native
SRS of the WMS.  It works as expected.

I modified the app to request the WMS data in epsg 3785, but haven't
gotten it right yet.  I am pretty sure that it has something to do
with the projection configuration.

The URL generated for a tile is:
http://localhost/cgi-bin/mapserv?map=/Users/david/backendmaps/brazildemo/brazilwms.map&LAYERS=brazil_test&SPHERICALMERCATOR=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fjpeg&SRS=EPSG%3A3785&BBOX=-8348929.4958667,-1.862645149231e-9,-2135772.6617333,6213156.8341333&WIDTH=256&HEIGHT=256

If I grab the bounds from the maxExtent in my html file and use this
as the bbox values in the URL, I get one tile with the full extent of
the image layer.  The bounds values in the html file are in epsg 3785
and are the full extent of the WMS layer.

Can anyone suggest the way to get the correct bbox for a tile request?

Thanks,

David.



<script type="text/javascript">
     	

        var map;
        window.onload = function(){
        var bounds = new OpenLayers.Bounds(-5301803.86 -1993904.02
-5287472.71 -1978905.74);

        map = new OpenLayers.Map( 'map', {maxExtent: bounds,
                                          numZoomLevels: 18,
                                          maxResolution: "auto",
                                          units: "m",
                                          projection: new
OpenLayers.Projection("EPSG:3785")     });

            var layer = new OpenLayers.Layer.WMS( "Brazil Demo",

"http://localhost/cgi-bin/mapserv?map=/Users/david/backendmaps/brazildemo/brazilwms.map",
                    {layers: 'brazil_test', sphericalMercator: true});
            map.addLayer(layer);
            map.zoomToMaxExtent();

        }
    </script>



More information about the Users mailing list