Basic Viewer (Javascript) on premise

1375
4
11-21-2011 08:52 AM
EricLacoursiere
New Contributor II
Hi,

I would like to install the Basic Viewer on my webserver and use it along with my ArcGIS Server and ArcGIS Online web services only.

In the configuration's file, I can find the map key, but don't see where I can define my Content Directory's URL (.../ArcGIS/Mobile/Content/MobileWeb/Maps/) so the ID is related to my "local" json file instead of the ArcGIS Online hosted version.

My question: Can we use the Basic Viewer (and the others tempates) with the JSON configuration file or if it works only with the ArcGIS Online MapID? (If yes, how?)

Thanks,

Eric
0 Kudos
4 Replies
KellyHutchins
Esri Frequent Contributor
Eric,

If I understand your question correctly then sure you can use the templates with a web map created via json. Here's an example that takes a web map, from the 'Create Web Map from JSON' developer sample and uses that with the Basic Viewer template. I just create the web map then set the web map as the configOptions.webmap value.


    <script type="text/javascript">
      dojo.require("dijit.dijit");
      dojo.require("dijit.dijit-all");
      dojo.requireLocalization("esriTemplate","template");
    </script>
    <script type="text/javascript" src="javascript/layout.js">
    </script>

    <script type="text/javascript">
     
     var configOptions;

      function init() {      
      
       var webmap = {};
        webmap.item = {
          "title":"Soil Survey Map of USA",
          "snippet": "This map shows the Soil Survey Geographic (SSURGO) by the United States Department of Agriculture's Natural Resources Conservation Service.",
          "extent": [[-139.4916, 10.7191],[-52.392, 59.5199]]
        };

        webmap.itemData = {
          "operationalLayers": [{
            "url": "http://server.arcgisonline.com/ArcGIS/rest/services/Specialty/Soil_Survey_Map/MapServer",
            "visibility": true,
            "opacity": 0.75,
            "title": "Soil Survey Map",
            "itemId": "204d94c9b1374de9a21574c9efa31164"
          }],
          "baseMap": {
            "baseMapLayers": [{
              "opacity": 1,
              "visibility": true,
              "url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer"
              },{
              "isReference": true,
              "opacity": 1,
              "visibility": true,
              "url": "http://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer"
              }],
            "title": "World_Terrain_Base"
          },
          "version": "1.1"
        };
      
        configOptions = {
          //The ID for the map from ArcGIS.com     
         //webmap:"dbd1c6d52f4e447f8c01d14a691a70fe",
         webmap:webmap,
         //The id for the web mapping applciation item that contains configuration info - in most
         //cases this will be null. 
          appid:"",
          //set to true to display the title
          displaytitle:true,
          //Enter a title, if no title is specified, the webmap's title is used.
          title:"",
          //Enter a description for the application. This description will appear in the left pane
          //if no description is entered the webmap description will be used.
          description: "",
          //Specify a color theme for the app. Valid options are gray,blue,purple,green and orange
          theme:'gray',
          //Optional tools - set to false to hide the tool
          //set to false to hide the zoom slider on the map 
          displayslider:true, 
          displaymeasure:true,
          displaybasemaps:true,
          displayoverviewmap:true,
          displayeditor:true,////When editing you need to specify a proxyurl (see below) if the service is on a different domain
          //Specify a proxy url if you will be editing
          proxyurl: "http://autumn/proxy/proxy.ashx",
          displaylegend:true,
          displaysearch:true, 
          displaylayerlist:true,
          displaybookmarks:true,
....... more config stuff here
      
        };
        
        initMap();
      }
      dojo.addOnLoad(init);
    </script>

0 Kudos
EricLacoursiere
New Contributor II
Hi Kelly,

Thanks for your quick response!

So, my goal is to host the JSON file on my ArcGIS Server Content (http://*****.com/ArcGIS/Mobile/Content/MobileWeb/Maps/)

And use the Basic Viewer with this JSON file:
http://apps.arcgis.com/hosted/OnePane/basicviewer/index.html?webmap=ad62846458d644a397d296127000dd99

I need to know where I specify my Server Content URL.

Cheers,

Eric
0 Kudos
SureshRajamani
New Contributor II
I need to refer my local javascript api for this basic viewer.
But i m getting error while executing this line   dojo.requireLocalization("esriTemplate","template");
How to configure the Basic Viewer with local arcgis javascripr api in my web server.
0 Kudos
roemhildtg
Occasional Contributor III
We were also looking for a configureable basic viewer to consume our on premise arcgis server resources, and we think that this will be exactly what we were looking for:

https://github.com/DavidSpriggs/ConfigurableViewerJSAPI
0 Kudos