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

Håvard Tveite havard.tveite at nmbu.no
Tue Nov 15 00:10:20 PST 2016


For regular non-rotated patterns you can use a vector symbol and
a STYLE with GAP.
See the examples on the Cartographical Symbol Construction
with MapServer page:
http://mapserver.org/mapfile/symbology/construction.html#polygon-fills-with-symbols-of-type-vector

The following will for a polygon layer result in a regular pattern
of circlef's with 25-20 = 5 units of space between the symbols
(the top left example in the "Polygon fills - vector" figure).

     STYLE
       SYMBOL "circlef"
       COLOR 0 0 0
       SIZE 20
       GAP 25 # centre to centre gap
     END # STYLE

Håvard

On 14. nov. 2016 17:11, Stephen Woodbridge wrote:
> 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
>
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev

-- 
Håvard Tveite
Department of Mathematical Sciences and Technology, NMBU
Drøbakveien 31, POBox 5003, N-1432 Ås, NORWAY
Phone: +47 67231548 Fax: +47 64965401 http://www.nmbu.no/imt/


More information about the mapserver-dev mailing list