So I am trying to do something very simple - return the points for the USGS Steam Flow Station layer (http://rmgsc.cr.usgs.gov/ArcGIS/rest...ta/MapServer/0) that fall within the District of Columbia. There should be 3.
First I construct a QueryTask to get the District of Columbia layer
I've verified that this works - one feature is returned. However, when I try to query the points in Steam Flow Station layer against this result, I get an error since null results are returned!Code:var queryTask = new esri.tasks.QueryTask(districtURL); var query = new esri.tasks.Query(); query.returnGeometry = true; query.outFields = ["*"]; query.where = "CITY_NAME = 'Washington'" query.outSpatialReference = map.spatialReference; queryTask.execute(query, queryResults, errorCall);
At one point I was getting 0 results and no error, but now I'm just getting an error. I thought this should be a simple task - any assistance would be of great help.Code:function queryResults(featureSet){ console.log(featureSet.spatialReference); console.log(map.spatialReference); var queryTaskWithin = new esri.tasks.QueryTask("http://rmgsc.cr.usgs.gov/ArcGIS/rest/services/nhss_usdata/MapServer/0"); var query = new esri.tasks.Query(); query.returnGeometry = true; query.outFields = ["*"]; query.outSpatialReference = map.spatialReference; query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_WITHIN; query.geometry = featureSet.features[0].geometry; queryTaskWithin.execute(query) dojo.connect(queryTaskWithin, "onComplete", function(fset) { console.log(fset.features.length); }, function(error){console.log("error" + error)}); }
Also, the spatial references of the district layer and the Steam Flow Station layer are seemingly different. One is 102100 and the other is 3857. But I think those are both web mercator so it shouldn't matter too much, right?
Thanks!
Jay

Reply With Quote



.

Bookmarks