[Mapserver-users] cant label streets in mapscript -- please help

Murat Isik muratisik at megatek.com.tr
Tue Nov 11 06:59:01 PST 2003


This is a multi-part message in MIME format.

------=_NextPart_000_0068_01C3A875.1B0AD2C0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Good days Mr. Morissette,

I hope it is okey if I ask you a question about mapscript labelling and =
also cc this question to maillist (as you have asked me to do before)

I have tried to label a streets layer in mapserver and succeeded in a =
reasonbale way, names are not perfectly written but I guess it all takes =
some playing around with MINSIZE and/or other values. I will do that.
Before doing that, I tried to do the same thing in my php/mapscript =
which used to run the same mapfile minus the labelling part. I copied =
the mapserver-mapfile's labelled street layer and replaced it into the =
place of the same non-labelled street layer in mapscript-mapfile. This =
is the non-labeled layer of mapscript:

LAYER
  NAME ERENKOY_ORNEKSOKAK_PL_polyline
  GROUP sokaklar
  TYPE line
  DATA ERENKOY_ORNEKSOKAK_PL_polyline
  STATUS ON
  CLASSITEM 'ID'
  CLASS
        EXPRESSION /./
   COLOR 66 34 249
  END

END

I removed the above and put this in its place (which worked with =
mapserver):

LAYER
  NAME ERENKOY_ORNEKSOKAK_PL_polyline
  TYPE LINE
  GROUP sokaklar
  STATUS ON
  DATA ERENKOY_ORNEKSOKAK_PL_polyline
  LABELITEM "ADI"
  CLASS
    NAME "ADI"
    COLOR 161 02 110
    LABEL
      TYPE truetype
#      FORCE true
      FONT arial
      COLOR 0 0 0
        ANGLE AUTO
 #     BACKGROUNDCOLOR 250 250 250=20
      POSITION AUTO
        SIZE 0
        MINSIZE 2
      SIZE 6
    END
  END
END

ADI is the coloumn in dbf which I am trying to use for labelling. After =
this, mapscript stopped rendering images. Then hopelessly, I added a few =
more lines to mapscript mapfile and it restarted to render maps but with =
no labels. So the layer definition became:

LAYER
  NAME ERENKOY_ORNEKSOKAK_PL_polyline
  TYPE line
  GROUP sokaklar
  STATUS ON
  DATA ERENKOY_ORNEKSOKAK_PL_polyline
    CLASSITEM 'ID'
      CLASS
       EXPRESSION /./
      COLOR 66 34 249
      END
   # LABELCACHE OFF
    LABELITEM 'ADI'
      CLASS
   NAME 'ADI'
    #EXPRESSION /./
   COLOR 161 02 110
    LABEL
      TYPE truetype
#      FORCE true
      FONT arial
      COLOR 0 0 0
       ANGLE AUTO
  #   BACKGROUNDCOLOR 250 250 250=20
      POSITION AUTO
        SIZE 0
        MINSIZE 2
      SIZE 8
   END
  END
END

After the advice of Mr. Haseborg from the maillist I added =
$myMap->drawLabelCache($img) line right before  =
$img->saveWebImage(GIF,1,1,0) line.
Still no labels were written. This the point I am stuck at. I have read =
a lot of mail archieves but found no results....

Is there anything else to be added to the php code or mapfile? How can I =
get the labelling to work with mapscript?

(It is killing me to be a php-newbei and mapscript-newbei at the same =
time...)

Thanks in advance:)

Have a nice day

Murat Isik

