Shape object

Jeppe Lund Andersen JXA at COWI.DK
Thu Aug 9 01:37:25 PDT 2007


Hello all
 
Iam trying to get the x and y out of a shape object 
the shape object has 3 holes in it 
and when I loop through it I cannot see if it is a hole or not.
 
I could say that the first one is the shape and the rest is the holes,
but that will not work if I have a multipolygon with holes
is there any way to see if the shape I have is a hole.
 
hope any one can help me
 
jeppe
 
This is the function I have made
 
function OutputShapeToXML($Shape, $Limit=NULL) {

  for ($I = 0; $I < $Shape->numlines; $I++) {
  $tmp = "";
    $Line = $Shape->line($I);
    echo '<polygon>';
 for ($J = 0; $J < $Line->numpoints; $J++) {
      $Point = $Line->point($J);
      if ($Limit && ($Point->x < $Limit->minx || $Point->x >
$Limit->maxx ||
        $Point->y < $Limit->miny || $Point->y > $Limit->maxy)
  ) continue;
      echo '<point x="' . $Point->x . '" y="' . $Point->y . '"/>';
    }
 echo '</polygon>';
  }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20070809/ba537370/attachment.htm>


More information about the MapServer-users mailing list