[Mapserver-users] LABEL and MYSQL
Dan Barron
dbarron at ddive.com
Wed Apr 30 07:23:41 PDT 2003
--=====================_81279281==.ALT
Content-Type: text/plain; charset="iso-8859-1"; format=flowed
Content-Transfer-Encoding: quoted-printable
Blaise,
Yes it can be done...here is some simple example code in php/mapscript and=
=20
the associated map file layer.
Dan
$map =3D ms_newMapObj($mapPath.$mapFile);
$image=3D$map->draw();
$testlayer =3D $map->getLayerByName("labels");
$testpt =3D ms_newPointObj();
$testpt->setXY( 200, 200 );
$testpt->draw($map, $testlayer, $image, 'labels', 'Hello World');
$testpt2 =3D ms_newPointObj();
$testpt2->setXY( 300, 200 );
$testpt2->draw($map, $testlayer, $image, 'labels2', 'GoodBye World');
LAYER
NAME labels
STATUS on
TRANSFORM false
TYPE annotation
CLASS
NAME labels
LABEL
type truetype
font verdana-bold
size 8
antialias true
backgroundshadowcolor 51 51 51
backgroundshadowsize 2 2
color 51 51 51
position UR
END
END
CLASS
NAME labels2
LABEL
type truetype
font coopperplate-gothic-bold
size 8
antialias true
backgroundshadowcolor 51 51 51
backgroundshadowsize 2 2
color 51 51 51
position UR
END
END
END
At 12:13 PM 4/30/2003 +0200, bpicinbono at worldonline.fr wrote:
LABEL and MYSQL
Hi everybody
One simple question :
Is it possible to have labels related to a field in a mysql database ?
In more details, I have some shapes files that I would like to label.
But the .dbf files related to my .shp files only contain one field (ID).
This field is used to make a link to a lot of datas in some mysql databases.
Using the basic label instruction of MapServer, I can only output labels
from the ID field of the .dbf files. Of course, I would like to output
labels with a field from the mysql databases.
Is that enough clear ?
If somebody can help me, it would be great.
If not, I would have to add a second field (in my .dbf files) used only
for labeling. Furthermore, this would duplicate this data because I also
need it in the Mysql databases; and it would make my databases handling
more complicated and by the way it would make me very sad because my
database managing works pretty well with only one field in the .dbf files,
and it's pretty simple.
Help needed ! Thanks a lot in advance.
Blaise
************ VITE, C'EST LE MOMENT DE VOUS ABONNER A L'ADSL !!! **********
Du 3 avril au 5 mai, s=E9rie limit=E9e ADSL 128K, cliquez vite ici :=20
http://register.tiscali.fr/adsl/
Offre promotionnelle soumise =E0 conditions, r=E9serv=E9e aux nouveaux=
abonn=E9s=20
ADSL Tiscali.
_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
--=====================_81279281==.ALT
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<html>
<body>
<tt>Blaise,<br><br>
Yes it can be done...here is some simple example code in php/mapscript
and the associated map file layer. <br><br>
Dan<br><br>
$map =3D ms_newMapObj($mapPath.$mapFile);<br>
$image=3D$map->draw();<br><br>
$testlayer =3D $map->getLayerByName("labels");<br>
$testpt =3D ms_newPointObj();<br>
$testpt->setXY( 200, 200 );<br>
$testpt->draw($map, $testlayer, $image, 'labels', 'Hello=20
World');<br>
$testpt2 =3D ms_newPointObj();<br>
$testpt2->setXY( 300, 200 );<br>
$testpt2->draw($map, $testlayer, $image, 'labels2', 'GoodBye
World');<br><br>
LAYER<br>
NAME labels<br>
STATUS on<br>
TRANSFORM false<br>
TYPE annotation<br>
CLASS<br>
NAME labels<br>
LABEL<br>
type truetype<br>
font verdana-bold<br>
size 8<br>
antialias true<br>
backgroundshadowcolor 51 51 51<br>
backgroundshadowsize 2 2<br>
color 51 51 51 <br>
position UR <br>
END<br>
END<br>
CLASS<br>
NAME labels2<br>
LABEL<br>
type truetype<br>
font coopperplate-gothic-bold<br>
size 8<br>
antialias true<br>
backgroundshadowcolor 51 51 51<br>
backgroundshadowsize 2 2<br>
color 51 51 51 <br>
position UR <br>
END<br>
END<br>
END<br><br>
<br>
At 12:13 PM 4/30/2003 +0200, bpicinbono at worldonline.fr wrote:<br><br>
LABEL and MYSQL<br><br>
Hi everybody<br><br>
One simple question :<br><br>
Is it possible to have labels related to a field in a mysql database
?<br><br>
In more details, I have some shapes files that I would like to
label.<br>
But the .dbf files related to my .shp files only contain one field
(ID).<br>
This field is used to make a link to a lot of datas in some mysql
databases.<br>
Using the basic label instruction of MapServer, I can only output
labels<br>
from the ID field of the .dbf files. Of course, I would like to
output<br>
labels with a field from the mysql databases.<br>
Is that enough clear ?<br><br>
If somebody can help me, it would be great.<br>
If not, I would have to add a second field (in my .dbf files) used
only<br>
for labeling. Furthermore, this would duplicate this data because I
also<br>
need it in the Mysql databases; and it would make my databases
handling<br>
more complicated and by the way it would make me very sad because=20
my<br>
database managing works pretty well with only one field in the .dbf
files,<br>
and it's pretty simple.<br><br>
Help needed ! Thanks a lot in advance.<br><br>
Blaise<br><br>
<br><br>
************ VITE, C'EST LE MOMENT DE VOUS ABONNER A L'ADSL !!!
**********<br>
Du 3 avril au 5 mai, s=E9rie limit=E9e ADSL 128K, cliquez vite ici :
<a href=3D"http://register.tiscali.fr/adsl/" eudora=3D"autourl">http://regis=
ter.tiscali.fr/adsl/</a>
<br>
Offre promotionnelle soumise =E0 conditions, r=E9serv=E9e aux nouveaux=
abonn=E9s ADSL Tiscali.<br><br>
<br><br>
_______________________________________________<br>
Mapserver-users mailing list<br>
Mapserver-users at lists.gis.umn.edu<br>
<a href=3D"http://lists.gis.umn.edu/mailman/listinfo/mapserver-users"=
eudora=3D"autourl">http://lists.gis.umn.edu/mailman/listinfo/mapserver-user=
s</a><br>
</body>
</html>
--=====================_81279281==.ALT--
More information about the MapServer-users
mailing list