------=_NextPart_000_0068_01C3A875.1B0AD2C0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3700.6699" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Good days Mr. Morissette,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>I hope it is okey if I ask you a =
question about=20
mapscript labelling and also cc this question to maillist (as you have =
asked me=20
to do before)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>I have tried to label a streets layer =
in mapserver=20
and succeeded in a reasonbale way, names are not perfectly written but I =
guess=20
it all takes some playing around with MINSIZE and/or other values. I =
will do=20
that.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Before doing that, I tried to do the =
same thing in=20
my php/mapscript which used to run the same mapfile minus the labelling =
part. I=20
copied the mapserver-mapfile's labelled street layer and replaced it =
into the=20
place of the same non-labelled street layer in mapscript-mapfile. This =
is the=20
non-labeled layer of mapscript:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>LAYER<BR>  NAME=20
ERENKOY_ORNEKSOKAK_PL_polyline<BR>  GROUP sokaklar<BR>  TYPE=20
line<BR>  DATA ERENKOY_ORNEKSOKAK_PL_polyline<BR>  STATUS =
ON<BR> =20
CLASSITEM 'ID'<BR>  =
CLASS<BR>       =20
EXPRESSION /./<BR>   COLOR 66 34 249<BR>  =
END</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>END<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I removed the above and put this in its =
place=20
(which worked with mapserver):</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>LAYER<BR>  NAME=20
ERENKOY_ORNEKSOKAK_PL_polyline<BR>  TYPE LINE<BR>  GROUP=20
sokaklar<BR>  STATUS ON<BR>  DATA=20
ERENKOY_ORNEKSOKAK_PL_polyline<BR>  LABELITEM "ADI"<BR> =20
CLASS<BR>    NAME "ADI"<BR>    COLOR 161 =
02=20
110<BR>    LABEL<BR>      TYPE=20
truetype<BR>#      FORCE=20
true<BR>      FONT=20
arial<BR>      COLOR 0 0=20
0<BR>        ANGLE=20
AUTO<BR> #     BACKGROUNDCOLOR 250 250=20
250 <BR>      POSITION=20
AUTO<BR>        SIZE=20
0<BR>        MINSIZE=20
2<BR>      SIZE 6<BR>    =
END<BR> =20
END<BR>END<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>ADI is the coloumn in dbf which I am =
trying to use=20
for labelling. After this, mapscript stopped rendering images. Then =
hopelessly,=20
I added a few more lines to mapscript mapfile and it restarted to render =
maps=20
but with no labels. So the layer definition became:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>LAYER<BR>  NAME=20
ERENKOY_ORNEKSOKAK_PL_polyline<BR>  TYPE line<BR>  GROUP=20
sokaklar<BR>  STATUS ON<BR>  DATA=20
ERENKOY_ORNEKSOKAK_PL_polyline</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>    CLASSITEM =
'ID'<BR> =20
    CLASS<BR>       =
EXPRESSION=20
/./<BR>      COLOR 66 34 249<BR>  =
   =20
END<BR>   # LABELCACHE OFF<BR>    =
LABELITEM=20
'ADI'<BR>      CLASS<BR>   NAME=20
'ADI'<BR>    #EXPRESSION /./<BR>   COLOR 161 02 =

110<BR>    LABEL<BR>      TYPE=20
truetype<BR>#      FORCE=20
true<BR>      FONT=20
arial<BR>      COLOR 0 0=20
0<BR>       ANGLE=20
AUTO<BR>  #   BACKGROUNDCOLOR 250 250=20
250 <BR>      POSITION=20
AUTO<BR>        SIZE=20
0<BR>        MINSIZE=20
2<BR>      SIZE 8<BR>   END<BR>  =

END<BR>END<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>After the advice of Mr. Haseborg from =
the maillist=20
I added $myMap->drawLabelCache($img) line right before =20
$img->saveWebImage(GIF,1,1,0) line.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Still no labels were written. This the =
point I am=20
stuck at. I have read a lot of mail archieves but found no=20
results....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Is there anything else to be added to =
the php code=20
or mapfile? How can I get the labelling to work with =
mapscript?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>(It is killing me to be a php-newbei =
and=20
mapscript-newbei at the same time...)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in advance:)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Have a nice day</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Murat Isik</DIV></FONT></BODY></HTML>

------=_NextPart_000_0068_01C3A875.1B0AD2C0--




More information about the MapServer-users mailing list