optimization

Stephen Woodbridge woodbri at SWOODBRIDGE.COM
Tue Dec 5 16:38:56 EST 2006


boice tomlin wrote:
> 
> Thanks Steve,
> 
> I have created the qix files which didn't make much/any difference for me.
> 
> I will rebuild with the debug option.  great tip.
> 
> As for optimizing slow layers;  I don't display labels at larger extents 
> so that isn't a problem.  And I make sure those layers are off.
> 
> I'm not sure what you mean by raster layer.  I'm guessing that if I am 
> drawing a state and coloring it green then that is a raster layer.  
> Correct?  This seems to be where I'm having my performance issue.

raster layers are layer that are serving raster data ie: satellite 
imagery or similar stuff. If you data is all from shapefiles then you 
don't have raster layers.

> If I draw the entire country and don't color in any states, counties or 
> cities then the map draws in tenths of a second.  As I go across the 
> country and color in all the geographies of interest I slow 
> proportionate to the amount of states, counties and cities that I color 
> in.  When viewing at a smaller extent it isn't much of an issue.  But 
> for larger extents it can take 7 or 8 seconds.  As use of the system 
> grows this could become even worse.

coloring polygons takes a little effort but should not be a big slow 
down in and of itself. The real issue is more likely that you are trying 
to display counties when you are at a scale to display the whole US. 
This means you are drawing 3300 polygons and filling each and every one 
of them. At a scale of about 1:200M there is probably little value to do 
that except to show that you can do it. You might want to create some 
static image files if you need to do that. otherwise turn off layers as 
you zoom out.

> I thought I must be doing something horribly wrong in terms of my method 
> of rendering the data.
> 
> Is this still a question for Frank Warmerdam or Ed McNierney?

probably not is you are only using shapefile data. But if the see this 
post they might have something to add, so you need to make sure that you 
cc the list on responses so everyone will benefit or can contribute to 
the thread.

-Steve

> thanks,
> 
> boice
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On Dec 5, 2006, at 1:46 PM, Stephen Woodbridge wrote:
> 
>> boice,
>>
>> The standard things to do are:
>>
>> 1) make sure all you shapefiles have *.qix file
>>    find /path/to/data -name "*.shp" -exec shptree {} \;
>>    should for that.
>>
>> 2) build mapserver with the debug option in ./configure
>>    then add DEBUG TRUE to the map section of you mapfile
>>    then render you map and look in /var/log/apache/error.log
>>    and you will fine information about how long it takes each layer
>>    to render. do this at the various scales you use.
>>    if you have huge shapefiles and you are only rendering parts of them
>>    then consider using shape2tile to break the data into tiles.
>>
>> 3) optimize the slow layers
>>    a) reduce the amount of data you are displaying
>>       maybe turn off that layer at that scale
>>       create a generalize version of that layer for that scale
>>    b) reduce the number of labels if you label cache time is large
>>       turn off some of the labels you are drawing at that scale
>>
>> 4) if it is a raster layer that is slow, then post a message asking
>>    Frank Warmerdam or Ed McNierney for suggestions on how to improve
>>    your reaster performance
>>
>> 5) if I haven't covered it here or you are sure what to do about a 
>> specific performance issue, post a more specific question.
>>
>> 6) oh yeah, if you are using shapefiles and have problems rendering 
>> data mvoing to postgres will generally not help you.
>>
>> -Steve W
>>
>> 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.
>>> Right now I have to generate a bunch of dynamic classes in PHP using 
>>> the general method below.
>>> $lyr = $this->ramona_map->getLayerByName("state_yes");
>>>                 $cla = $lyr->getClass(0);
>>>                 $cla->setExpression("/".$expression."/");
>>>                 $lyr->set("status", MS_ON);
>>> I have to do this several hundred times to represent all of the 
>>> data.  The time it takes to generate the map seem proportionate to 
>>> the amount of layers I make visible.  And again this is on the 
>>> mapserver side and not PHP.  PHP does its part of the operation in 
>>> thousandths of a second.
>>> thanks,
>>> -boice tomlin
>>> ////////////////////////////
>>> Run Skip
>>> http://runskip.com <http://runskip.com/> /
>>> boice tomlin
>>> boice at runskip.com <mailto:boice at runskip.com>
>>> 503-528-6204
>>> ////////////////////////////
>>> Run Skip
>>> http://runskip.com/
>>> boice tomlin
>>> boice at runskip.com <mailto:boice at runskip.com>
>>> 503-528-6204
>>
> 
> 
> 
> 
> ////////////////////////////
> Run Skip
> http://runskip.com/
> 
> boice tomlin
> 
> boice at runskip.com <mailto:boice at runskip.com>
> 
> 503-528-6204
> 
> 



More information about the mapserver-users mailing list