Dave,<br><br>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.
<br><br>Check out <a href="http://trac.openlayers.org/wiki/MappingYourData">http://trac.openlayers.org/wiki/MappingYourData</a> for a nice tutorial. Make sure your watch the flash presentation. It makes it seem so simple.
<br><br>Andrew<br><br><div><span class="gmail_quote">On 5/30/07, <b class="gmail_sendername">Dave Weaver</b> <<a href="mailto:dave.weaver@zen.co.uk">dave.weaver@zen.co.uk</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I'm playing around with OpenLayers in conjuntion with MapServer.<br>What's the best way to have different levels of detail as I zoom in on my map?<br><br>At the moment I've done it like this:<br>My .map file has one layer per LOD, each using a MINSCALE/MAXSCALE directive
<br>to determine when it's visible.<br><br>But that means I have multiple named layers, so the WMS request made by<br>OpenLayers needs to request all layers.<br><br>e.g: (mapfile)<br><br> LAYER<br> NAME lod1
<br> STATUS OFF<br> TYPE RASTER<br> PROJECTION<br> "init=epsg:4326"<br> END<br> MINSCALE 75000000<br> METADATA<br> "wms_title" "lod1"<br> "wms_onlineresource"
<br>"<a href="http://example.com/cgi-bin/mapserv?map=map/earth.map&">http://example.com/cgi-bin/mapserv?map=map/earth.map&</a>"<br> "wms_srs" "EPSG:4326 EPSG:54004"<br> END
<br> TILEINDEX "lod1.shp"<br> TILEITEM "location"<br> END<br><br> LAYER<br> NAME lod2<br> STATUS OFF<br> TYPE RASTER<br> PROJECTION<br> "init=epsg:4326"
<br> END<br> MAXSCALE 74999999<br> MINSCALE 50000000<br> METADATA<br> "wms_title" "lod2"<br> "wms_onlineresource"<br>"<a href="http://example.com/cgi-bin/mapserv?map=map/earth.map&">
http://example.com/cgi-bin/mapserv?map=map/earth.map&</a>"<br> "wms_srs" "EPSG:4326 EPSG:54004"<br> END<br> TILEINDEX "lod2.shp"<br> TILEITEM "location"
<br> END<br><br> # ... etc ...<br><br>then in the OpenLayers code:<br><br> layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",<br> "<a href="http://example.com/cgi-bin/mapserv?map=map/earth2.map&">
http://example.com/cgi-bin/mapserv?map=map/earth2.map&</a>", {layers:<br>'lod1,lod2,lod3,lod4,lod5'});<br><br>Is there a better way to handle multiple LODs ?<br><br>Many thanks,<br>Dave.<br></blockquote></div>
<br>