[Mapserver-users] why can't I draw a point on my map?
Chris Black
cblack at CalAcademy.Org
Mon Feb 17 13:19:07 PST 2003
--------------050800060503070507060900
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Thanks fr your suggestions, Attila. Unfortunately, my code's still not
working -- I don't see a dot and, if I give a non-empty label, I don't
see the label either. Has anyone got anything more to offer?
makedot.pho:
--------- cut here --------------
<?php
dl('php_mapscript_36.dll');
$map_path="c:\\inetpub\\wwwroot\\mapserverapps\\izg\\";
$map_file="zoomableizg.map";
// Default values and configuration
$map = ms_newMapObj($map_path.$map_file);
$crab_layer = ms_newlayerObj($map);
$crab_layer->set("status", MS_ON);
$dot_class = ms_newClassObj($crab_layer);
$dot_class->set("status", MS_ON);
$image=$map->draw();
$crab_here = ms_newpointobj();
$crab_here->setXY(233, 340, 0);
$crab_here->draw($map, $crab_layer, $image, 0, "");
$image_url=$image->saveWebImage(MS_GIF,1,1,0);
?>
<HTML>
<HEAD>
<TITLE>Map</TITLE>
</HEAD>
<BODY>
<CENTER>
<img src="<?php echo $image_url?>" alt="bay map">
</CENTER>
</BODY>
</HMTL>
------------ cut here ---------------
zoomableizg.map:
------------------ cut here ----------------
# Note: Comments in a map file are preceeded by the pound (#) sign.
# When MapServer encounters the pound sign, it will ignore the
# rest of the line. Unfortunately, you can't comment a whole block
# of code or text in MapServer. So, you're stuck with adding pound
# signs for every line you wish to comment out.
NAME CALCTYEX1
EXTENT 509945 4236585 629120 4135472
SIZE 709 606
UNITS METERS
SHAPEPATH "C:\inetpub\wwwroot\MapServerApps\IZG\data\"
WEB
TEMPLATE ZoomableIZG.html
IMAGEPATH "C:\inetpub\wwwroot\MapServerApps\data\tmp\"
IMAGEURL "/MapServerApps/data/tmp/"
LOG "c:\inetpub\wwwroot\mapserverapps\izg\mapserverlog.txt"
END # WEB
REFERENCE
STATUS ON
SIZE 144 123
IMAGE "C:\inetpub\wwwroot\mapserverapps\izg\images\REFIMG.gif"
EXTENT 509945 4236585 629120 4135472
COLOR -1 -1 -1
OUTLINECOLOR 255 0 0
END # REFERENCE
#LAYER
#data "raster\relief.jpg"
#NAME "bayraster"
#STATUS DEFAULT
#TYPE RASTER
#END # LAYER
LAYER # start of the "calcounties" layer object
NAME "calcounties"
DATA "vector\bayctys"
STATUS DEFAULT
TYPE POLYGON
LABELITEM "Name"
CLASS
OUTLINECOLOR 204 0 0
END # CLASS
END # LAYER
END # FILE
--------- cut here -------------------
Attila Csipa wrote:
>On Friday 14 February 2003 21:49, you wrote:
>
>
>>up an early prototype, just trying to draw a one-layer map and then put
>>a dot on it at a particular location. I don't see the dot or its label.
>> Am I missing a step? I wasn't sure whether the x & y coordinates
>>
>>
>
>I had a similar problem and it turned out that the order of commands is
>relevant, even at places where it might seem it is not. So I would try
>something like:
>
>
>
>>$map = ms_newMapObj($map_path.$map_file);
>>$crab_layer = ms_newlayerObj($map);
>>$crab_layer->set("status", MS_ON);
>>$dot_class = ms_newClassObj($crab_layer);
>>$dot_class->set("status", MS_ON);
>>$image=$map->draw();
>>$crab_here = ms_newpointobj();
>>$crab_here->setXY(233, 340, 0);
>>$crab_here->draw($map, $crab_layer, $image, 0, "");
>>$image_url=$image->saveWebImage(MS_GIF,1,1,0);
>>
>>
>
>Note that if you use a point and put text over right over it you might not
>see the point (maybe this was intended ?).
>
>
>Regards,
>Attila
>
>
--------------050800060503070507060900
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body>
Thanks fr your suggestions, Attila. Unfortunately, my code's still not working
-- I don't see a dot and, if I give a non-empty label, I don't see the label
either. Has anyone got anything more to offer?<br>
<br>
makedot.pho:<br>
--------- cut here --------------<br>
<?php<br>
<br>
dl('php_mapscript_36.dll'); <br>
<br>
$map_path="c:\\inetpub\\wwwroot\\mapserverapps\\izg\\";<br>
<br>
$map_file="zoomableizg.map";<br>
<br>
// Default values and configuration<br>
<br>
$map = ms_newMapObj($map_path.$map_file);<br>
$crab_layer = ms_newlayerObj($map);<br>
$crab_layer->set("status", MS_ON);<br>
$dot_class = ms_newClassObj($crab_layer);<br>
$dot_class->set("status", MS_ON);<br>
$image=$map->draw();<br>
$crab_here = ms_newpointobj();<br>
$crab_here->setXY(233, 340, 0);<br>
$crab_here->draw($map, $crab_layer, $image, 0, "");<br>
$image_url=$image->saveWebImage(MS_GIF,1,1,0);<br>
<br>
?><br>
<HTML><br>
<HEAD><br>
<TITLE>Map</TITLE><br>
</HEAD><br>
<BODY><br>
<CENTER><br>
<img src="<?php echo $image_url?>" alt="bay map"><br>
</CENTER><br>
</BODY><br>
</HMTL><br>
<br>
<br>
------------ cut here ---------------<br>
<br>
zoomableizg.map:<br>
------------------ cut here ----------------<br>
# Note: Comments in a map file are preceeded by the pound (#) sign. <br>
# When MapServer encounters the pound sign, it will ignore the <br>
# rest of the line. Unfortunately, you can't comment a whole block<br>
# of code or text in MapServer. So, you're stuck with adding pound<br>
# signs for every line you wish to comment out.<br>
<br>
<br>
NAME CALCTYEX1<br>
EXTENT 509945 4236585 629120 4135472<br>
SIZE 709 606<br>
UNITS METERS<br>
SHAPEPATH "C:\inetpub\wwwroot\MapServerApps\IZG\data\"<br>
<br>
WEB<br>
TEMPLATE ZoomableIZG.html<br>
IMAGEPATH "C:\inetpub\wwwroot\MapServerApps\data\tmp\"<br>
IMAGEURL "/MapServerApps/data/tmp/"<br>
LOG "c:\inetpub\wwwroot\mapserverapps\izg\mapserverlog.txt"<br>
END # WEB<br>
REFERENCE<br>
STATUS ON<br>
SIZE 144 123<br>
IMAGE "C:\inetpub\wwwroot\mapserverapps\izg\images\REFIMG.gif"<br>
EXTENT 509945 4236585 629120 4135472<br>
COLOR -1 -1 -1<br>
OUTLINECOLOR 255 0 0<br>
END # REFERENCE<br>
<br>
<br>
#LAYER<br>
#data "raster\relief.jpg"<br>
#NAME "bayraster"<br>
#STATUS DEFAULT<br>
#TYPE RASTER<br>
#END # LAYER<br>
LAYER # start of the "calcounties" layer object<br>
NAME "calcounties"<br>
DATA "vector\bayctys"<br>
STATUS DEFAULT<br>
TYPE POLYGON<br>
LABELITEM "Name"<br>
CLASS<br>
OUTLINECOLOR 204 0 0<br>
END # CLASS<br>
END # LAYER<br>
END # FILE<br>
<br>
--------- cut here -------------------<br>
<br>
Attila Csipa wrote:<br>
<blockquote type="cite"
cite="mid200302142239.h1EMcxx05168 at tina2.tippnet.co.yu">
<pre wrap="">On Friday 14 February 2003 21:49, you wrote:
</pre>
<blockquote type="cite">
<pre wrap="">up an early prototype, just trying to draw a one-layer map and then put
a dot on it at a particular location. I don't see the dot or its label.
Am I missing a step? I wasn't sure whether the x & y coordinates
</pre>
</blockquote>
<pre wrap=""><!---->
I had a similar problem and it turned out that the order of commands is
relevant, even at places where it might seem it is not. So I would try
something like:
</pre>
<blockquote type="cite">
<pre wrap="">$map = ms_newMapObj($map_path.$map_file);
$crab_layer = ms_newlayerObj($map);
$crab_layer->set("status", MS_ON);
$dot_class = ms_newClassObj($crab_layer);
$dot_class->set("status", MS_ON);
$image=$map->draw();
$crab_here = ms_newpointobj();
$crab_here->setXY(233, 340, 0);
$crab_here->draw($map, $crab_layer, $image, 0, "");
$image_url=$image->saveWebImage(MS_GIF,1,1,0);
</pre>
</blockquote>
<pre wrap=""><!---->
Note that if you use a point and put text over right over it you might not
see the point (maybe this was intended ?).
Regards,
Attila
</pre>
</blockquote>
<br>
</body>
</html>
--------------050800060503070507060900--
More information about the MapServer-users
mailing list