[mapserver-users] Draw roads WITHOUT anti-aliasing

Eichner, Andreas - SID Andreas.Eichner at sid.sachsen.de
Mon Nov 6 05:33:09 PST 2017


Ah, you need libxml2, so enable it: -DWITH_LIBXML2=ON

> -----Ursprüngliche Nachricht-----
> Von: Erik H [mailto:erik.h11.01 at gmail.com]
> Gesendet: Montag, 6. November 2017 14:29
> An: Eichner, Andreas - SID
> Cc: mapserver-users at lists.osgeo.org
> Betreff: Re: [mapserver-users] Draw roads WITHOUT anti-aliasing
> 
> Thanks for looking into this, Andreas, but I tried again and I'm still
> getting errors.
> 
> 
> 
> This is my script:
> 
> git pull
> rm -Rf build
> mkdir build
> cd build
> export JAVA_HOME=/usr/java/jdk
> export PYTHON_INCLUDE_DIR=/usr/include/python2.6/
> export PYTHON_LIBRARY=/usr/lib64/python2.6/config/libpython2.6.so
> export GDAL_DIR=/usr/local/src/gdal-2.1.3/
> cmake -DCMAKE_PREFIX_PATH=/usr/local/ WITH_GDAL=$GDAL_DIR  -
> DWITH_FRIBIDI=OFF -DWITH_WFS=OFF   -DWITH_WCS=OFF -
> DWITH_PROJ=/usr/local/lib  -DWITH_LIBXML2=OFF   WITH_POSTGIS=/usr/bin
> -DWITH_CLIENT_WFS=OFF     -DWITH_WMS=OFF    -DWITH_CLIENT_WMS=OFF
> -DWITH_CURL=OFF         -DWITH_SOS=OFF         -DWITH_PHP=OFF         -
> DWITH_PERL=OFF         -DWITH_RUBY=OFF         -DWITH_JAVA=ON         -
> DWITH_CSHARP=OFF   -DWITH_HARFBUZZ=OFF      -DWITH_PYTHON=ON     -
> DWITH_GEOS=0    -DWITH_SVGCAIRO=OFF         -DWITH_ORACLESPATIAL=OFF
> -DWITH_CAIRO=OFF -DWITH_THREAD_SAFETY=ON  -DWITH_FCGI=OFF   -DWITH_GIF=0
> ../ >../configure.out.txt
> make
> 
> -->
> ....
> [ 61%] Building C object CMakeFiles/mapserver.dir/mapmetadata.c.o
> /home/xxxx/work/mapserver/mapmetadata.c:41: error: expected ‘=’, ‘,’,
> ‘;’, ‘asm’ or ‘__attribute__’ before ‘_msMetadataGetCharacterString’
> ...
> 
> 
> 
> > git log
> commit bf73b5cdfe0bcecc06f8241ddf844a99b5fa7f4b
> Author: Even Rouault <even.rouault at spatialys.com>
> Date:   Fri Nov 3 15:45:20 2017 +0100
> 
> 
> 
> On Mon, Nov 6, 2017 at 3:23 AM, Eichner, Andreas - SID
> <Andreas.Eichner at sid.sachsen.de> wrote:
> 
> 
> 	Hi Erik,
> 
> 	just tried building a freshly pulled mapserver/master and I got
> strange CMake errors too.
> 	In my case wiping the build/ directory recreating it solved the
> problem.
> 
> 	HTH
> 
> 	> -----Ursprüngliche Nachricht-----
> 	> Von: mapserver-users [mailto:mapserver-users-
> bounces at lists.osgeo.org <mailto:mapserver-users-bounces at lists.osgeo.org>
> ] Im
> 	> Auftrag von Erik H
> 	> Gesendet: Freitag, 3. November 2017 21:24
> 	> An: mapserver-users at lists.osgeo.org <mailto:mapserver-
> users at lists.osgeo.org>
> 	> Betreff: Re: [mapserver-users] Draw roads WITHOUT anti-aliasing
> 	>
> 	> I made some changes to the mapserver 7 source code that achieve
> what I
> 	> want (I'm now able to switch between aliased and antialiased
> lines,
> 	> based on the ANTIALIAS keyword in the STYLE section).
> 	>
> 	> I tried to put up a pull request for it but I'm having problems
> 	> compiling the code in the 'master' branch - compilation errors
> for
> 	> mapmetadata.c. My code was branched off the release-7 branch and
> did not
> 	> have that problem.
> 	>
> 	> The cmake command I used was
> 	>
> 	> cmake -DCMAKE_PREFIX_PATH=/usr/local/ WITH_GDAL=$GDAL_DIR  -
> 	> DWITH_FRIBIDI=OFF -DWITH_WFS=OFF   -DWITH_WCS=OFF -
> 	> DWITH_PROJ=/usr/local/lib  -DWITH_LIBXML2=OFF
> WITH_POSTGIS=/usr/bin
> 	> -DWITH_CLIENT_WFS=OFF     -DWITH_WMS=OFF    -
> DWITH_CLIENT_WMS=OFF
> 	> -DWITH_CURL=OFF         -DWITH_SOS=OFF         -DWITH_PHP=OFF
> -
> 	> DWITH_PERL=OFF         -DWITH_RUBY=OFF         -DWITH_JAVA=ON
> -
> 	> DWITH_CSHARP=OFF   -DWITH_HARFBUZZ=OFF      -DWITH_PYTHON=ON
> -
> 	> DWITH_GEOS=0    -DWITH_SVGCAIRO=OFF         -
> DWITH_ORACLESPATIAL=OFF
> 	> -DWITH_CAIRO=OFF -DWITH_THREAD_SAFETY=ON  -DWITH_FCGI=OFF   -
> DWITH_GIF=0
> 	> ../ >../configure.out.txt
> 	>
> 	>
> 	> Any suggestions?
> 	>
> 	> Thanks
> 	>
> 	> On Thu, Oct 19, 2017 at 11:04 AM, Erik H <erik.h11.01 at gmail.com>
> wrote:
> 	>
> 	>
> 	>       I just did what Andreas spelled out yesterday:
> 	>
> 	>       Simply changing the typedef in line 91 of mapagg.cpp from
> 	>
> 	>         typedef
> mapserver::renderer_scanline_aa_solid<renderer_base>
> 	> renderer_scanline;
> 	>
> 	>       to
> 	>
> 	>         typedef
> mapserver::renderer_scanline_bin_solid<renderer_base>
> 	> renderer_scanline;
> 	>
> 	>
> 	>
> 	>       However, I'd like to be able to switch between rasterizer
> via some
> 	> option in the .map file, so I'd welcome any suggestion on how to
> do
> 	> that.
> 	>
> 	>       On Thu, Oct 19, 2017 at 10:07 AM, Lime, Steve D (MNIT)
> 	> <steve.lime at state.mn.us> wrote:
> 	>
> 	>
> 	>               Glad this was figured out! What was the code
> change exactly?
> 	> ________________________________
> 	>
> 	>               From: mapserver-users <mapserver-users-
> 	> bounces at lists.osgeo.org <mailto:mapserver-users-
> bounces at lists.osgeo.org <mailto:mapserver-users-bounces at lists.osgeo.org>
> >
> 	> > on behalf of Erik H <erik.h11.01 at gmail.com>
> 	>               Sent: Wednesday, October 18, 2017 8:07:42 PM
> 	>               To: Eichner, Andreas - SID
> 	>               Cc: mapserver-users at lists.osgeo.org
> <mailto:mapserver-users at lists.osgeo.org>  <mailto:mapserver-
> 	> users at lists.osgeo.org>
> 	>               Subject: Re: [mapserver-users] Draw roads WITHOUT
> anti-
> 	> aliasing
> 	>
> 	>               Andreas,
> 	>
> 	>               I made that change in mapagg.cpp and it seems to
> do exactly
> 	> what I need. Wunderbar!
> 	>
> 	>               As for providing an option to switch rasterizer
> based on an
> 	> option, how about reviving the FORMATOPTION 'ANTIALIAS'?
> 	>
> 	>               Thanks, Erik
> 	>
> 	>               On Wed, Oct 18, 2017 at 9:18 AM, Eichner, Andreas
> - SID
> 	> <Andreas.Eichner at sid.sachsen.de
> <mailto:Andreas.Eichner at sid.sachsen.de>
> <mailto:Andreas.Eichner at sid.sachsen.de
> <mailto:Andreas.Eichner at sid.sachsen.de> >
> 	> > wrote:
> 	>
> 	>
> 	>                       Nope, this won't work:
> 	>
> 	>                         r->default_gamma =
> atof(msGetOutputFormatOption(
> 	> format, "GAMMA", "0.75" ));
> 	>                         if(r->default_gamma <= 0.0 || r-
> >default_gamma >=
> 	> 1.0) {
> 	>                           r->default_gamma = 0.75;
> 	>                         }
> 	>
> 	>                       From mapagg.cpp lines 844-847 forces 0 <
> GAMMA < 1
> 	>                       Also note that MapServer uses a linear
> gamma function
> 	> defined as
> 	>
> 	>                              double operator() (double x) const
> 	>                               {
> 	>                                   if(x < m_start) return 0.0;
> 	>                                   if(x > m_end) return 1.0;
> 	>                                   return (x - m_start) / (m_end
> - m_start);
> 	>                               }
> 	>
> 	>                       Where m_start is _always_ set to 0 and
> m_end is set to
> 	> the GAMMA value given by you (or the default 0.75).
> 	>                       I think someone should check this - to me
> it seems a
> 	> power function was intented...
> 	>
> 	>                       HTH
> 	>
> 	>                       > -----Ursprüngliche Nachricht-----
> 	>                       > Von: mapserver-users [mailto:mapserver-
> users-
> 	> bounces at lists.osgeo.org <mailto:mapserver-users-
> bounces at lists.osgeo.org <mailto:mapserver-users-bounces at lists.osgeo.org>
> >
> 	> ] Im
> 	>                       > Auftrag von lars.schylberg at blixtmail.se
> 	>                       > Gesendet: Mittwoch, 18. Oktober 2017
> 14:05
> 	>                       > An: mapserver-users at lists.osgeo.org
> <mailto:mapserver-users at lists.osgeo.org>
> 	> <mailto:mapserver-users at lists.osgeo.org <mailto:mapserver-
> users at lists.osgeo.org> >
> 
> 	>                       > Betreff: Re: [mapserver-users] Draw
> roads WITHOUT
> 	> anti-aliasing
> 	>                       >
> 	>                       > Hi,
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       >
> 	>
> 	>                       > I did some quick tests with :
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       >   OUTPUTFORMAT
> 	>                       >     NAME "png_G0"
> 	>                       >     DRIVER AGG/PNG
> 	>                       >     MIMETYPE "image/png"
> 	>                       >     IMAGEMODE RGB
> 	>                       >     EXTENSION "png"
> 	>                       >     FORMATOPTION "GAMMA=0.0"
> 	>                       >   END
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       > and shp2img with options -i
> 	>                       >
> 	>                       >
> 	>                       > eg: shp2img -m 01_polygon_td_poly.map -o
> 	> 01_polygon_td_poly.png -i
> 	>                       > png_G0
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       > I did some tests with both polygons,
> polygon outlines
> 	> and lines and they
> 	>                       > all seems to have anti-aliasing as far
> as I could
> 	> see.
> 	>                       >
> 	>                       > Would this be an ok way to test it?  I
> also have some
> 	> people that would
> 	>                       > like to do lines without anti-aliasing
> for a strange
> 	> reason.
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       > Lars Schylberg
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       > -----Originalmeddelande-----
> 	>                       > > Från: "Rahkonen Jukka (MML)"
> 	> <jukka.rahkonen at maanmittauslaitos.fi
> <mailto:jukka.rahkonen at maanmittauslaitos.fi>
> 
> 	> <mailto:jukka.rahkonen at maanmittauslaitos.fi
> <mailto:jukka.rahkonen at maanmittauslaitos.fi> > >
> 	>                       > > Till: "Eichner, Andreas - SID"
> 	> <Andreas.Eichner at sid.sachsen.de
> <mailto:Andreas.Eichner at sid.sachsen.de>
> <mailto:Andreas.Eichner at sid.sachsen.de
> <mailto:Andreas.Eichner at sid.sachsen.de> >
> 	> >, "Erik
> 	>                       > H" <erik.h11.01 at gmail.com>
> 	>                       > > Kopia: mapserver-users at lists.osgeo.org
> <mailto:mapserver-users at lists.osgeo.org>
> 	> <mailto:mapserver-users at lists.osgeo.org <mailto:mapserver-
> users at lists.osgeo.org> >
> 	>                       > > Datum: 2017-10-18 11:13
> 	>                       > > Ämne: Re: [mapserver-users] Draw roads
> WITHOUT
> 	> anti-aliasing
> 	>                       > >
> 	>                       > > Hi,
> 	>                       > >
> 	>                       > > I suppose that the amount of
> antialiasing with AGG
> 	> is set with "gamma"
> 	>                       > parameter.  Mapserver supports that at
> least for
> 	> polygons as documented
> 	>                       > in
> http://www.mapserver.org/mapfile/outputformat.html
> <http://www.mapserver.org/mapfile/outputformat.html>
> 	> <http://www.mapserver.org/mapfile/outputformat.html
> <http://www.mapserver.org/mapfile/outputformat.html> >  but you could
> try
> 	>                       > if using gamma=0.0 has an effect on
> lines as well. It
> 	> may be that it
> 	>                       > does not because search
> 	>                       > >
> 	>                       >
> 	>
> https://github.com/mapserver/mapserver/search?utf8=%E2%9C%93&q=gamma&typ
> <https://github.com/mapserver/mapserver/search?utf8=%E2%9C%93&q=gamma&ty
> p>
> 	>
> <https://github.com/mapserver/mapserver/search?utf8=%E2%9C%93&q=gamma&ty
> <https://github.com/mapserver/mapserver/search?utf8=%E2%9C%93&q=gamma&ty
> >
> 	> p>
> 	>                       > e=
> 	>                       > > seems to find only something that is
> tied to
> 	> polygon outlines
> 	>                       > >
> https://github.com/mapserver/mapserver/blob/branch-
> <https://github.com/mapserver/mapserver/blob/branch->
> 	> 7- <https://github.com/mapserver/mapserver/blob/branch-7-
> <https://github.com/mapserver/mapserver/blob/branch-7-> >
> 	>                       >
> 0/renderers/agg/include/agg_renderer_outline_aa.h
> 	>                       > >
> 	>                       > >
> 	>                       > > If gamma does not work for lines then
> it could be
> 	> worth making a
> 	>                       > feature request for adding a new
> formatoption
> 	> "GAMMA_LINE=[].
> 	>                       > >
> 	>                       > > Couple of Mapnik links dealing with
> the same issue:
> 	>                       > >
> http://gis.19327.n8.nabble.com/Turning-off-anti-
> <http://gis.19327.n8.nabble.com/Turning-off-anti->
> 	> aliasing- <http://gis.19327.n8.nabble.com/Turning-off-anti-
> aliasing- <http://gis.19327.n8.nabble.com/Turning-off-anti-aliasing-> >
> 	>                       > td5339458.html
> 	>                       > > http://mapnik.org/mapnik-
> reference/#3.0.6/line- <http://mapnik.org/mapnik-reference/#3.0.6/line->
> 	> gamma-method <http://mapnik.org/mapnik-reference/#3.0.6/line-
> gamma- <http://mapnik.org/mapnik-reference/#3.0.6/line-gamma->
> 	> method>
> 	>                       > >
> 	>                       > > -Jukka Rahkonen-
> 	>                       > >
> 	>                       > >
> 	>                       > >
> 	>                       > > -----Alkuperäinen viesti-----
> 	>                       > > Lähettäjä: mapserver-users
> [mailto:mapserver-users-
> 	>                       > bounces at lists.osgeo.org] Puolesta
> Eichner, Andreas -
> 	> SID
> 	>                       > > Lähetetty: 18. lokakuuta 2017 9:57
> 	>                       > > Vastaanottaja: Erik H
> <erik.h11.01 at gmail.com>
> 	>                       > > Kopio: mapserver-users at lists.osgeo.org
> <mailto:mapserver-users at lists.osgeo.org>
> 	> <mailto:mapserver-users at lists.osgeo.org <mailto:mapserver-
> users at lists.osgeo.org> >
> 	>                       > > Aihe: Re: [mapserver-users] Draw roads
> WITHOUT
> 	> anti-aliasing
> 	>                       > >
> 	>                       > > Damn... missed attaching the images.
> 	>                       > >
> 	>                       > > > -----Ursprüngliche Nachricht-----
> 	>                       > > > Von: mapserver-users
> [mailto:mapserver-users-
> 	>                       > bounces at lists.osgeo.org]
> 	>                       > > > Im Auftrag von Eichner, Andreas -
> SID
> 	>                       > > > Gesendet: Mittwoch, 18. Oktober 2017
> 08:28
> 	>                       > > > An: Erik H
> 	>                       > > > Cc: mapserver-users at lists.osgeo.org
> <mailto:mapserver-users at lists.osgeo.org>
> 	> <mailto:mapserver-users at lists.osgeo.org <mailto:mapserver-
> users at lists.osgeo.org> >
> 
> 	>                       > > > Betreff: Re: [mapserver-users] Draw
> roads WITHOUT
> 	> anti-aliasing
> 	>                       > > >
> 	>                       > > > Hi,
> 	>                       > > >
> 	>                       > > > I just meant that it seems to be
> pretty easy to
> 	> implement aliased
> 	>                       > > > rendering with AGG.
> 	>                       > > > Simply changing the typedef in line
> 91 of
> 	> mapagg.cpp from
> 	>                       > > >
> 	>                       > > >   typedef
> 	> mapserver::renderer_scanline_aa_solid<renderer_base>
> 	>                       > > > renderer_scanline;
> 	>                       > > >
> 	>                       > > > to
> 	>                       > > >
> 	>                       > > >   typedef
> 	> mapserver::renderer_scanline_bin_solid<renderer_base>
> 	>                       > > > renderer_scanline;
> 	>                       > > >
> 	>                       > > > turns of anti-aliased rendering.
> I've attached
> 	> the output of
> 	>                       > "shp2img
> 	>                       > > > -m line_simple.map" from the
> msautotests.
> 	>                       > > > An additional member in class
> AGG2Renderer for
> 	> the aliased
> 	>                       > rasterizer
> 	>                       > > > and conditionally passing one or the
> other to
> 	> render_scanlines()
> 	>                       > > > depending on some value of
> strokeStyleObj might
> 	> be enough.
> 	>                       > > >
> 	>                       > > > Regards
> 	>                       > > >
> 	>                       > > > > -----Ursprüngliche Nachricht-----
> 	>                       > > > > Von: Erik H
> [mailto:erik.h11.01 at gmail.com]
> 	>                       > > > > Gesendet: Dienstag, 17. Oktober
> 2017 17:34
> 	>                       > > > > An: Eichner, Andreas - SID
> 	>                       > > > > Cc: Richard Greenwood; mapserver-
> 
> 	> users at lists.osgeo.org <mailto:mapserver-users at lists.osgeo.org
> <mailto:mapserver-users at lists.osgeo.org> >
> 	>                       > > > > Betreff: Re: [mapserver-users]
> Draw roads
> 	> WITHOUT anti-aliasing
> 	>                       > > > >
> 	>                       > > > > 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.
> 	>                       > > > >
> 	>                       > > >
> _______________________________________________
> 	>                       > > > mapserver-users mailing list
> 	>                       > > > mapserver-users at lists.osgeo.org
> <mailto:mapserver-users at lists.osgeo.org>
> 	> <mailto: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>
> 	> <https://lists.osgeo.org/mailman/listinfo/mapserver-users
> <https://lists.osgeo.org/mailman/listinfo/mapserver-users> >
> 	>                       > >
> _______________________________________________
> 	>                       > > mapserver-users mailing list
> 	>                       > > mapserver-users at lists.osgeo.org
> <mailto:mapserver-users at lists.osgeo.org>  <mailto:mapserver-
> 	> users at lists.osgeo.org>
> 	>                       > >
> https://lists.osgeo.org/mailman/listinfo/mapserver-
> <https://lists.osgeo.org/mailman/listinfo/mapserver->
> 	> users <https://lists.osgeo.org/mailman/listinfo/mapserver-users
> <https://lists.osgeo.org/mailman/listinfo/mapserver-users> >
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       >
> 	>                       > --
> 	>                       >
> 	>                       >
> 	>
> _______________________________________________
> 	>                       mapserver-users mailing list
> 	>                       mapserver-users at lists.osgeo.org
> <mailto:mapserver-users at lists.osgeo.org>  <mailto:mapserver-
> 	> users at lists.osgeo.org>
> 	>
> https://lists.osgeo.org/mailman/listinfo/mapserver-
> <https://lists.osgeo.org/mailman/listinfo/mapserver->
> 	> users <https://lists.osgeo.org/mailman/listinfo/mapserver-users
> <https://lists.osgeo.org/mailman/listinfo/mapserver-users> >
> 	>
> 	>
> 	>
> 	>
> 
> 
> 



More information about the mapserver-users mailing list