Mutiple "DATA" lines in a single layer?

Stephen Woodbridge woodbri at SWOODBRIDGE.COM
Fri May 18 14:52:16 EDT 2007


Jeff Dege wrote:
> I'm starting to play around with using MapServer to serve maps from a
> PostGIS database.
> 
> One of the features that MapServer has is that you can define multiple
> classes within a single layer, so you can change the way that the map
> looks when drawn at different scales/resolutions.
> 
> Is there some way to define multiple data sources within a single layer,
> so that I can change how that data is obtained at different layers?
> 
> In particular, I'm wondering how to best take advantage of PostGIS's
> simplify() function - which can be used to reduce the number of points
> included in a geometry based on resolution.  If I'm drawing a map at a
> resolution where one pixel equals 2000 meters on the ground, there is no
> advantage to sending the viewer a geometry defined with points
> twenty-five meters apart.
> 
> The obvious way is to define multiple layers, each enabled at certain
> scales, and to include the resulution appropriate for those scales in
> the DATA keyword's sql statement.  But this requires that the layer be
> duplicated for each scale range.  Is there a way to enable different
> DATA sql statements at different scales/resolutions in a single layer
> definition?

This is the correct way yo do this in mapserver. Use multiple LAYERs

> I don't see the DATA keyword in the documentation for the CLASS section.
> Which is where I'd expect it to be if I could do what I want.
> 
> Is there a way of including a value calculated from the scale in the SQL
> statement within the LAYER section?
> 
>    DATA "simplify(the_geom, 1.0/<scale>) from streets"
> 
> Or am I stuck with using multiple layers?



More information about the mapserver-users mailing list