[Mapserver-users] why can't I draw a point on my map?

Chris Black cblack at CalAcademy.Org
Mon Feb 17 16:19:07 EST 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. &nbsp;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. &nbsp;Has anyone got anything more to offer?<br>
<br>
makedot.pho:<br>
--------- cut here --------------<br>
&lt;?php<br>
<br>
dl('php_mapscript_36.dll'); <br>
<br>
$map_path="c:\\inetpub\\wwwroot\\mapserverapps\\izg\\";<br>
&nbsp;&nbsp;&nbsp; <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-&gt;set("status", MS_ON);<br>
$dot_class = ms_newClassObj($crab_layer);<br>
$dot_class-&gt;set("status", MS_ON);<br>
$image=$map-&gt;draw();<br>
$crab_here = ms_newpointobj();<br>
$crab_here-&gt;setXY(233, 340, 0);<br>
$crab_here-&gt;draw($map, $crab_layer, $image, 0, "");<br>
$image_url=$image-&gt;saveWebImage(MS_GIF,1,1,0);<br>
<br>
?&gt;<br>
&lt;HTML&gt;<br>
&lt;HEAD&gt;<br>
&lt;TITLE&gt;Map&lt;/TITLE&gt;<br>
&lt;/HEAD&gt;<br>
&lt;BODY&gt;<br>
&lt;CENTER&gt;<br>
&lt;img src="&lt;?php echo $image_url?&gt;" alt="bay map"&gt;<br>
&lt;/CENTER&gt;<br>
&lt;/BODY&gt;<br>
&lt;/HMTL&gt;<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.&nbsp; Unfortunately, you can't comment a whole block<br>
# of code or text in MapServer.&nbsp; 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>
&nbsp;&nbsp;&nbsp; TEMPLATE ZoomableIZG.html<br>
&nbsp;&nbsp;&nbsp; IMAGEPATH "C:\inetpub\wwwroot\MapServerApps\data\tmp\"<br>
&nbsp;&nbsp;&nbsp; IMAGEURL "/MapServerApps/data/tmp/"<br>
&nbsp;&nbsp;&nbsp; LOG "c:\inetpub\wwwroot\mapserverapps\izg\mapserverlog.txt"<br>
END # WEB<br>
REFERENCE<br>
&nbsp;&nbsp;&nbsp; STATUS ON<br>
&nbsp;&nbsp;&nbsp; SIZE 144 123<br>
&nbsp;&nbsp;&nbsp; IMAGE "C:\inetpub\wwwroot\mapserverapps\izg\images\REFIMG.gif"<br>
&nbsp;&nbsp;&nbsp; EXTENT 509945 4236585 629120 4135472<br>
&nbsp;&nbsp;&nbsp; COLOR -1 -1 -1<br>
&nbsp;&nbsp;&nbsp; OUTLINECOLOR 255 0 0<br>
END # REFERENCE<br>
<br>
<br>
#LAYER<br>
&nbsp;&nbsp;&nbsp; #data "raster\relief.jpg"<br>
&nbsp;&nbsp;&nbsp; #NAME "bayraster"<br>
&nbsp;&nbsp;&nbsp; #STATUS DEFAULT<br>
&nbsp;&nbsp;&nbsp; #TYPE RASTER<br>
#END # LAYER<br>
LAYER # start of the "calcounties" layer object<br>
&nbsp; NAME "calcounties"<br>
&nbsp; DATA "vector\bayctys"<br>
&nbsp; STATUS DEFAULT<br>
&nbsp; TYPE POLYGON<br>
&nbsp; LABELITEM "Name"<br>
&nbsp; CLASS<br>
&nbsp;&nbsp;&nbsp; OUTLINECOLOR 204 0 0<br>
&nbsp; 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 &amp; 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-&gt;set("status", MS_ON);
$dot_class = ms_newClassObj($crab_layer);
$dot_class-&gt;set("status", MS_ON);
$image=$map-&gt;draw();
$crab_here = ms_newpointobj();
$crab_here-&gt;setXY(233, 340, 0);
$crab_here-&gt;draw($map, $crab_layer, $image, 0, "");
$image_url=$image-&gt;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