[mapserver-dev] Performance issue with hatching with a pattern of a polygon

Stephen Woodbridge woodbri at swoodbridge.com
Sat Nov 12 12:48:14 PST 2016


Hi Devs,

I have a serious performance problem that I'm trying to run down. The 
layer definition is below. It appears to be related to HATCHing with a 
PATTERN of a polygon.

I have narrowed down a test case down to one layer and one class at 
1:1963 scale that takes 300+ secs to render.

$ /usr/local/bin/mapserv -v
MapServer version 6.4.3 OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ 
SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS 
SUPPORTS=SVGCAIRO SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER 
SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WCS_SERVER 
SUPPORTS=FASTCGI SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS INPUT=OGR 
INPUT=GDAL INPUT=SHAPEFILE

$ /usr/local/bin/mapserv -nh 
QUERY_STRING='MAP=./test.map&FORMAT=image%2Fpng&MAP_IMAGETYPE=agg_qn&LAYERS=Australia&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A900913&BBOX=12813560.707781,-2467980.3837369,12814292.234029,-2467467.4196173&WIDTH=1225&HEIGHT=859' 
 > junk.png
CGI Request 1 on process 14401
msDrawMap(): rendering using outputformat named agg_qn (AGG/PNG).
msDrawMap(): WMS/WFS set-up and query, 0.000s
msDrawMap(): Layer 0 (flats), 314.227s
msDrawLabelCache(): labelcache_map_edge_buffer = 20
msDrawMap(): Drawing Label Cache, 0.000s
msDrawMap() total time: 314.234s
msSaveImage(stdout) total time: 0.094s
mapserv request processing time (msLoadMap not incl.): 314.341s
msFreeMap(): freeing map at 0x10dade0.
freeLayer(): freeing layer at 0x10e78e0.

The LAYER definition is:

   LAYER
     NAME "flats"
     GROUP "Hydrography"
     STATUS ON
     DEBUG 5
     TYPE POLYGON
     DATA "topo-250k/Vector_data/Hydrography/flats"
     PROJECTION "init=epsg:4283" END
     MAXSCALEDENOM 250000
     CLASSITEM "SYMBOL"
     CLASS
       EXPRESSION "23"
       STYLE
         SYMBOL "hatch"
         COLOR "#00cfe6"
         ANGLE 45
         PATTERN 1 2 END
         WIDTH 1
         SIZE 3
       END
     END
   END

If I comment out the PATTERN line it runs like this:

$ /usr/local/bin/mapserv -nh 
QUERY_STRING='MAP=./test.map&FORMAT=image%2Fpng&MAP_IMAGETYPE=agg_qn&LAYERS=Australia&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A900913&BBOX=12813560.707781,-2467980.3837369,12814292.234029,-2467467.4196173&WIDTH=1225&HEIGHT=859' 
 > junk.png
CGI Request 1 on process 15462
msDrawMap(): rendering using outputformat named agg_qn (AGG/PNG).
msDrawMap(): WMS/WFS set-up and query, 0.000s
msDrawMap(): Layer 0 (flats), 0.063s
msDrawLabelCache(): labelcache_map_edge_buffer = 20
msDrawMap(): Drawing Label Cache, 0.000s
msDrawMap() total time: 0.070s
msSaveImage(stdout) total time: 0.094s
mapserv request processing time (msLoadMap not incl.): 0.177s
msFreeMap(): freeing map at 0xd9ade0.
freeLayer(): freeing layer at 0xda78e0.

And changing the pattern to 'PATTERN 2 2 END' cuts the time in about half:
msDrawMap(): Layer 0 (flats), 164.830s

So it looks like it has to do with the loop that renders the pattern 
while hatching. I found this issue because I am generating dot patterns 
as fills. I could generate images for the fill pattern, but I needed a 
large combination of colors and densities and hatching with a pattern 
fills the need nicely allowing me to vary the density, size of dot and 
color by varying the PATTERN, COLOR, WIDTH, and SIZE parameters.

I can put together a tarball with the shapefile and mapfile and create a 
ticket for this issue if that helps. I have not tried to create a 
FEATURE based object that will replicate this but I suspect that would 
be possible also.

Thoughts?
-Steve W

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the mapserver-dev mailing list