AnsweredAssumed Answered

how to require graphicsUtils in v3

Question asked by huttarl on May 19, 2014
Latest reply on Oct 23, 2015 by bwscim
Hello,
I'd been using esri.graphicsExtent() back in API v1.5 or so.
I'm now migrating to JS API v3 (with ArcGIS 10.1 on the server side).

My code that uses esri.graphicsExtent() no longer works, but I see from https://developers.arcgis.com/javascript/jsapi/esri.graphicsutils-amd.html that the graphicsExtent() function is now under the esri/graphicsUtils namespace. The example there shows the use of

require([   "esri/graphicsUtils", ...  ], function(graphicsUtils, ... ) {   var myFeatureExtent = graphicsUtils.graphicsExtent(myFeatureSet.features);   ... });


But when I try following that pattern, I get the error

   NetworkError: 404 Not Found - https://js.arcgis.com/3.0/js/dojo/esri.graphicsUtils.js

in my javascript console.

I've also tried
dojo.require("esri.graphicsUtils");
, but it doesn't work either.

My JS API script loading tag looks like this:
<script type="text/javascript" src="https://js.arcgis.com/3.0/"></script>


What do I need to do to successfully load the graphicsUtils namespace?
Thanks for any suggestions.

P.S. my "require()" code is inside a function that's not called until a particular UI feature is used.
Could it be important that the require() code be outside of any functions, at the outer script level?
Currently, at that level I have a series of dojo.require() statements like

dojo.require("esri.tasks.query"); dojo.require("esri.tasks.identify");

Adding dojo.require("esri.graphicsUtils"); there doesn't work.
Nor does dojo.require("esri/graphicsUtils");

Either way, I get a 404 Not Found on
https://js.arcgis.com/3.0/js/esri/graphicsUtils.js

P.P.S. Did something about this namespace change between 3.0 and 3.9? The viewshed sample (https://developers.arcgis.com/javascript/jssamples/gp_viewshed.html) seems to use this module successfully.

Outcomes