Select to view content in your preferred language

Does extent.intersect check the extent of a polygon before it's geometry?

726
1
06-09-2014 08:17 PM
DanikBourdeau2
Deactivated User
More of a best practice question.  If I am testing to see whether a polygon is intersecting with an extent, should I first test if the polygon's extent intersects and then test the geometry?  Or is it just as efficient to simply test the polygon's geometry?  Here is some code to illustrate.

Which is better? This:
var userExtent; //an extent the user has selected
var featExtent = new Extent(feature.geometry._extent); //an extent from a Feature Layer graphic
if (userExtent.intersects(featExtent){
   console.log("The two Extents Intersect");
   var polygon = new Polygon(feature.geometry);
   if (userExtent.intersects(polygon){
      console.log("Polygon intersects with user defined Extent");
   }
}


Or this:
var userExtent; //an extent the user has selected
var polygon = new Polygon(feature.geometry); //geometry from a Feature Layer graphic
if (userExtent.intersects(polygon){
   console.log("Polygon intersects with user defined Extent");
}
0 Kudos
1 Reply
DanikBourdeau2
Deactivated User
To keep on the topic of extents.  Feature Layers automatically generalize features to minimize throughput data, removing unnecessary vertices.  This could influence the extent of a feature.  Does anybody know whether the extent held in a graphic's geometry is the true extent of that feature or is it the extent of the generalized feature?
0 Kudos