Adding layer

498
2
12-18-2014 08:01 AM
BatbayarJargalsaikhan1
New Contributor

I'm trying to add layer to my map.

I can see base map but not added layer. here's my script. what did I wrong?

<script>

      var map;

      require([

        "esri/map",

        "esri/layers/FeatureLayer",

        "dojo/domReady!"

        ], function(Map,FeatureLayer) {

     

        map = new Map("map", {

          basemap: "satellite",

          center: [106.895, 47.920], // longitude, latitude

          zoom: 16

        });

       

        var parcelsOnline = new FeatureLayer("http://services.arcgis.com/HJzgwvlNIXssnQar/arcgis/rest/services/Ulas_1215/FeatureServer/0", {

          mode: FeatureLayer.MODE_ONDEMAND,

          outFields: ['*']

        });

      map.addLayer([parcelsOnline]);

     

     });

    </script>

0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Batbayar,

Since you are using the addLayer method, you will not want to specify an array.  If you are using the addLayers method, you would then pass an array.  Try the following:

map.addLayer(parcelsOnline);

0 Kudos
BatbayarJargalsaikhan1
New Contributor

thanks,

it works now.

0 Kudos