Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a featureLayer from featureCollection and I am able to add it to the map and when I execute, map.graphicsLayerIds, it also returns the id of the featureLayer, ["resultLayer"]. But I am not able to see it on the map. I have also set the renderer but still it makes no difference. This is the application.

It takes some time to execute (around a minute). This is the code I am using to create the featureLayer,

function addResults(results) {
        var features = results.value.features;

        var layerDefinition = {
            "geometryType": "esriGeometryPolygon",
            "fields": [{
                "name": "FID",
                "alias": "ID",
                "type": "esriFieldTypeOID"
            }, {
                "name": "STATE_NAME",
                "alias": "State Name: ",
                "type": "esriFieldTypeString"
            }, {
                "name": "NAME",
                "alias": "County Name: ",
                "type": "esriFieldTypeString"
            }, {
                "name": "value",
                "type": "esriFieldTypeDouble",
                "alias": "Absolute Value"
            }, {
                "name": "RESULT2",
                "type": "esriFieldTypeDouble",
                "alias": "Percentage Change"
        var featureCollection = {
          "layerDefinition": layerDefinition,
          "featureSet": {
            "features": features
        var states_Symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, //EVENTS
                    new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,  //EVENTS
                    new dojo.Color([255,255,255,0.35]), 1),  //EVENTS
                    new dojo.Color([125,125,125,0.35]));

        var popupTemplate = new esri.dijit.PopupTemplate({
                title: "{NAME}",
                fieldInfos: [{
                    fieldName: "STATE_NAME",
                    visible: true,
                    label: "State Name: "
                    fieldName: "value",
                    visible: true,
                    label: "Absolute Change: $"
                    fieldName: "RESULT2",
                    visible: true,
                    label: "Percentage Change: "

        resultLyr = new esri.layers.FeatureLayer(featureCollection, {
          id: 'resultLayer',
          infoTemplate: popupTemplate
        resultLyr.setRenderer(new esri.renderer.SimpleRenderer(states_Symbol));



Any idea what I am missing?

share|improve this question
up vote 2 down vote accepted

After reviewing the data within, the graphics have attributes, but no geometry. That's why they're not showing up on the map. Make sure your geoprocessing service is returning those geometries. Also, check that the layer the geoprocessing service accesses has access to the shape attribute of the feature.

share|improve this answer
Is there a way in arcgis javascript api, to return the geometry and the data associated with it from a geoprocessing service? – Sam007 Nov 30 '12 at 6:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.