[Mapserver-users] cant label streets in mapscript -- please help
Murat Isik
muratisik at megatek.com.tr
Tue Nov 11 14:57:40 PST 2003
Thank you:)
I did the test with the following php code and mapfile to get the same
labelless result :(
<HEAD>
<TITLE>TEST</TITLE>
</HEAD>
<CENTER>
<?php
dl("php_mapscript.so");
$map = ms_newMapObj("demo_try2.map");
$img = $map->draw();
$map->drawLabelCache($img); //tried with commentted too.
$url = $img->saveWebImage(GIF,1,1,0);
# echo <img src="$url">;
#echo <img src=/"$url">;
?>
<INPUT TYPE="image" SRC="<?php echo $url; ?>">
mapfile:
NAME ERENKOY
STATUS ON
SIZE 600 600
EXTENT 29.057 40.954 29.143 40.999
UNITS DD
SHAPEPATH "/var/www/html/mapserver/itasca/"
IMAGECOLOR 255 255 255
FONTSET "/var/www/html/mapserver/itasca/font.list"
IMAGETYPE GIF
WEB
MINSCALE 1000
MAXSCALE 1550000
IMAGEPATH "/var/www/html/mapserver/tmp3/"
IMAGEURL "/mapserver/tmp3/"
END
LAYER
NAME ERENKOY_ORNEKSOKAK_PL_polyline
TYPE line
STATUS ON
DATA ERENKOY_ORNEKSOKAK_PL_polyline
CLASSITEM 'ID'
CLASS
EXPRESSION /./
COLOR 66 34 249
END
LABELCACHE ON
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
POSITION AUTO
SIZE 0
MINSIZE 2
SIZE 8
END
END
END
END
Have a nice day
Murat Isik
----- Original Message -----
From: "Frieso ter Haseborg" <ter-haseborg at sf-datentechnik.de>
To: "Murat Isik" <muratisik at megatek.com.tr>
Cc: <mapserver-users at lists.gis.umn.edu>
Sent: Tuesday, November 11, 2003 7:38 PM
Subject: RE: [Mapserver-users] cant label streets in mapscript -- please
help
> Hi,
>
> for better debugging you perhaps should simplify your mapfile as far as
> possible. Only one layer, one class, one label-object, no expressions if
> not really needed, just to get rid of any possible side effects.
>
> For example a label-definition like
> LABEL
> COLOR 0 0 0
> END
> should do for a label to be drawn.
>
> But I'm not sure if the mapfile is really your problem. Next step would
> be to reduce your php to the important. Try first to draw one point,
> with label. Just write a testscript to only do this little thing. And
> then post this snippet, if it doesn't work, not your whole application.
> ;-)
>
> Best regards,
> Frieso
>
>
>
> -----Original Message-----
> From: Murat Isik [mailto:muratisik at megatek.com.tr]
> Sent: Tuesday, November 11, 2003 3:59 PM
> To: Daniel Morissette
> Cc: mapserver-users at lists.gis.umn.edu
> Subject: [Mapserver-users] cant label streets in mapscript -- please
> help
>
>
> 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
> 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
> 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
>
>
More information about the MapServer-users
mailing list