[mapserver-users] Draw roads WITHOUT anti-aliasing

Erik H erik.h11.01 at gmail.com
Tue Oct 17 08:34:04 PDT 2017


We've considered vector tiles but the problem is that (just like image
tiles) they would involve a lot of redrawing and would require a high
bandwidth.

We envision something like 'color cycling' which is sometimes used in
graphics: see http://www.effectgames.com/demos/canvascycle/?sound=0 .

It's a bit like coloring books: you specify a palette (1=red, 2=yellow and
so on), and if you decide you want different colors, you erase the colors
that need to be changed and color them in again with the new color - no
need to have a new book shipped to you, or even to color the entire page if
some colors are unchanged.

Of course, a coloring book is not very useful if it specifies numbers that
are not in the palette, or (worse) if some numbers exist in the palette but
are just wrong (you don't want to color part of Belle's dress with the
color that was meant for Ariel's hair).

On a more technical note, we get pretty far by filtering out the pixels
with alpha != 255 (see screenshots) but some incorrect pixels remain.
Ideally, we would like to preserve some kind of anti-aliasing but we need
about 22 bits just to encode the road segments, not sure how that would
work.

As for Andreas' remark about 'simply the use of another scanline
rasterizer.' - I'm sorry but I'm not much of a C++ developer. If I have to
do rasterizing, I'd skip MapServer altogether and generate the PNG in Java.

Thanks.


On Tue, Oct 17, 2017 at 4:53 AM, Eichner, Andreas - SID <
Andreas.Eichner at sid.sachsen.de> wrote:

> I'd guess it's simply the use of another scanline rasterizer. The demo
>   http://www.antigrain.com/demo/rasterizers.cpp.html
> is an example of drawing as polygon aliased and anti-aliased side by side.
>
>
> > -----Ursprüngliche Nachricht-----
> > Von: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org] Im
> > Auftrag von Richard Greenwood
> > Gesendet: Dienstag, 17. Oktober 2017 03:44
> > An: Erik H
> > Cc: mapserver-users at lists.osgeo.org
> > Betreff: Re: [mapserver-users] Draw roads WITHOUT anti-aliasing
> >
> > 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 <mailto: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/local/mapserver/apps/test/palette/test.map&mode=m
> > ap <http://maps1.dnr.state.mn.us/cgi-
> > bin/mapserv70?map=/usr/local/mapserver/apps/test/palette/test.map&mode=m
> > ap>  (24-bit)
> >
> >                       -          http://maps1.dnr.state.mn.us/cgi-
> > bin/mapserv70?map=/usr/local/mapserver/apps/test/palette/test.map&mode=m
> > ap&map.imagetype=png8 <http://maps1.dnr.state.mn.us/cgi-
> > bin/mapserv70?map=/usr/local/mapserver/apps/test/palette/test.map&mode=m
> > ap&map.imagetype=png8>  (8-bit w/5 colors)
> >
> >
> >
> >                       Steve
> >
> >
> >
> >                       From: mapserver-users [mailto:mapserver-users-
> > bounces at lists.osgeo.org <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 <mailto:
> 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 <mailto:mapserver-
> > users at lists.osgeo.org>
> >       https://lists.osgeo.org/mailman/listinfo/mapserver-users
> > <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/20171017/9110b12b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screenshot.3.png
Type: image/png
Size: 3602 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20171017/9110b12b/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screenshot.2.png
Type: image/png
Size: 609 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20171017/9110b12b/attachment-0003.png>


More information about the mapserver-users mailing list