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

Stephen Woodbridge woodbri at swoodbridge.com
Mon Nov 14 08:11:45 PST 2016


Yeah, I also built 7.0.2 to check performance with that and it is 
basically the same as 6.4.3 for this case.

One of the nice use cases for using hatch patterns, is that they allow 
the under lying geometry to show through, which decouples the background 
from the hatching, so for example if one has sand bars in the water you 
can have the water, and apply a sandy colored dot pattern over it where 
the sand bars are. Or for intermittent water areas you can put a blue 
dot pattern over the land area, and for swamps I use a blue dot pattern 
overlayed with tuffs of grass generated with a vector symbol. The 
current system works very well, except for this performance corner case.

For the time being, I spread out my dots and made them larger to speed 
things up a little. I don't like the resulting imagery as much and it is 
still painfully slow, but a little faster than before.

I was ideally wondering if it might make sense to have a DOTS class like 
HATCH that would take DX, DY, ANGLE, SIZE as attributes that would be 
able to special case the rendering of DOTS a lot faster? I suspect, that 
the issue is that implementation of PATTERNed HATCH is flexible but not 
efficient for all cases. Where the PATTERN is longer it seems to run 
faster, but a PATTERN 1 2 END is horribly slow when filling large areas.

-Steve W

On 11/14/2016 10:17 AM, lars.schylberg at blixtmail.se wrote:
> Hi,
>
> I just became curious since I haven't used hatch patterns that much.  So
> I made some examples myself.
> It is clear from my experiments that hatch patterns takes quite some
> time to render in the current implementation.
>
> My test is here:
> https://gist.github.com/LarsSchy/5236d172a7534275e2d1406ca2cca5c3
>
> mapserv -v
> MapServer version 7.0.1 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ
> SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS
> SUPPORTS=RSVG SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER
> SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT
> SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI
> SUPPORTS=THREADS SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS INPUT=OGR
> INPUT=GDAL INPUT=SHAPEFILE
>
> $ shp2img -m polygon-examples-hatch.map -o polygon-examples-hatch.png
> -map_debug 5
> msDrawMap(): rendering using outputformat named png (AGG/PNG).
> msDrawMap(): WMS/WFS set-up and query, 0.000s
> msDrawMap(): Layer 0 (Example 1), 0.002s
> msDrawMap(): Layer 1 (Example 2), 0.018s
> msDrawMap(): Layer 2 (Example 3), 0.011s
> msDrawMap(): Layer 3 (Example 4), 0.005s
> msDrawMap(): Layer 4 (Example 5), 0.001s
> msDrawMap(): Layer 5 (Example 6), 0.018s
> msDrawMap(): Layer 6 (Example 7), 0.013s
> msDrawMap(): Layer 7 (Example 8), 0.045s
> msDrawMap(): Layer 8 (Example 9), 0.000s
> msDrawMap(): Layer 9 (Example 10), 0.000s
> msDrawMap(): Layer 10 (Example 11), 0.000s
> msDrawMap(): Layer 11 (Example 12), 0.000s
> msDrawMap(): Drawing Label Cache, 0.003s
> msDrawMap() total time: 0.118s
> msSaveImage(polygon-examples-hatch.png) total time: 0.025s
> msFreeMap(): freeing map at 0x22d1340.
>
> A simple box filled with the hatch and PATTERN takes 18 ms to render in
> example 2.  Example 8 with a double hatch is 45 ms.
> The other patterns without hatch in example 9 - 12 are all less than 1 ms.
>
> Lars Schylberg
>
> -----Originalmeddelande-----
>> Från: "Stephen Woodbridge" <woodbri at swoodbridge.com
> <mailto:woodbri at swoodbridge.com>>
>> Till: mapserver-dev at lists.osgeo.org <mailto:mapserver-dev at lists.osgeo.org>
>> Datum: 2016-11-13 16:47
>> Ämne: Re: [mapserver-dev] Performance issue with hatching with a
> pattern of a polygon
>>
>
>
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
>


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



More information about the mapserver-dev mailing list