[Mapserver-users] ProBlem Drawing a Line(circle) AS a second Layer on top the first Layer

Terrence Lalla t_lalla20 at yahoo.com
Thu Feb 6 16:14:14 PST 2003


--0-2054944181-1044576854=:28754
Content-Type: text/plain; charset=us-ascii


Hello all,

// the code

<?php
dl("php_mapscript_37.dll");

$map = ms_newMapObj("try1.map");
      
function Cal($x,$y,$radius)
{
 
 $lineObj = ms_newLineObj();
 for ($i=0 ; $i <=360 ;$i = $i +10)
 {
  $angulo = deg2rad($i);
  $xcal = $x + ($radius*cos($angulo));
  $ycal = $y + ($radius*sin($angulo));
  $lineObj->addXY($xcal,$ycal);
 }
 return($lineObj);
}
     
$array=$map->getAllLayerNames();
$p= ms_newpointObj();
$circle= ms_newshapeObj(MS_LINE);
$line= ms_newlineObj();
$layer = $map->getLayerByName('Circle');
$class = $layer->getClass(0);
$image = $map->draw();

$x=200;
$y=200;
$radius = 50;
$line = Cal($x,$y,$radius);
$test=$circle->add($line);
$test1=$circle->draw($map,$layer,$image,undef,"damage");
var_dump($line);
var_dump($test);
var_dump($test1);
$image_url = $image->saveWebImage(MS_GIF,1,1,0);
?>
//end code 

comments: the line show the $line->numpoints member containing the appropriate number of points. However for the $circle->add($line) the result returns int(0). I suppose that the process failed. Also, for the $test1=$circle->draw($map,$layer,$image,undef,"damage") the result returns int(0). Hence the circle layer is not drawn on top the first layer.

 

//mapscript code

NAME Trinidad

EXTENT 606030.98 1108051.15 739443.72 1201934.19

SIZE 400 400

UNITS METERS

SHAPEPATH "data"

WEB

IMAGEPATH "c:\apache\htdocs\tmp\"

IMAGEURL "\tmp\"

END

LAYER

NAME "Coastline1"

DATA coastline1

STATUS ON

TYPE line

CLASS

COLOR 220 220 220

OUTLINECOLOR 100 100 100

END

END

LAYER

NAME "Circle"

STATUS on

TYPE Point

CLASS

COLOR 220 220 220

OUTLINECOLOR 100 100 100

END

END

 

END

//end mapscript code.

Can anyone suggest a possible solution to the problem ?

Also for the x,y, and radius values should I use pixel coordinates or georef coordinates for the map?

Thanks in Advance.

Terrence




---------------------------------
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now
--0-2054944181-1044576854=:28754
Content-Type: text/html; charset=us-ascii

<P>Hello all,</P>
<P>// the code</P>
<P><?php<BR>dl("php_mapscript_37.dll");</P>
<P>$map = ms_newMapObj("try1.map");<BR>      <BR>function Cal($x,$y,$radius)<BR>{<BR> <BR> $lineObj = ms_newLineObj();<BR> for ($i=0 ; $i <=360 ;$i = $i +10)<BR> {<BR>  $angulo = deg2rad($i);<BR>  $xcal = $x + ($radius*cos($angulo));<BR>  $ycal = $y + ($radius*sin($angulo));<BR>  $lineObj->addXY($xcal,$ycal);<BR> }<BR> return($lineObj);<BR>}<BR>     <BR>$array=$map->getAllLayerNames();<BR>$p= ms_newpointObj();<BR>$circle= ms_newshapeObj(MS_LINE);<BR>$line= ms_newlineObj();<BR>$layer = $map->getLayerByName('Circle');<BR>$class = $layer->getClass(0);<BR>$image = $map->draw();</P>
<P>$x=200;<BR>$y=200;<BR>$radius = 50;<BR>$line = Cal($x,$y,$radius);<BR>$test=$circle->add($line);<BR>$test1=$circle->draw($map,$layer,$image,undef,"damage");<BR>var_dump($line);<BR>var_dump($test);<BR>var_dump($test1);<BR>$image_url = $image->saveWebImage(MS_GIF,1,1,0);<BR>?><BR>//end code </P>
<P>comments: the line show the $line->numpoints member containing the appropriate number of points. However for the $circle->add($line) the result returns int(0). I suppose that the process failed. Also, for the $test1=$circle->draw($map,$layer,$image,undef,"damage") the result returns int(0). Hence the circle layer is not drawn on top the first layer.</P>
<P> </P>
<P>//mapscript code</P><FONT size=2>
<P>NAME Trinidad</P>
<P>EXTENT 606030.98 1108051.15 739443.72 1201934.19</P>
<P>SIZE 400 400</P>
<P>UNITS METERS</P>
<P>SHAPEPATH "data"</P>
<P>WEB</P>
<P>IMAGEPATH "c:\apache\htdocs\tmp\"</P>
<P>IMAGEURL "\tmp\"</P>
<P>END</P>
<P>LAYER</P>
<P>NAME "Coastline1"</P>
<P>DATA coastline1</P>
<P>STATUS ON</P>
<P>TYPE line</P>
<P>CLASS</P>
<P>COLOR 220 220 220</P>
<P>OUTLINECOLOR 100 100 100</P>
<P>END</P>
<P>END</P>
<P>LAYER</P>
<P>NAME "Circle"</P>
<P>STATUS on</P>
<P>TYPE Point</P>
<P>CLASS</P>
<P>COLOR 220 220 220</P>
<P>OUTLINECOLOR 100 100 100</P>
<P>END</P>
<P>END</P>
<P> </P>
<P>END</P>
<P></FONT>//end mapscript code.</P>
<P>Can anyone suggest a possible solution to the problem ?</P>
<P>Also for the x,y, and radius values should I use pixel coordinates or georef coordinates for the map?</P>
<P>Thanks in Advance.</P>
<P>Terrence<BR></P><p><br><hr size=1>Do you Yahoo!?<br>
<a href="http://rd.yahoo.com/mail/mailsig/*http://mailplus.yahoo.com">Yahoo! Mail Plus</a> - Powerful. Affordable. <a href="http://rd.yahoo.com/mail/mailsig/*http://mailplus.yahoo.com">Sign up now</a>
--0-2054944181-1044576854=:28754--



More information about the MapServer-users mailing list