how to use configuration files with Javascript API?

1599
4
07-14-2014 04:02 AM
grahamcooke
Occasional Contributor

I have a fair amount of experience with the Flex APi but am very new to the Javascript API and just getting my head around all the Javascript resources etc... What I would like to do is implement similar functionality to what i had in my Flex API application.

I want to develop 1 GIS viewer application in the javascript API that serves my whole companies GIS requirement. We have a bunch of projects that all require some kind of map viewer and asscoiated functionality (find an asset, view history, check out extra information like hazard info, energy usage etc..). I see this as being one application with all functionality delivered in different widgets and with different basemaps loaded based on the user information (ie load basemap for that users region). I figured i could do this by passing URL parameter information when the request to display the map viewer page is made from whichever project requires it and then load up that specific "view" of the Map viewer application.

For example: If I am based in London UK and want a GIS viewer for Asset Management, I load up the asset management viewer with a specific set of widgets and specific basemaps.

I managed to achieve this in Flex Viewer using URL query string which essentially passed the name of a config.xml file and then simply loaded the application with that config file selected at runtime.

Has anyone achieved similar functionality in the JS.api? Can i use xml config files to control which view of my application individual users and projects get?

Hope someone can help.

Tags (1)
0 Kudos
4 Replies
ReneRubalcava
Frequent Contributor

There are a couple of projects out there that tackle this very thing.

A populat choice is the ConfigurableViewer, where everything can be setup viewer a JavaScript file. It's pretty easy to jump into and there's a lot of good info in the issues discussions.

A project I put out that is incredibly flexible and uses lazy loading of widgets is this esri-js-starterkit. It's designed so that every feature of your application can essentially be built as a widget, even the map. Everything is configured via a JSON file, even the WebMapSpec which lets you use an AGO webid or you can replicate the WebMapSpec to include your own services.

Here are a few widgets provided on github.

odoe/esri-map-widget · GitHub

odoe/esri-simpleedit-widget · GitHub

odoe/esri-touch-widget · GitHub

grahamcooke
Occasional Contributor

Hi Rene,

thanks for replying. I will look into it and let you know how i get on.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Graham,

   You should also check out the Web App Builder (which is in Beta 2). It is the configurable Viewer (like the ArcGIS Viewer for Flex), but for the JavaScript API.

Web AppBuilder for ArcGIS

  You can apply for the beta at this link: https://betacommunity.esri.com/

DaveTimmins
Occasional Contributor II

Throwing my 2 cents in, here's a simple configurable app using server side config. Joosh on GitHub and a sample here or with a different config here.

Cheers,

Dave