Select to view content in your preferred language

Error when adding a feature layer

3775
3
Jump to solution
10-13-2014 12:53 PM
joepublic
Deactivated User

I have a very basic script show below and get the error:

Any ideas as to what I'm doing wrong??

 

 

Error {code: 500, message: "Error performing query operation", details: Array[0], log: undefined, httpCode: 500}

  1. _ssl: undefined
  2. code: 500
  3. details: Array[0]
  4. httpCode: 500
  5. log: undefined
  6. message: "Unable to draw graphic (null): Error performing query operation"
  7. stack: "Error↵ at Error (native)↵ at Object.e.load (http://js.arcgis.com/3.10/init.js:619:426)↵ at http://js.arcgis.com/3.10/init.js:187:69↵ at c (http://js.arcgis.com/3.10/init.js:74:221)↵ at d (http://js.arcgis.com/3.10/init.js:74:10)↵ at resolve.callback (http://js.arcgis.com/3.10/init.js:75:350)↵ at c (http://js.arcgis.com/3.10/init.js:74:436)↵ at d (http://js.arcgis.com/3.10/init.js:74:10)↵ at resolve.callback (http://js.arcgis.com/3.10/init.js:75:350)↵ at http://js.arcgis.com/3.10/init.js:191:300"
  8. __proto__: d


-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<!DOCTYPE html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">

<link rel="stylesheet" href="http://js.arcgis.com/3.10/js/esri/css/esri.css">

<script src="http://js.arcgis.com/3.10/"></script>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>

</head>

 

<body>

<div id="mapDiv"></div>

 

<script type="text/javascript">

var map, featureLayer;

 

var featureURL = "http://dev.consciousglobalchange.org/arcgis/rest/services/MEP/webmap_catalog/FeatureServer/0";

 

require(["esri/map", "esri/layers/FeatureLayer", "dojo/domReady!"],function(Map,FeatureLayer) {

map = new Map("mapDiv", {

     center: [-56.049, 38.485],

     zoom: 3,

     basemap: "streets"

});

 

var featureLayer = new FeatureLayer(featureURL);

map.addLayer(featureLayer);

 

</body>

</html>

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor

Hi Joe,

You will want to keep your script in your <head> tags (see below).  Here is a great tutorial on building your first application.

<!DOCTYPE html>

<html>

  <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">

   

    <link rel="stylesheet" href="http://js.arcgis.com/3.10/js/esri/css/esri.css">

   

    <style>

      html, body, #mapDiv {

        padding:0;

        margin:0;

        height:100%;

      }

    </style>

       

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>

   

    <script src="http://js.arcgis.com/3.10/"></script>

    <script type="text/javascript">     

      require([

        "esri/map", "esri/layers/FeatureLayer", "dojo/domReady!"

      ],

      function(

        Map, FeatureLayer

      ) {

        map = new Map("mapDiv", {

          center: [-56.049, 38.485],

          zoom: 3,

          basemap: "streets"

        });

       

        var featureURL = "http://dev.consciousglobalchange.org/arcgis/rest/services/MEP/webmap_catalog/FeatureServer/0";

        var featureLayer = new FeatureLayer(featureURL,{

          mode: FeatureLayer.MODE_ONDEMAND

        });

        map.addLayer(featureLayer);

       

      })

    </script>

  </head>

  <body>

    <div id="mapDiv"></div>

  </body>

</html>

View solution in original post

0 Kudos
3 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Joe,

You will want to keep your script in your <head> tags (see below).  Here is a great tutorial on building your first application.

<!DOCTYPE html>

<html>

  <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">

   

    <link rel="stylesheet" href="http://js.arcgis.com/3.10/js/esri/css/esri.css">

   

    <style>

      html, body, #mapDiv {

        padding:0;

        margin:0;

        height:100%;

      }

    </style>

       

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>

   

    <script src="http://js.arcgis.com/3.10/"></script>

    <script type="text/javascript">     

      require([

        "esri/map", "esri/layers/FeatureLayer", "dojo/domReady!"

      ],

      function(

        Map, FeatureLayer

      ) {

        map = new Map("mapDiv", {

          center: [-56.049, 38.485],

          zoom: 3,

          basemap: "streets"

        });

       

        var featureURL = "http://dev.consciousglobalchange.org/arcgis/rest/services/MEP/webmap_catalog/FeatureServer/0";

        var featureLayer = new FeatureLayer(featureURL,{

          mode: FeatureLayer.MODE_ONDEMAND

        });

        map.addLayer(featureLayer);

       

      })

    </script>

  </head>

  <body>

    <div id="mapDiv"></div>

  </body>

</html>

0 Kudos
joepublic
Deactivated User

Jake,

I did as you suggested but still the error

Chris

0 Kudos
joepublic
Deactivated User

Jake,

I think there is problem with the server hosting the esri software

Thanks

Joe

0 Kudos