Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 :(

share|improve this question
    
It looks like I may end up having to do my first bounty... –  Ragi Yaser Burhum Jun 13 '11 at 21:12
    
Why not use MAX/MINGEOWIDTH instead? –  user9119 Jul 26 '12 at 2:50
add comment

1 Answer 1

up vote 0 down vote accepted

While I can't speak for others, I use Geoserver and had much the same question when I started. Unfortunately, I didn't find a particularly nice feeling solution to it either.

I used the Sld file to put in max and min zoom scales. Same as what you have mentioned as seeming hacky, just choosing 1:40500 for a display betwen level 13 and 14. For all levels I just went off your link to the table and picked something round inbetween.

It would be nicer in this situation to have a MaxLevel and MinLevel that then only renders between those levels, but I guess the scale calculations suffice for most.

share|improve this answer
    
It is what I ended up doing, too –  Ragi Yaser Burhum Oct 24 '11 at 15:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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