Query issue returning undefined geometry

1611
4
Jump to solution
12-27-2016 10:57 AM
by Anonymous User
Not applicable

Hi all,

I am not too sure why but one of my queries (against an AGOL layer) is returning no geometry when it should:

 $( "#tags" ).autocomplete({
                  source: ProjectNames,
                  select: function( event, ui ) {
                var value = ui.item.value;
                console.log(value);
                 var queryTaskProjects = new QueryTask("http://services.arcgis.com/UHg8l1wC48WQyDSO/arcgis/rest/services/Projects/FeatureServer/0");
                //build query filter
                var queryProjects = new Query();
                queryProjects.returnGeometry = true;
                queryProjects.outFields = ["Name", "ACRES"];
                queryProjects.where = "Name = " + "'" + value + "'";
                queryTaskProjects.execute(queryProjects, addToMap4);
                 }
              });


 function addToMap4(featureSet) {
                    var resultFeatures = featureSet.features;
                    var AOI = featureSet.geometry;
                    console.log(resultFeatures);
                    console.log(AOI);
                    var symbol = new SimpleFillSymbol(
                        SimpleFillSymbol.STYLE_SOLID,
                        new SimpleLineSymbol(
                            SimpleLineSymbol.STYLE_SOLID,
                            new Color([255, 0, 0, 0.65]), 2
                        ),
                        new Color([255, 0, 0, 0.35])
                    );
                    arrayUtil.forEach(resultFeatures, function (feature) {
                        console.log(geometry);
                        var AOI = feature.geometry;
                        projectareaexisting = new Graphic(AOI, symbol);
                        map.graphics.add(projectareaexisting);
                    });
                }
Tags (1)
0 Kudos
1 Solution

Accepted Solutions
thejuskambi
Occasional Contributor III

The error is in the line

console.log(geometry);

here the variable geometry is not defined before using it.

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Emeritus

Alex,

   Have you run the check geometry toolbox against the featureclass that the map service is using in ArcMap?

0 Kudos
by Anonymous User
Not applicable

I just tried. No errors were found. I also have filtering the layer in AGOL.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Alex,

   Is there any difference if you remove the filtering?

0 Kudos
thejuskambi
Occasional Contributor III

The error is in the line

console.log(geometry);

here the variable geometry is not defined before using it.