ArcGIS API for JavaScript

3412
1
12-12-2014 03:27 PM
jameshickey
Occasional Contributor

Okay,

I am a bit behind the times here. I just built a web app using ArcGIS Viewer for Flex and had it working just like I wanted, got it added to my IIS server and wouldn't you know it...

There is no flash support on Android any more which happens to be the tablets that we use!

So now I guess I need to move on to this here API for JavaScript... sigh...

 

Any one know of any good STARTING points for this?

 

I know only a tiny bit about JavaScript so we need to start small here.

I have looked at the sandbox a bit but i don't know how to add my own layers to maps, or if i can add layers from my ArcGIS server to these maps...

 

Thanks for your help.

 

James

0 Kudos
1 Reply
OwenEarley
Occasional Contributor III

To get started with the ESRI JS API have a look at this page Build your first application | Guide | ArcGIS API for JavaScript.

Read the Work with the API section in the help as this steps through the core functionality available.

Learn how to work with Dojo - the ESRI JS API uses Dojo extensively: Working with Dojo | Guide | ArcGIS API for JavaScript

One you have a map loading you can add your own layers. The general pattern is the same but there are a few options depending on the layer type:

          var featureLayer = new FeatureLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2",{
            mode: FeatureLayer.MODE_ONDEMAND,
            outFields: ["*"],
            infoTemplate: infoTemplate
          });
          // Add the layer to the map          
          map.addLayer(featureLayer);

  var oilAndGasLayer = new ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Petroleum/KGS_OilGasFields_Kansas/MapServ...", {
        "id": "oilAndGasLayer",
        "opacity": 0.75
      });
      //Add the layer to the map
      map.addLayer(oilAndGasLayer);

There are a heap of resources online for JavaScript including reference material, samples and online editors. Some good ones are:

Also keep using the GeoNet forums for specific questions and issues - JavaScript questions generally get answered quickly on here.