[mapserver-users] Draw roads WITHOUT anti-aliasing

Richard Greenwood richard.greenwood at gmail.com
Mon Oct 16 18:44:03 PDT 2017


On Mon, Oct 16, 2017 at 1:23 PM, Erik H <erik.h11.01 at gmail.com> wrote:

> I don't think we have much use for lines that are one pixel wide.
>
> I'm surprised at how difficult this is; isn't there some driver other than
> AGG/PNG I could use?
>

In mapserver versions before 7.0 there is the GD driver. I use it for 8 bit
GIFs. Not sure what it does with 24 images.

Rich



>
>
>
> On Mon, Oct 16, 2017 at 2:50 PM, Lime, Steve D (MNIT) <
> steve.lime at state.mn.us> wrote:
>
>> So you really do need 24-bit output. I was looking back through the
>> mailing list archives and it was mentioned back in 2012 that aliased output
>> could be implemented for simple (1 pixel-wide) lines and polygons – so
>> there is hope but I don’t believe (looking through the source) that Thomas
>> ever fully implemented it. In mapagg.cpp there are ifdef’s for a symbol
>> named AGG_ALIASED_ENABLED which makes me wonder if work was started. I
>> tried setting that in mapagg.cpp but ran into compile errors and didn’t try
>> and track those down.
>>
>>
>>
>> Of course you’d have to live with 1 pixel wide lines…
>>
>>
>>
>> Steve
>>
>>
>>
>> *From:* Erik H [mailto:erik.h11.01 at gmail.com]
>> *Sent:* Monday, October 16, 2017 1:15 PM
>> *To:* Lime, Steve D (MNIT) <steve.lime at state.mn.us>
>> *Cc:* mapserver-users at lists.osgeo.org
>> *Subject:* Re: [mapserver-users] Draw roads WITHOUT anti-aliasing
>>
>>
>>
>> Thanks for your reply, but I should have mentioned that I have a LOT of
>> different colors to be displayed, almost a million...
>>
>>
>>
>> I should also have mentioned that I've already tried to filter out the
>> anti-aliased pixels by setting all alpha bytes to 255 and then assuming
>> that all pixels that don't have alpha=255 in the PNG can be removed, but
>> that assumption seems to be wrong.
>>
>>
>>
>> On Mon, Oct 16, 2017 at 2:00 PM, Lime, Steve D (MNIT) <
>> steve.lime at state.mn.us> wrote:
>>
>> 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/loca
>> l/mapserver/apps/test/palette/test.map&mode=map (24-bit)
>>
>> -          http://maps1.dnr.state.mn.us/cgi-bin/mapserv70?map=/usr/loca
>> l/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.
>>
>>
>>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>



-- 
Richard W. Greenwood, PLS
www.greenwoodmap.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20171016/0a2aaee5/attachment-0001.html>


More information about the mapserver-users mailing list