[Mapserver-users] dynamic pointing problem
Murat Isik
muratisik at megatek.com.tr
Thu Oct 30 08:04:05 PST 2003
This is a multi-part message in MIME format.
------=_NextPart_000_0115_01C39F10.34D14950
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello,
I have been trying to write a php code that prints a point at a certain =
coordinate on a map. I have taken example from a few mails of this list, =
however although it seems ok to me, it does not work, does not even =
display the actual map. The php code and the map file are very simple =
and are the following:
<HTML>
<HEAD>
<TITLE>Displaying a Point</TITLE>
</HEAD>
<CENTER>
<H1>DYNAMIC POINT</H1>
<P>
<?php
dl("php_mapscript.so");
$map =3D ms_newMapObj("demo_try.map");
$image=3D$map->draw();
$layer =3D $map->getLayerByName("point");
$layer->set('status', MS_ON);
$pt =3D ms_newPointObj();
$x =3D 29.1;
$y =3D 40.97;
$pt->setXY($x, $y);
$pt->draw($map,$layer,$image, 0, "DENEME");
$image_url=3D$image->saveWebImage();
$image_url=3D$image->saveWebImage(MS_GIF,1,1,90); // tried this line =
with=20
=
// $image_url=3D$image->saveWebImage(); too.
?>
<BODY>
<IMG SRC=3D<?php echo $image_url; ?> >
</BODY>
</HTML>
map file:
#
# Start of map file
#
NAME ERENKOY
STATUS ON
SIZE 600 600
EXTENT 29.057 40.954 29.143 40.999
UNITS DD
SHAPEPATH "data"
IMAGECOLOR 255 255 255
IMAGETYPE PNG
WEB
MINSCALE 1000
MAXSCALE 1550000
IMAGEPATH "/var/www/html/mapserver/tmp3/"
IMAGEURL "/mapserver/tmp3/"
END
SYMBOL
NAME 'circle'
TYPE ELLIPSE
POINTS 1 1 END
FILLED TRUE
END
LAYER
NAME 'ERENKOY_ORNEKILCE_PG_region'
TYPE polygon
STATUS DEFAULT
DATA ERENKOY_ORNEKILCE_PG_region
CLASSITEM 'ID'
CLASS
EXPRESSION '3'
OUTLINECOLOR 128 128 128
COLOR 225 225 185
END
CLASS=20
EXPRESSION /./
OUTLINECOLOR 128 128 128
COLOR 255 255 255
END
END
LAYER
NAME 'point'
TYPE point
STATUS ON
CLASS
SYMBOL 'circle'
COLOR 255 0 0
SIZE 20
LABEL
COLOR 0 0 0
END
END
END
END # end of map file
I think the lie this script "crashes" is:=20
$layer =3D $map->getLayerByName("point");
Can anyone tell me what's wrong here? Any ideas?=20
Thanks...
Have a nice day
Murat Isik
------=_NextPart_000_0115_01C39F10.34D14950
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 http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1226" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Hello,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I have been trying to write a php code =
that prints=20
a point at a certain coordinate on a map. I have taken example from a =
few mails=20
of this list, however although it seems ok to me, it does not work, does =
not=20
even display the actual map. The php code and the map file are very =
simple and=20
are the following:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial=20
size=3D2><HTML><BR><HEAD><BR><TITLE>Displaying a=20
Point</TITLE><BR></HEAD></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV><FONT face=3DArial =
size=3D2>
<DIV><BR><CENTER></DIV>
<DIV> </DIV>
<DIV><H1>DYNAMIC=20
POINT</H1><BR><P><BR><?php<BR>dl("php_mapscript.so");</DIV=
>
<DIV> </DIV>
<DIV>$map =3D =
ms_newMapObj("demo_try.map");<BR>$image=3D$map->draw();<BR>$layer =3D =
$map->getLayerByName("point");<BR>$layer->set('status', =
MS_ON);<BR>$pt =3D=20
ms_newPointObj();<BR>$x =3D 29.1;<BR>$y =3D 40.97;<BR>$pt->setXY($x,=20
$y);<BR>$pt->draw($map,$layer,$image, 0,=20
"DENEME");<BR>$image_url=3D$image->saveWebImage();<BR>$image_url=3D$im=
age->saveWebImage(MS_GIF,1,1,90);=20
// tried this line with </DIV>
<DIV> &n=
bsp; &nb=
sp; &nbs=
p;  =
; =
&=
nbsp; //=20
$image_url=3D$image->saveWebImage();=20
too.<BR><BR><BR>?><BR><BODY><BR><IMG SRC=3D<?php echo =
$image_url;=20
?> ><BR></BODY><BR></HTML></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>map file:</DIV>
<DIV> </DIV>
<DIV>#<BR># Start of map file<BR>#<BR>NAME ERENKOY<BR>STATUS ON<BR>SIZE =
600=20
600<BR>EXTENT 29.057 40.954 29.143 40.999<BR>UNITS DD<BR>SHAPEPATH=20
"data"<BR>IMAGECOLOR 255 255 255</DIV>
<DIV> </DIV>
<DIV><BR>IMAGETYPE PNG</DIV>
<DIV> </DIV>
<DIV><BR>WEB<BR> MINSCALE 1000<BR> MAXSCALE =
1550000<BR> =20
IMAGEPATH "/var/www/html/mapserver/tmp3/"<BR> IMAGEURL=20
"/mapserver/tmp3/"<BR>END</DIV>
<DIV> </DIV>
<DIV><BR>SYMBOL<BR> NAME 'circle'<BR> TYPE ELLIPSE<BR> =
POINTS=20
1 1 END<BR> FILLED TRUE<BR>END</DIV>
<DIV> </DIV>
<DIV><BR>LAYER<BR> NAME 'ERENKOY_ORNEKILCE_PG_region'<BR> =
TYPE=20
polygon<BR> STATUS DEFAULT<BR> DATA=20
ERENKOY_ORNEKILCE_PG_region</DIV>
<DIV> </DIV>
<DIV> CLASSITEM 'ID'<BR> CLASS<BR> =
EXPRESSION=20
'3'<BR> OUTLINECOLOR 128 128 128<BR> =
COLOR=20
225 225 185<BR> END<BR> CLASS <BR> =
EXPRESSION=20
/./<BR> OUTLINECOLOR 128 128 128<BR> =
COLOR=20
255 255 255<BR> END</DIV>
<DIV> </DIV>
<DIV>END</DIV>
<DIV> </DIV>
<DIV>LAYER<BR> NAME 'point'<BR> TYPE point<BR> STATUS=20
ON<BR> CLASS<BR> SYMBOL=20
'circle'<BR> COLOR 255 0 0<BR> SIZE=20
20<BR> LABEL<BR> =
COLOR 0 0=20
0<BR> END<BR> END</DIV>
<DIV> </DIV>
<DIV>END</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>END # end of map file<BR></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>I think the lie this script "crashes" is: </DIV>
<DIV> </DIV>
<DIV>$layer =3D $map->getLayerByName("point");<BR></DIV>
<DIV>Can anyone tell me what's wrong here? Any ideas? </DIV>
<DIV> </DIV>
<DIV>Thanks...</DIV>
<DIV> </DIV>
<DIV>Have a nice day</DIV>
<DIV> </DIV>
<DIV>Murat Isik</DIV></FONT></BODY></HTML>
------=_NextPart_000_0115_01C39F10.34D14950--
More information about the MapServer-users
mailing list