[mapserver-users] Drawing a Line From A Set Start Point to End Point

wallacher at innomis wallacher at innomis.com
Thu Jul 17 04:05:46 EDT 2008


Hi Lena, if tried this code and it works.

$mypoints=array(
   array(1,1),  // 1. point
   array(40,1),  // 1. point
   array(40,80),  // 1. point
   array(1,80),  // 1. point
   array(1,1),  // 1. point
)
$myline=ms_newLineObj();
foreach ($mypoints as $key => $value) {
    $myline->addXY($value[0],$value[1]);
}

//Create the shape object that will be added to the layer
$shape=ms_newShapeObj(MS_SHAPE_LINE);
$shape->add($myline);
$this_layer_tornado->addFeature($shape);

Erik

> Hello,
> I am trying to draw tornado paths on my map that I am creating, but I 
> am having a little bit of trouble because now it won't even plot the 
> initial point on my map. The following is my code for attempting to 
> draw a line from start to finish. If anyone has any helpful 
> information, it would be greatly appreciated
>
> while($row=mysql_fetch_assoc($result)){
>      $mypoint=ms_newPointObj();
>      $mypoint->setXY($row['lon_td'],$row['lat_td']);
>      $myline=ms_newLineObj();
>      $myline->add($mypoint);
>      $endpoint=ms_newPointObj();
>      $endpoint->setXY($row['lon_lift'],$row['lat_lift']);
>      $myline->add($endpoint);
>      $mypoint->draw($map,$this_layer_tornado,$image,0,'');
> }
>
> //Create the shape object that will be added to the layer
> $shape=ms_newShapeObj(MS_SHAPE_LINE);
> $shape->add($myline);
> $this_layer_tornado->addFeature($shape);
>
> Thank you,
> Lena
>
> -- 
> *Lena Olympio*
> ------------------------------------------------------------------------
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>   



More information about the mapserver-users mailing list