I have a set of geometries and need to overlay them on a point layer to determine points falling under the set of geometries.

I use the Union function of Geometry service to combine the geometries and pass the unioned geometry to the Querytask object of point layer.

The union works fine for small subset of geometries , but when large set of geometries are passed to Geometry service , the process takes a lot of time , often resulting in scripting error message ??????.Script is causing IE to slow down.??? .

Is there any alternative of passing a set of geometries (Array or List ) to a single Querytask object? I tried passing the extent of set of geometries to querytask , but extent picks up lot of additional points.

Regards,

Nidhi Arora.

I use the Union function of Geometry service to combine the geometries and pass the unioned geometry to the Querytask object of point layer.

The union works fine for small subset of geometries , but when large set of geometries are passed to Geometry service , the process takes a lot of time , often resulting in scripting error message ??????.Script is causing IE to slow down.??? .

Is there any alternative of passing a set of geometries (Array or List ) to a single Querytask object? I tried passing the extent of set of geometries to querytask , but extent picks up lot of additional points.

Regards,

Nidhi Arora.

For a large set of geometries, Union is not an option. I had similar exprience.

What i did is create a javascript function and do it on client... Here is my functin for your reference:

function mergeGeometries(features) {

/* STR search might result

* multi polygons

* merge them into a single one

*/

var polygon = features[0].geometry;

for (i = 1; i < features.length; i++) {

var poly = features[i].geometry;

for (j = 0; j < poly.rings.length; j++) {

polygon.addRing(poly.rings[j]);

}

}

return polygon;

}

hope it will help.

I've hit a snag with the union JavaScript code above. The code breaks with the following cases:

If I have a polygon with a hole in it, but that hole is occupied by 2 more polygons that exactly fit the space, each taking up about half the hole space, together they fill the hole. Put another way imagine a polygon with a square hole in it, and that hole is filled by 2 rectangular polygons. i.e. trying to union 3 polygons to create one seamless/holeless shape.

If I have a polygon with 2 holes in it, and each hole is filled with a perfectly fitting polygon. i.e. trying to union 3 polygons to create one seamless/holeless shape.

Has anyone come up with some JS code to handle this please?

Thanks.

Mark, When this this thread was posted, the GeometryService class did not have function to deal with your case. Now, you might be able to use GeometryService.union(geometries, callback?, errback?) for your case.