[mapserver-users] intersect

jef.mony at free.fr jef.mony at free.fr
Thu Aug 22 01:43:09 PDT 2002


Hi,

I noticed a little problem with the intersects function of the ShapeObj.
I have two Shapes : a polygon and a point


    $line = ms_newLineObj();
    $line->addXY($Xmin,$Ymax);
    $line->addXY($Xmax,$Ymax);
    $line->addXY($Xmax,$Ymin);
    $line->addXY($Xmin,$Ymin);
    $line->addXY($Xmin,$Ymax);
    $poly = ms_newShapeObj(MS_SHAPE_POLYGON);
    $poly->add($line);

    $line2 = ms_newLineObj();
    $line2->addXY($Xmin,$Ymax);
    $poly2 = ms_newShapeObj(MS_SHAPE_POINT);
    $poly2->add($line2);

If I try $poly->intersects($poly2) I have a wrong result, in fact it's like I 
would have test the intersection between the pôint and the boundaries of 
the poly ...
but If I use $poly2->contains($pt) with pt a point with the same coords that 
the poly2 it's work fine ...

An idea, is it a bug or a wrong use ?

Thanks



More information about the MapServer-users mailing list