AW: [OpenLayers-Users] What's wrong with my OSM + MapServer layers?

Arnd Wippermann arnd.wippermann at web.de
Wed Feb 8 12:16:02 EST 2012


You have to set the correct maxExtent for your spericalMercator map

var bounds4326   = new OpenLayers.Bounds(14.840581, 39.863640, 17.361026,
41.171027);
var bounds900913 = bounds4326.transform(new
OpenLayers.Projection("EPSG:4326"), new
OpenLayers.Projection(map.projection));

map = new OpenLayers.Map( 'map', {
        controls:[ 
            new OpenLayers.Control.Navigation(),
            new OpenLayers.Control.PanZoomBar(),
            new OpenLayers.Control.ScaleLine(),
            new OpenLayers.Control.Permalink('permalink'),
            new OpenLayers.Control.MousePosition(),                    
            new OpenLayers.Control.Attribution()
        ],
        maxExtent: bounds900913,
        maxResolution: 156543.0399,
        numZoomLevels: 19,
        units: 'm',
        projection: new OpenLayers.Projection("EPSG:900913"),
        displayProjection: new OpenLayers.Projection("EPSG:4326")
    } 
);

Arnd
 

-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Andrea.Z
Gesendet: Mittwoch, 8. Februar 2012 17:02
An: openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] What's wrong with my OSM + MapServer layers?

Hi everybody.

I'm trying to set up a map with the Open Streets background, on which I
would like to add some layers I created in a MapFile. I can easily create
the OSM background; I am also able to display, in a separate map, my
MapServer's layer his correct reference system, the WGS84 (EPSG: 4236).
But, when I try to merge the two layers in the same map, I'm not able to see
the overlay, the MapServer's layer. I read a lot about the OSM projection,
and I found how should I write my map, but there is no way to make it work.
As long as I am new at using OpenLayers, probably I am doing something
wrong; but I really cannot understand what, and I am not able to find the
solution on the web.

Here it is my map's html:



I will be grateful to anyone who will try to help me. 

--
View this message in context:
http://osgeo-org.1560.n6.nabble.com/What-s-wrong-with-my-OSM-MapServer-layer
s-tp4376400p4376400.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list