I have a whole bunch of data in my db that I need to draw at different zoom levels using Mapserver. Everything uses a 4326 SRID. My (custom) client, will fetch the data using 20 TMS zoom levels and images of 256x256 pixels.
In fact, for every zoom level, these are the units-per-pixel that every zoom level uses:
<TileMap version="1.0.0" tilemapservice="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/">
<!-- Additional data: tms_type is default -->
<Title>myimagery</Title>
<Abstract/>
<SRS>EPSG:4326</SRS>
<BoundingBox minx="-180.000000" miny="-90.000000" maxx="180.000000" maxy="90.000000"/>
<Origin x="-180.000000" y="-90.000000"/>
<TileFormat width="256" height="256" mime-type="image/png" extension="png"/>
<TileSets>
<TileSet href="http://myserver.com/1.0.0/myimagery/0" units-per-pixel="0.70312500000000000000" order="0"/>
<TileSet href="http://myserver.com/1.0.0/myimagery/1" units-per-pixel="0.35156250000000000000" order="1"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/2" units-per-pixel="0.17578125000000000000" order="2"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/3" units-per-pixel="0.08789062500000000000" order="3"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/4" units-per-pixel="0.04394531250000000000" order="4"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/5" units-per-pixel="0.02197265625000000000" order="5"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/6" units-per-pixel="0.01098632812500000000" order="6"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/7" units-per-pixel="0.00549316406250000000" order="7"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/8" units-per-pixel="0.00274658203125000000" order="8"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/9" units-per-pixel="0.00137329101562500000" order="9"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/10" units-per-pixel="0.00068664550781250000" order="10"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/11" units-per-pixel="0.00034332275390625000" order="11"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/12" units-per-pixel="0.00017166137695312500" order="12"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/13" units-per-pixel="0.00008583068847656250" order="13"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/14" units-per-pixel="0.00004291534423828125" order="14"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/15" units-per-pixel="0.00002145767211914062" order="15"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/16" units-per-pixel="0.00001072883605957031" order="16"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/17" units-per-pixel="0.00000536441802978516" order="17"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/18" units-per-pixel="0.00000268220901489258" order="18"/>
<TileSet href="http://myserver.com/cgi-bin/tilecache.cgi/1.0.0/myimagery/19" units-per-pixel="0.00000134110450744629" order="19"/>
</TileSets>
</TileMap>
I am aware that, depending on the projection I use, true scale changes differently. Some people have even produced scale tables for WGS84 at different latitudes for 72DPI output, which is very helpful to answer this question... so the question is:
How are people dealing with this problem when they want to guarantee that some data is only drawn at a particular zoom level? This seems like such a basic question, but I am honestly curious. I guess I could arbitrarily pick MAXSCALEDENOM and MINSCALEDENOM scale values that are half way between the zoom levels.
So using the table above, to guarantee that something should draw on level 13, but not level 14, I could say 1:40500, or * MAXSCALEDENOM 40500*. Is this right? It seems hacky :(