[Mapserver-users] dynamic pointing problem

Murat Isik muratisik at megatek.com.tr
Thu Oct 30 11:04:05 EST 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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Hello,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
size=3D2>&lt;HTML&gt;<BR>&lt;HEAD&gt;<BR>&lt;TITLE&gt;Displaying a=20
Point&lt;/TITLE&gt;<BR>&lt;/HEAD&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV><FONT face=3DArial =
size=3D2>
<DIV><BR>&lt;CENTER&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&lt;H1&gt;DYNAMIC=20
POINT&lt;/H1&gt;<BR>&lt;P&gt;<BR>&lt;?php<BR>dl("php_mapscript.so");</DIV=
>
<DIV>&nbsp;</DIV>
<DIV>$map =3D =
ms_newMapObj("demo_try.map");<BR>$image=3D$map-&gt;draw();<BR>$layer =3D =

$map-&gt;getLayerByName("point");<BR>$layer-&gt;set('status', =
MS_ON);<BR>$pt =3D=20
ms_newPointObj();<BR>$x =3D 29.1;<BR>$y =3D 40.97;<BR>$pt-&gt;setXY($x,=20
$y);<BR>$pt-&gt;draw($map,$layer,$image, 0,=20
"DENEME");<BR>$image_url=3D$image-&gt;saveWebImage();<BR>$image_url=3D$im=
age-&gt;saveWebImage(MS_GIF,1,1,90);=20
// tried this line with </DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//=20
$image_url=3D$image-&gt;saveWebImage();=20
too.<BR><BR><BR>?&gt;<BR>&lt;BODY&gt;<BR>&lt;IMG SRC=3D&lt;?php echo =
$image_url;=20
?&gt; &gt;<BR>&lt;/BODY&gt;<BR>&lt;/HTML&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>map file:</DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV><BR>IMAGETYPE PNG</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>WEB<BR>&nbsp; MINSCALE 1000<BR>&nbsp; MAXSCALE =
1550000<BR>&nbsp;=20
IMAGEPATH "/var/www/html/mapserver/tmp3/"<BR>&nbsp; IMAGEURL=20
"/mapserver/tmp3/"<BR>END</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>SYMBOL<BR>&nbsp; NAME 'circle'<BR>&nbsp; TYPE ELLIPSE<BR>&nbsp; =
POINTS=20
1 1 END<BR>&nbsp; FILLED TRUE<BR>END</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>LAYER<BR>&nbsp; NAME 'ERENKOY_ORNEKILCE_PG_region'<BR>&nbsp; =
TYPE=20
polygon<BR>&nbsp; STATUS DEFAULT<BR>&nbsp; DATA=20
ERENKOY_ORNEKILCE_PG_region</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; CLASSITEM 'ID'<BR>&nbsp; CLASS<BR>&nbsp;&nbsp;&nbsp; =
EXPRESSION=20
'3'<BR>&nbsp;&nbsp;&nbsp; OUTLINECOLOR 128 128 128<BR>&nbsp;&nbsp;&nbsp; =
COLOR=20
225 225 185<BR>&nbsp; END<BR>&nbsp; CLASS <BR>&nbsp;&nbsp;&nbsp; =
EXPRESSION=20
/./<BR>&nbsp;&nbsp;&nbsp; OUTLINECOLOR 128 128 128<BR>&nbsp;&nbsp;&nbsp; =
COLOR=20
255 255 255<BR>&nbsp; END</DIV>
<DIV>&nbsp;</DIV>
<DIV>END</DIV>
<DIV>&nbsp;</DIV>
<DIV>LAYER<BR>&nbsp; NAME 'point'<BR>&nbsp; TYPE point<BR>&nbsp; STATUS=20
ON<BR>&nbsp;&nbsp; CLASS<BR>&nbsp;&nbsp;&nbsp; SYMBOL=20
'circle'<BR>&nbsp;&nbsp;&nbsp; COLOR 255 0 0<BR>&nbsp;&nbsp;&nbsp; SIZE=20
20<BR>&nbsp;&nbsp;&nbsp;&nbsp; LABEL<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
COLOR 0 0=20
0<BR>&nbsp;&nbsp;&nbsp;&nbsp; END<BR>&nbsp;&nbsp; END</DIV>
<DIV>&nbsp;</DIV>
<DIV>END</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>END # end of map file<BR></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>I think the lie this script "crashes" is: </DIV>
<DIV>&nbsp;</DIV>
<DIV>$layer =3D $map-&gt;getLayerByName("point");<BR></DIV>
<DIV>Can anyone tell me what's wrong here? Any ideas? </DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks...</DIV>
<DIV>&nbsp;</DIV>
<DIV>Have a nice day</DIV>
<DIV>&nbsp;</DIV>
<DIV>Murat Isik</DIV></FONT></BODY></HTML>

------=_NextPart_000_0115_01C39F10.34D14950--




More information about the mapserver-users mailing list