Multiple Levels-Of-Detail

percy percyd at PDX.EDU
Thu May 31 14:03:40 EDT 2007


I think what you're really after here is that you only want to request 
one named layer, and you want mapserver to return whichever level of 
detail is appropriate for the current scale.

The way I do this is just to give all the layers in a "detail set"
the SAME NAME. Try it, it's like magic :-)
Percy

Andrew Wooley wrote:
> Dave,
> 
> I am not an OpenLayers expert by any means, but as of the 2.4 release 
> (at least), now with RC5, you can add a Mapserver Layer directly. This 
> honors the scale dependencies you have set up in your mapfile and you 
> can have your LOD.
> 
> Check out http://trac.openlayers.org/wiki/MappingYourData for a nice 
> tutorial. Make sure your watch the flash presentation. It makes it seem 
> so simple.
> 
> Andrew
> 
> On 5/30/07, *Dave Weaver* <dave.weaver at zen.co.uk 
> <mailto:dave.weaver at zen.co.uk>> wrote:
> 
>     I'm playing around with OpenLayers in conjuntion with MapServer.
>     What's the best way to have different levels of detail as I zoom in
>     on my map?
> 
>     At the moment I've done it like this:
>     My .map file has one layer per LOD, each using a MINSCALE/MAXSCALE
>     directive
>     to determine when it's visible.
> 
>     But that means I have multiple named layers, so the WMS request made by
>     OpenLayers needs to request all layers.
> 
>     e.g: (mapfile)
> 
>       LAYER
>         NAME         lod1
>         STATUS       OFF
>         TYPE         RASTER
>         PROJECTION
>           "init=epsg:4326"
>         END
>         MINSCALE 75000000
>         METADATA
>             "wms_title"     "lod1"
>             "wms_onlineresource"
>     "http://example.com/cgi-bin/mapserv?map=map/earth.map&
>     <http://example.com/cgi-bin/mapserv?map=map/earth.map&>"
>             "wms_srs"       "EPSG:4326 EPSG:54004"
>         END
>         TILEINDEX  "lod1.shp"
>         TILEITEM   "location"
>       END
> 
>       LAYER
>         NAME         lod2
>         STATUS       OFF
>         TYPE         RASTER
>         PROJECTION
>           "init=epsg:4326"
>         END
>         MAXSCALE 74999999
>         MINSCALE 50000000
>         METADATA
>             "wms_title"     "lod2"
>             "wms_onlineresource"
>     " http://example.com/cgi-bin/mapserv?map=map/earth.map&
>     <http://example.com/cgi-bin/mapserv?map=map/earth.map&>"
>             "wms_srs"       "EPSG:4326 EPSG:54004"
>         END
>         TILEINDEX  "lod2.shp"
>         TILEITEM   "location"
>       END
> 
>       # ... etc ...
> 
>     then in the OpenLayers code:
> 
>       layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
>                     "
>     http://example.com/cgi-bin/mapserv?map=map/earth2.map&
>     <http://example.com/cgi-bin/mapserv?map=map/earth2.map&>", {layers:
>     'lod1,lod2,lod3,lod4,lod5'});
> 
>     Is there a better way to handle multiple LODs ?
> 
>     Many thanks,
>     Dave.
> 
> 

-- 
David Percy
Geospatial Data Manager
Geology Department
Portland State University
http://gisgeek.pdx.edu
503-725-3373



More information about the mapserver-users mailing list