AnsweredAssumed Answered

Displaying query results

Question asked by atharmon on Sep 3, 2014
Latest reply on Sep 8, 2014 by atharmon

Howdy,

I have been trying (quite unsuccessfully) to turn the results of a feature layer query (polygons) into graphics to be added to a graphics layer. I have checked several times that the returned FeatureSet contains the correct amount of features per the WHERE clause of the query. Yet every time I iterate through the FeatureSet, create graphics, and add said graphics to the GraphicsLayer, nothing appears.  Here is what I have so far.

 

Layer I am querying

NSURL* fenceUrl = [NSURL URLWithString: fenceAddress];
self.fenceLayer = [AGSFeatureLayer featureServiceLayerWithURL: fenceUrl mode:AGSFeatureLayerModeSelection];

 

The query

    AGSQuery *pQuery = [AGSQuery query];
    pQuery.where = @"USEREMAIL LIKE 'madeUpEmail@gmail.com'";
    pQuery.outFields = [NSArray arrayWithObjects:@"*", nil];
    pQuery.returnGeometry = YES;
    [self.fenceLayer selectFeaturesWithQuery:pQuery selectionMethod:AGSFeatureLayerSelectionMethodAdd];

 

This is the result of NSLog-ing the graphics I am trying to add to the layer

geometry: AGSPolygon: [envelope: AGSEnvelope: xmin = -96.650200, ymin = 29.600216, xmax = -96.029897, ymax = 30.117631, spatial reference: [AGSSpatialReference: wkid = 4326, wkt = null]], symbol: <AGSSimpleFillSymbol: 0xde7f030>, attributes: {
    OBJECTID = 801;
    USEREMAIL = "madeUpEmail@gmail.com";
    USERID = "1";
    channelID = "<null>";
}, visible: 1

 

My only thought is this could be a incorrect SpatialReference problem. I have already defined the spatial reference for the graphics to both webMercatorSpatialReference (same as the base map) and wgs84SpatialReference (same as the FeatureLayer) to no success. I tried to add the polygon Nimesh made here https://community.esri.com/thread/28467 but even that failed to show up on my map. Any thoughts or ideas would be greatly appreciated.

Thanks,

Aaron.

Outcomes