[mapserver-users] Re: [OpenLayers-Users] WFS Server Control output by scale?

pcreso at pcreso.com pcreso at pcreso.com
Fri Feb 6 10:52:50 PST 2009


Hi,

I have found that using PostGIS for this has some nice options. USe different zoom or scale based layers, with MINSCALE, MAXSCALE parameters.
Mapserver providing the layers via WFS, as a single group of scale dependent queries on the same table.

That way you can have one table with all the data, but the mapfile has several zoom layers applying SQL queries to redusce the data volume. One example, for what was a 150Mb shapefile of depth contours, summarised  below.

By tweaking the simplify parameter (which applies a vey fast Peuker-Douglas generalisation to each linestring) and adjusting which contours are rendered, the WFS server always sends roughly the same volume of data to the client, so performance is about the same, irrespective of scale. And the best thing is, you only use one full resolution data source. Zoomed out we don't need all the data in full precision for a large extent, zoomed in & we can display high precision data for a small extent.



zoomed out, select only some depths and simplify by 5km
  "select depth, simplify(geom,5000) as geom from contours 
   where depth = 250
      or depth = 500
      or depth = 1000
      or depth = 5000;"

zooming in, add more depth lines & reduce the simplification
   "select depth, simplify(geom, 1000) as geom from contours
    where depth = 250
       or depth = 500
       or depth = 1000
       or depth = 2500
       or depth = 5000;

zoom in further, simplify by 100 & add 100, 250, 500, 750, 1000, 2000, 3000, 4000. 5000 contours

zoomed fully: "select depth, geom from contours;"
   
Hth,

   Brent Wood



--- On Sat, 2/7/09, Alexandre Dube <adube at mapgears.com> wrote:

> From: Alexandre Dube <adube at mapgears.com>
> Subject: [mapserver-users] Re: [OpenLayers-Users] WFS Server Control output by scale?
> To: "Stephen Woodbridge" <woodbri at swoodbridge.com>
> Cc: "openlayers user list" <users at openlayers.org>, "mapserver-users" <mapserver-users at lists.osgeo.org>
> Date: Saturday, February 7, 2009, 2:49 AM
> Hi Stephen,
> 
> Like Eric said, using minScale and maxScale in your layer
> options should do what you're want to do.
> 
> I also had a similar problem trying to display vector
> polygons at small scales ( like 1:13000000 ). Here's
> what I did :
> 
> - I determined fixed scales to work with
> - I normalized my shapefile to have one per scale
> - Then you can have one Layer.WFS per data set only visible
> when at their scale OR you could use the customized
> Options-by-zoom strategy I made, see the example (1).
> 
> Best of luck,
> 
> Alexandre
> 
> (1) http://dev4.mapgears.com/bdga/options-by-zoom-bdga.html
> 
> Stephen Woodbridge wrote:
> > Hi all,
> > 
> > I'm using mapserver as a WFS server with
> OpenLayers to serve some polygons. How does one control at
> what scale mapserver will respond to WFS requests. It looks
> like OpenLayers makes its request based on a min/max
> extents. How do you control this? Can you easily limit when
> OpenLayers makes request if you are using fixed scales based
> on the scale? or control mapserver based on size/area of
> extent?
> > 
> > I'm not seeing anything in either projects
> documentation.
> > 
> > I could use a clue or pointer to docs.
> > 
> > Thanks,
> >    -Steve
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
> >   
> 
> 
> -- Alexandre Dubé
> Mapgears
> www.mapgears.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