3

I set up a MapServer (WMS) with a raster basemap like this (Mapfile):

MAP
  PROJECTION
   "init=epsg:900913"
  END
  WEB
    METADATA
      "wms_title" "mymap"
      "wms_srs" "epsg:900913"
    END
  END
  LAYER
    METADATA
      "wms_title" "myraster"
      "wms_srs" "epsg:900913"
      "wms_enable_request" "*"
    END
    PROJECTION
     "init=epsg:900913"
    END
    NAME         myraster
    DATA         "/path/to/myraster.tif"
    STATUS       ON
    TYPE         RASTER
    PROCESSING   "BANDS=1,2,3"
    OFFSITE      0 0 0
  END 
END

Now I display this map with OpenLayers:

var mylayer = new OpenLayers.Layer.WMS( "My Map", "http://127.0.0.1/cgi-bin/mapserv?map=/path/to/mymapfile.map", {layers:'myraster'} );

That works fine so far. However, there seems to be a limit of 16 zoom levels and I would like to be able to zoom in deeper than that. I tried to add the option numZoomLevels:22 but that did not have any effect. My raster image should be large enough - opened in an image viewer the resolution is much higher than displayed with OpenLayers (I also tried using a larger raster image). Is there a way to enhance the maximum number of zoom levels?

EDIT - added OpenLayers code:

var wgs84 = new OpenLayers.Projection("EPSG:4326");
var sphericalMercator = new OpenLayers.Projection("EPSG:900913");

map = new OpenLayers.Map( 'map', { projection: sphericalMercator });

layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
        "http://127.0.0.1/cgi-bin/mapserv?map=/path/to/mapfile.map",
        { layers: 'myraster' } );

map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(7.7, 48).transform(wgs84,sphericalMercator), 13);
1

16 is the default for maxZoomLevel, but you can set it in a range of ways. A good (extensive if sometimes dense) description is provided at http://trac.osgeo.org/openlayers/wiki/SettingZoomLevels

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.