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

Murat Isik muratisik at megatek.com.tr
Tue Nov 11 09:59:01 EST 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>&nbsp;</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&nbsp;before)</FONT></DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>LAYER<BR>&nbsp; NAME=20
ERENKOY_ORNEKSOKAK_PL_polyline<BR>&nbsp; GROUP sokaklar<BR>&nbsp; TYPE=20
line<BR>&nbsp; DATA ERENKOY_ORNEKSOKAK_PL_polyline<BR>&nbsp; STATUS =
ON<BR>&nbsp;=20
CLASSITEM 'ID'<BR>&nbsp; =
CLASS<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
EXPRESSION /./<BR>&nbsp;&nbsp; COLOR 66 34 249<BR>&nbsp; =
END</FONT></DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>LAYER<BR>&nbsp; NAME=20
ERENKOY_ORNEKSOKAK_PL_polyline<BR>&nbsp; TYPE LINE<BR>&nbsp; GROUP=20
sokaklar<BR>&nbsp; STATUS ON<BR>&nbsp; DATA=20
ERENKOY_ORNEKSOKAK_PL_polyline<BR>&nbsp; LABELITEM "ADI"<BR>&nbsp;=20
CLASS<BR>&nbsp;&nbsp;&nbsp; NAME "ADI"<BR>&nbsp;&nbsp;&nbsp; COLOR 161 =
02=20
110<BR>&nbsp;&nbsp;&nbsp; LABEL<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TYPE=20
truetype<BR>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FORCE=20
true<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FONT=20
arial<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR 0 0=20
0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ANGLE=20
AUTO<BR>&nbsp;#&nbsp;&nbsp;&nbsp;&nbsp; BACKGROUNDCOLOR 250 250=20
250&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; POSITION=20
AUTO<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIZE=20
0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MINSIZE=20
2<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIZE 6<BR>&nbsp;&nbsp;&nbsp; =
END<BR>&nbsp;=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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>LAYER<BR>&nbsp; NAME=20
ERENKOY_ORNEKSOKAK_PL_polyline<BR>&nbsp; TYPE line<BR>&nbsp; GROUP=20
sokaklar<BR>&nbsp; STATUS ON<BR>&nbsp; DATA=20
ERENKOY_ORNEKSOKAK_PL_polyline</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;CLASSITEM =
'ID'<BR>&nbsp;=20
&nbsp;&nbsp;&nbsp; CLASS<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
EXPRESSION=20
/./<BR>&nbsp; &nbsp;&nbsp;&nbsp; COLOR 66 34 249<BR>&nbsp; =
&nbsp;&nbsp;&nbsp;=20
END<BR>&nbsp;&nbsp;&nbsp;# LABELCACHE OFF<BR>&nbsp;&nbsp;&nbsp; =
LABELITEM=20
'ADI'<BR>&nbsp; &nbsp;&nbsp;&nbsp; CLASS<BR>&nbsp;&nbsp; NAME=20
'ADI'<BR>&nbsp;&nbsp;&nbsp; #EXPRESSION /./<BR>&nbsp;&nbsp; COLOR 161 02 =

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

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-&gt;drawLabelCache($img) line right before =20
$img-&gt;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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in advance:)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Have a nice day</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</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