optimization

percy percyd at PDX.EDU
Tue Dec 5 16:38:50 EST 2006


One of the tricks I've used to get maps to render quickly at very zoomed 
out levels is to generate simplified versions of my shapefiles, and then 
use maxscale/minscale  settings at the layer level to turn on/off 
simplified/detailed versions as the user zooms in.

PostGIS is nice for this, a simple call like this will generate a 
simplified (one vertex every 1000 map units, feet in this case) shapefile:
pgsql2shp -f simplegeotech {your connection info here}"select 
simplify(the_geom, 1000) as the_geom, lith_gen_u from geotech"
The quotes around the SQL statement are required!

You can see this in action at this site: 
http://geospatial.research.pdx.edu/ogdc/
Notice when you are zoomed out to the entire state if you look REALLY 
close you can see sharp corners like stained glass. This is pulling from 
a database of over 70,000 polygons, and this one trick took me from load 
times in the 30-40 second range down to 4 seconds.

Hope this helps,
Percy

boice tomlin wrote:
> Hello users,
>
> The map located here;
>
> http://gisinventory.net/status_maps.html
>
> takes a while to load.  At least at the national view where there is a 
> lot of area to render.
>
> I am looking for alternative ways to generate the map that will 
> significantly improve performance.
>
> Currently I am using php and looping through data and turning on 
> layers as I go.  The PHP part is lightning fast.  But after I get the 
> map ready mapserver takes several seconds to generate it.
>
> I'm curious about alternative ways to handle this problem and wonder 
> if anyone had comments on any of them.
>
> 1) modifying the shape files in some way so the layer information is 
> in those files.
> 2) using a db such as postgres with postgis.
>
-- 
David Percy
Geospatial Data Manager
Geology Department
Portland State University
http://gisgeek.pdx.edu
503-725-3373



More information about the mapserver-users mailing list