Select to view content in your preferred language

Perform query based in existing map graphics

929
6
11-28-2011 07:41 AM
TiagoRibeiro
Deactivated User
Hi there,

I'm trying to create a function that performs a query on the map based in the current map.graphics.
Is there an easy way to add map.graphics to the geometry parameter, besides going trough the map.graphics.graphics array to find the extents?

Thanks
0 Kudos
6 Replies
HemingZhu
Frequent Contributor
Hi there,

I'm trying to create a function that performs a query on the map based in the current map.graphics.
Is there an easy way to add map.graphics to the geometry parameter, besides going trough the map.graphics.graphics array to find the extents?

Thanks


geometries = esri.getGeometries(map.graphics);
geometryService.union(geometries, function(geometry){
        query.geometry =geometry;
        ...
});

0 Kudos
TiagoRibeiro
Deactivated User
geometries = esri.getGeometries(map.graphics);
geometryService.union(geometries, function(geometry){
        query.geometry =geometry;
        ...
});



Thanks for your response, but I accomplished the some thing (I think) using:
esri.graphicsExtent(map.graphics.graphics)

It seems to work fine, but can you tell me the difference between this solutions and yours?
0 Kudos
HemingZhu
Frequent Contributor
Thanks for your response, but I accomplished the some thing (I think) using:
esri.graphicsExtent(map.graphics.graphics)

It seems to work fine, but can you tell me the difference between this solutions and yours?


your approach used the extent of map.graphics.graphics as query.geometry while mine merged map.graphics.graphics into one geometry and used that geometry as query.geometry.
0 Kudos
TiagoRibeiro
Deactivated User
your approach used the extent of map.graphics.graphics as query.geometry while mine merged map.graphics.graphics into one geometry and used that geometry as query.geometry.

Ok, I understood that part, but I was wondering what's the best approach, and if the final result will be the same.
0 Kudos
HemingZhu
Frequent Contributor
Ok, I understood that part, but I was wondering what's the best approach, and if the final result will be the same.


The result may or may not be the same. For example a point which may be within the extend of a polygon may actually outside that polygon.
0 Kudos
TiagoRibeiro
Deactivated User
The result may or may not be the same. For example a point which may be within the extend of a polygon may actually outside that polygon.


That's what I thought. As I see it for better performance use the extents, because you don't need the geometry service, and for accuracy use the join (right?).
By the way, is there a way to perform geometry operations (buffer, intersects, joins, etc) on the client side, without using the geometry services?
0 Kudos