moving an existing point

McGraw, Joanne mcgrawj at AGR.GC.CA
Thu Jun 2 13:04:38 EDT 2005


The information Camden provided (and me correcting my syntax from
'.setXY()' to '->setXY()') helped tremendously. Using file printouts, I
am now able to verify the point's current x and y position, set new x
and y coordinates and verify those have been set.

Unfortunately, when I drawMap(), the position of the corporate logo
remains at the original x,y position. I thought perhaps that I needed to
$layer->close(); to get the values properly assigned, but that just lost
the new x,y coordinate values.

Obviously, I thought the code below would work, but I appear to be
missing a step. Is there some way to "write" those new x,y values back
into the layer so that they are used by other functions accessing that
same point? 

Thank you very much Camden for getting me over that shape/point hurdle.
 
Cheers,
jtm 


$layer = $oMap->getLayerByName("copyright");
if (isset($layer)){
  $layer->open();
  $shape = $layer->getShape(-1, 0);
  $line = $shape->line(0);
  $point = $line->point(0);
  $oldX = $point->x;
  $oldY = $point->y;
  $newY = $oMap->height - 14.5; 
  $point->setXY($oldX, $newY);
}

$img = $oMap->draw();

//revert to original
if (isset($layer)){
  $point->setXY($oldX, $oldY);
  $layer->close();
}



More information about the mapserver-users mailing list