I have just started developing with ArcGIS for Javascript and as I'm learning Dojo I'm seeing a reason to modularize development for a more plug-n-play concept. I can't seem to find any good articles on Best Practices for Web Map development and am wondering if there are anything resembling industry standards for setting up new web-map applications in this environment.

  • 2
    Best practices vary for creating web maps based on numerous factors. I'm not sure if this is really an answerable question because development practices differ from developer to developer, from system to system, etc. All I can suggest is look at other web maps and see how others display their data, and how users interact with the data. That should give you some good (and bad) ways for accomplishing your goal.
    – evv_gis
    Mar 24 '14 at 21:27

I agree with @evv_gis in that, at least from my experience so far, there is little in the way of best practices for this relatively niche area of development. However, I do have some recommendations from my own experience.

  1. The ESRI API examples are an excellent source for learning techniques but don't base your development of any complex application on them. They are simple code examples to demonstrate a particular technique and don't represent a robust application which needs more defensive programming including error / exception handling and so on.

  2. I encapsulate functionality into Dojo modules that can be re-used between applications. For example, MapUtils is a class I put basic functionality such as loading a layer (not just "map.addLayer', you need to validate the url, test success and handle if it didn't load). Then, SearchUtils for search related functionality, RouteUtiuls for routing (Network Analyst) related functions and so on.

  3. Don't hardcode things such as spatial reference, layer urls and so on. You will end up with hard coded values dotted around even in modules you wrote to be re-usable. I retrieve most data / settings from DB via web service calls. If this isn't an option though, have a single place that defines the settings / content for your application, that isn't intended to be re-usable, and define things such as the spatial reference, initial extent and so on there. Then your re-usable code can be written to reference this.

On the subject of separating code into dojo modules, ESRI have written a primer in their Concepts section. Check this out and the other pages in the Concepts section to.


I admit this is more an anecdotal answer based on my own experience rather than known best practices but hopefully it will help. If you find anything yourself on this subject, please post it for others (including myself!).


Eric Pimpler over at Geospatial Training Services compiled a copious list of articles on Dojo for Web Mapping for the AGS Javascript API 1.

However, since it was stacked up in 2009, it might have some bad links and no-longer-relevant content.

Also, remember that Dojo is a framework for much more than Web Mapping. Many of the common-sense (and some of the not-so-common-sense) Javascript development 'best-practices' apply whether the application is a web-mapping app or any other type of application.

Lastly, while you specifically mention Dojo, there are (of course) numerous other frameworks which work perfectly well with the Javascript API for ArcGIS. -- If you are familiar or invested in another Javascript framework, then learn from the Dojo examples and port them into your framework of preference.

  • Isn't ArcGIS for Javascript wrapped up in Dojo? Is there a step-by-step for removing Dojo and using plain Javascript so you could implement other libraries? Mar 26 '14 at 12:50
  • Firstly, "Yes the JS API is wrapped up in Dojo." Which for me means that is the API is deployed (via AMDs or Dijits.) Notice in my original answer I said 'port it' not 'completely decouple it from Dojo.' So is there a step-by-step for removing Dojo? -- No. But, cross-framework library management solutions such as JetBrain's WebStorm allow management of Dojo modules, and provide access via their library functions. -- Bottom line is we all only need the Dojo delivery AMDs (today) and we can build your apps in JS frameworks of our choosing. Hopefully that clarifies the dependency on Dojo! Mar 26 '14 at 15:52
  • FYI, here's a robust dialog on framework choices for use with ESRI's Javascript API for ArcGIS: gis.stackexchange.com/questions/18737/… Mar 26 '14 at 15:54
  • One last comment from me on this: Rene Rubalcava (aka Odoe aka SmartGeoTech) has some cool examples of using AngularJS working with Dojo (using his powers for good, not evil) and the ESRI JS API found here: odoe.net/blog/?p=447 Do these examples expand the range of AGIS JS API framework possibilities somewhat? Mar 26 '14 at 16:01

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