[mapserver-users] Re: multiple map layers with different scales

Lime, Steve D (DNR) Steve.Lime at state.mn.us
Wed Jul 21 05:28:21 PDT 2010


In mode=tile it's not that MapServer is working on predefined scales, rather pre-defined resolutions (cellsize). So at a particular
zoom level the UL corner coordinate of any tile is known based on the chosen scheme (Google, Bing, etc...) and so is the size, and
from that you can compute a map extent. That's what MapServer needs. From there we compute a scale value to use in setting
layer visibility.

So, in your case you probably can do the same thing, just pass extents associated with each tile to MapServer and keep it simple.
Sounds like the missing piece is for you is associating a scale with each tile level so you can set layers appropriately. You can 
either compute that by hand via the formulas in MapServer or you can use a template and have MapServer spit it out for you
given a sample tile URL at each level.

For example, if you add this to your web object in your mapfile:

  WEB
    ...
    TEMPLATE 'showscale.html'
  END

and then create a template called showscale.html:

  <!-- MapServer Template -->
  map extent: [mapext]
  computed scale: [scale]

and then call it with a URL like:

  http://yourserver/cgi-bin/mapserv?map=yourmap&mapext=minx+miny+maxx+maxy

You should get the scale associated with that extent (and tile level). You'd do this for each zoom level and then go to town in
your mapfile. There is another alternative to MINSCALEDENOM/MAXSCALEDENOM that uses the dx/xy from a map extent. I
believe the parameters are MINGEOWIDTH and MAXGEOWIDTH which mirror the MapInfo way of doing this.  They essentially
represent resolution and take the display device resolution out of it (a good thing). They were added in 5.6 but have yet to be 
added to the docs (there's a ticket)...

Steve

________________________________________
From: mapserver-users-bounces at lists.osgeo.org [mapserver-users-bounces at lists.osgeo.org] On Behalf Of easyl [thlin.box at gmail.com]
Sent: Wednesday, July 21, 2010 2:53 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] Re: multiple map layers with different scales

hmmmm..... I am almost giving up....

What I would like to do is getting a map image from a given extent and a
given scale value.
I would combine each retrieved map images as tiles but without mode=tile.
On my Mapserver there are different map layers having different detail
according to scale values.

In mode=tile it seems that Mapserver automatically calculates map scale
value and selects the suitable layers to show. I just want to do the same
thing but in mode=map.

The implementation of map retrieval behind Mapserver should be the same or
similar.
Why is it so difficult to do the similar thing from two different modes?

Thanks:)

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/multiple-map-layers-with-different-scales-tp5292120p5320026.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the MapServer-users mailing list