I am still learning JavaScript along with the ArcGIS API for JavaScript.

I am attempting to load feature classes from a dynamic workspace (with a registered workspace ID) within a simple JS API application. Please refer to the ESRI sample here.

I've attempted to lift the sample and add my own data (added AGS service (map server) workspace ID and feature class to be loaded). This produces several generic TypeErrors e.g. Uncaught TypeError: Cannot read property 'visible' of undefined, TypeError: Cannot read property 'set' of undefined.

I've attempted to build my own from scratch following the guide closely and refering to the API documentation. this produces "Uncaught ReferenceError: getVisibleLayers" even though the logic is present in the code.

My questions are:

  • Has anyone had success using dynamic workspaces? (I couldn't find much chatter about it online)
  • Can anyone find/provide a working sample?
  • Does anybody know of any documentation relating to dynamic workspaces? (ESRI docs are very brief on the subject)
  • Anything to watch out for working with these?

closed as too broad by PolyGeo May 12 '18 at 6:16

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


Without seeing your code, it's likely that you're getting those "cannot read property" errors because the modules you're calling in the require statement aren't matching the order of the arguments in your function.

This would give you those type of errors.

require(["esri/map", "esri/layers/ArcGISTiledMapServiceLayer",  
], function (  
   ) { 

The Extent argument is out of order and it throws off how those arguments are interpreted.

Not the answer you're looking for? Browse other questions tagged or ask your own question.