Select to view content in your preferred language

Geometry Service INTERSECT returns empty polygon (FLEX)

2775
2
03-28-2011 12:24 PM
WilliamRidgeway
Emerging Contributor
Hello,

I'm trying to call an INTERSECT function from a Geometry Service residing on an ArcGIS 10 Server using Flex.  The function seems to return successfully, however, the result is a polygon with 0 rings.  I know for a fact that the geometries (2 polygons) passed in intersect and I am under the impression that this function is supposed to return to me the intersecting polygon.  Am I missing something?

The Geometry Service allows me to perform Buffers successfully so I don't think that there is a problem with the Geometry Service that I'm aware of.  When I check it out in the rest API, it displays that the INTERSECT function is available to me.

I'm using the ArcGIS Flex 2.2 Library, Flex 4, ArcGIS 10

Code:
myGeometryService.addEventListener(GeometryServiceEvent.INTERSECT_COMPLETE, intersectCompleteHandler);
myGeometryService.intersect([myGeometry], myGeometry2);

//Note: myGeometry and myGeometry2 are both Polygons

function intersectCompleteHandler(event:GeometryServiceEvent):void{

    for each(var myPolygon:Polygon in event.result){

        //myPolygon has 0 rings when I check it out here and it does not return a valid shape
    }

}
Tags (2)
0 Kudos
2 Replies
WilliamRidgeway
Emerging Contributor
I seemed to have solved my issue for now.  I believe that the polygon I was passing to the INTERSECT method was somehow not valid.  I was generating a cone-shaped polygon by the following code:

var myPoint1:MapPoint = new MapPoint(x1,y1);
var myPoint2:MapPoint = new MapPoint(x2,y2);
var myPoint3:MapPoint = new MapPoint(x3,y3);

var myRing:Array = [myPoint1, myPoint2, myPoint3, myPoint1];

var myPolygon:Polygon = new Polygon([myRing]);


I was using the polygon created above to intersect a set of circular polygons that were generated with the BUFFER method from the geometry service.

When I switched the order of myPoint2 and myPoint3 in the myRings array order, the INTERSECT method worked correctly with the polygon.

I'm not sure why it wouldn't work with the same polygon before but now it does.
0 Kudos
MehulChoksey
Esri Contributor
You might want to call GeometryService's simplify method before calling intersects to make the geometry topologically correct.

The geometry in anticlockwise direction is considered as hole and hence that could be the reason for intersect not returning result.
0 Kudos