joe.zou

JavaScript API: adding layer doesn't work

Discussion created by joe.zou on Jul 9, 2013
I've created a map on ArcGIS online, adding a layer by uploading a csv file. This works fine, see map at link http://www.arcgis.com/home/webmap/viewer.html?webmap=6684e16ab2f3457c821ba43a0256c06b.

Now I'm trying to simulate this in JavaScript API. First I create a Web API service that returns the same data set I've got in csv file.
This is published on my local webserer. In my web page, I create a webmap, adding a layer that references this web API:

  function init() {
        var options = {
            basemap: "gray",
            center: [153.115672, -30.296312],
            zoom: 14
        }
        var mapServiceURL = "http://10.140.9.62/TRWDataManagerAPI/API/OzRegs";

        // Create map and call Init function
        map = new esri.Map("mapDiv", options);

        map.addLayer(new esri.layers.ArcGISDynamicMapServiceLayer(mapServiceURL));
    }
    dojo.ready(init);


The webmap is displayed, but the layer doesn't have any effect. What's missing? Am I at the right track? Your help is greatly appreciated.

Outcomes