Combining a Spatial Filter attributes on a query from Feature Layer on a Custom Widget

266
0
09-29-2022 05:09 PM
TharSoe
New Contributor

Hello,

So currently the custom Widget can query custom inputs from the feature layer by getting the "where" from the user. I also have predefined Spatial Filter information such as the geometryType, geometry, inSR, etc. that I gathered from the Query widget that represents a triangle shape for testing purposes. 

If I were to query it manually from the rest service using the aforementioned information (ex. Location Name Is Not Null with all the spatial information), I get back the records I'm looking for. However, when I do it from the widget, it seems to only care about the 'Where' and ignores pretty much all the Spatial Filter information. The main question is how can I add my Spatial Filter information correctly onto the FeatureLayer.queryCount so that it queries the correct results? Are the current Spatial Filter information even valid? 

I'm essentially trying to see if I'm even inputting my FeatureLayer query request correctly. Any help would be appreciated!

 

					var geometry = {"rings": [[[-9188924.538427977,3173562.0510628982],[-9188854.174329605,3173440.1768694893],[-9188994.902526349,3173440.1768694893],[-9188924.538427977,3173562.0510628982]]],"spatialReference": {"wkid": 102100}};
					var geometryType='esriGeometryPolygon';
					var inSR="102100";
					
					var query = new Query();
					query.where = where;
					query.geometry = geometry;
					query.geometryType = geometryType;
					query.inSR = inSR; 
					_this.query_where = where;
					_this.query_geometry = query.geometry;
					_this.query_geometryType = query.geometryType;
					_this.query_inSR = query.inSR;
					query.returnGeometry = true; 
					query.outFields = ["*"];


					var featureLayer = new FeatureLayer(url, {
						mode: FeatureLayer.MODE_AUTO
					});
					
					(function(_this, service, url, where, featureLayer) {
						var resultsCallback = function(response) {
							_this._featureCountCheck(_this, service, url, where, featureLayer, response);
						};
                  var errorCallback = function(response) {
                     _this._error(response);
                     _this._queryComplete(_this);
                  };
				  
				  featureLayer.queryCount(query, resultsCallback, errorCallback);
					})(_this, service, url, where, featureLayer);
				}
			},

 






0 Kudos
0 Replies