[mapserver-users] Draw roads WITHOUT anti-aliasing

Lime, Steve D (MNIT) steve.lime at state.mn.us
Mon Oct 16 11:00:11 PDT 2017


Hmmm… I wonder if you just could use a pre-computed palette to control quantizing to 8 bits. You can supply a palette file (RGB or RGBA) and the MapServer will map 24/32-bit values to those in the palette. Format options are:

     FORMATOPTION "PALETTE_FORCE=TRUE"
    FORMATOPTION "PALETTE=palette.txt"

This will definitely limit the colors in your output image to those you specify. The question is whether or not the anti-aliased colors will map to the right color and that will depend on your palette. I did write a simple test with a 5 color palette (black, white, red, green and blue) and it seems to work ok but that’s a very simple palette… Based on your application it might work though.


-          http://maps1.dnr.state.mn.us/cgi-bin/mapserv70?map=/usr/local/mapserver/apps/test/palette/test.map&mode=map (24-bit)

-          http://maps1.dnr.state.mn.us/cgi-bin/mapserv70?map=/usr/local/mapserver/apps/test/palette/test.map&mode=map&map.imagetype=png8 (8-bit w/5 colors)

Steve

From: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Erik H
Sent: Monday, October 16, 2017 10:58 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] Draw roads WITHOUT anti-aliasing

I'm running a tiling server that uses MapServer 7.0.4 to generate PNGs.

My colleagues came up with an ingenious idea to animate traffic conditions that would require them to identify road segments based on their color. They asked me to generate tiles with a predetermined RGBA value per road segment.

I configured a layer of type LINE, with a STYLE section containing 'COLOR [palette]' (palette being a field in the database query). Initially, I thought I was creating the images my colleagues needed, but it seems that the anti-aliasing causes some pixels to have colors other than the one I specified; this prevents us from identifying the road segments.

We can live without anti-aliasing, but I was unable to turn it off; I tried both the AGG/PNG and GD/PNG drivers and messed with various FORMATOPTION identifiers, but nothing seemed to make any difference.

Any suggestions?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20171016/d217020e/attachment-0001.html>


More information about the mapserver-users mailing list