[mapserver-users] Problem with angle labels

gisweb at lmi.net gisweb at lmi.net
Thu Sep 26 13:40:10 PDT 2002


Xisco,

Any or all of the following steps might help if you need to configure mapserver
on a machine with both freetype 1.x and freetype 2.x on it...  

Problem summary:
     System: FreeBSD
     Access: No root access, but local builds okay
     Mapserver version: 3.6.1
     Goal:  Build mapserver with true type support.
     Issue:  Machine has an existing version of Freetype 2.x. The ./configure
routine recognizes the Freetype 2.x rather than the (required) Freetype 1.x even
when statically pointed to the Freetype 1.x libraries.

Problem solution:
     All of the following steps were required to successfully build mapserver in
the above environment...
     1) Compile GD 1.8.4 and Freetype 1.3.1 to local directories.

     2) In the .login, add:
     # Added for mapserver purposes:
     setenv LD_LIBRARY_PATH /path/to/libttf.so.4.0
     # End of mapserver additions.
     (It may also be necessary to establish links to the "lib" directory for
files in the "include" directory.  If you get errors that say "such-and-such
file does not exist", but you know the files do exist in the "include"
directory, try establishing a hard or soft link of the same name in the "lib"
directory...)

     3) Configure mapserver with the following parameters (plus any others you
want):
     ./configure --prefix=/path/to/libraries 
                 --with-gd=static,/path/to/libraries 
                 --with-freetype=/path/to/freetype 
                 --enable-force-freetype1 
                 --enable-runpath 
                 --with-proj 
                 --with-tiff

     4) Edit the resulting mapserver Makefile as follows:

     # These originally pointed to root-only system directories.
     # Change them to your local installation directories.
     LIB_INSTALL=/usr/home/gisweb/local/lib/
     HEADER_INSTALL=/usr/home/gisweb/local/include/mapserver-3.5/

     # Proj.4 distribution (cartographic projection routines).
     #PROJ_INC  <-- originally blank.  Needed the reference as shown on line below.
     PROJ_INC=-I/usr/local/include 
     PROJ_LIB= -lproj
     PROJ=     -DUSE_PROJ -DUSE_PROJ_API_H

     # GD distribution (graphics library GIF and/or PNG support). (REQUIRED)
     #
     GDFONT_OBJ=gd-1.2/gdfontt.o gd-1.2/gdfonts.o gd-1.2/gdfontmb.o
gd-1.2/gdfontl.o gd-1.2/gdfontg.o
     GD_INC=  -I/usr/home/gisweb/local/lib
     #GD_LIB=   -ljpeg -lfreetype -lpng -lz  <-- originally refers to -lfreetype.
     GD_LIB= -lm -lgd -lpng -lz -ljpeg -lttf 
     GD=       -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_TTF
     GD_STATIC = /usr/home/gisweb/local/lib/libgd.a

     # TIFF distribution (raster support for TIFF and GEOTIFF imagery).
(RECOMMENDED)
     TIFF_INC= 
     #TIFF_LIB= -ltiff -ljpeg -lpng -lz -lfreetype  <-- originally has -lfreetype
     TIFF_LIB= -ltiff -ljpeg -lpng -lz -lttf
     TIFF=     -DUSE_TIFF

     5) From the mapserver-3.6.1 directory containing the modified Makefile, type:
     make install
     make

     6) Typing "./mapserv -v" should return the following (Note "SUPPORTS=TTF"):
     MapServer version 3.6.1 OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP SUPPORTS=PROJ
SUPPORTS=TTF SUPPORTS=WMS_SERVER INPUT=TIFF INPUT=EPPL7 INPUT=JPEG INPUT=SHAPEFILE

     These steps eliminated the problem of the incorrect True Type angles when
using the ANGLE AUTO parameter in a LABEL object.

Best of luck,
Jonathan Lowe

Quoting Xisco Guaita <xguaita at cesiba.com>:

> Hi,
> 
> I'm working with street maps. But I've problems with the angle labels of the
> street line layer.
> 
> The result.png attached file is a example of this. The street's center lines
> have been drawn to show the differences between label and line angles.
> 
> I've builded a shapefile for testing purpose. It has a field with angles
> from 0º to 345º in steps of 15º.
> 
> Here's the mapfile layer:
> 
> LAYER
>   NAME labels
>   TYPE point
>   DATA "theme1"
>   status on
>   LABELcache off
>   labelangleitem angle #angles from 0º to 345º step 15º
>   CLASS
>     text "--------------------"
>     LABEL
>       TYPE truetype
>       FONT Lucida
>       COLOR 75 75 75
>       POSITION CR
>       SIZE 12
>     END
>   END
> END
> 
> and the 360.png attached file is the resulting image. There are some angles
> draw incorrectly. Is a problem of graphics libraries? Has anyone had the
> same problem, and has you found any solution?
> 
> I'm using PHPMapscript 3.6.1, libgd 1.8.4, freetype 2.0, php 4.1.2
> 
> Thanks in advance,
> Xisco Guaita
> 





More information about the MapServer-users mailing list