ArcGIS javascript: graphicsUtils.graphicsExtent with one point feature

This applies to javascript developers using the ArcGIS Javascript API. If you’re using the graphicsUtils to get the extent of a set of graphics, you can use graphicsUtils.graphicsExtent. But if your set of features contains a single point, the extent returned is null. Which makes sense, but it took me a little while to figure this out. So check for the number of points (and whether they actually have a different location) before trusting this graphicsExtent function to operate correctly.

It’s a small thing, but hey, it might save you some time.

See https://developers.arcgis.com/javascript/jsapi/esri.graphicsutils-amd.html.

 

Advertisements