The API guide for interpolate_points for the input_layer parameter mentions "see Feature Input in documentation". Where do I find that documentation? More specifically, I'm trying to figure out if I can use featureset as the input layer? I'm currently getting this error:
---------------------------------------------------------------------------Exception Traceback (most recent call last)<ipython-input-52-ba1e10e3e46c> in <module>() 1 from arcgis.features.analyze_patterns import interpolate_points----> 2 interpolated_sites = interpolate_points(solardatasites_fset, field='jul_ghi') C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\analyze_patterns.py in interpolate_points(input_layer, field, interpolate_option, output_prediction_error, classification_type, num_classes, class_breaks, bounding_polygon_layer, predict_at_point_layer, output_name, context, gis) 209 predict_at_point_layer, 210 output_name,--> 211 context)C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\tools.py in interpolate_points(self, input_layer, field, interpolate_option, output_prediction_error, classification_type, num_classes, class_breaks, bounding_polygon_layer, predict_at_point_layer, output_name, context) 1322 params = {} 1323 -> 1324 params["inputLayer"] = super()._feature_input(input_layer) 1325 params["field"] = field 1326 if interpolate_option is not None: C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\tools.py in _feature_input(self, input_layer) 381 input_param = {"url": input_layer_url } 382 else:--> 383 raise Exception("Invalid format of input layer. url string, feature service Item, feature service instance or dict supported") 384 385 return input_param Exception: Invalid format of input layer. url string, feature service Item, feature service instance or dict supported
Solved! Go to Solution.
You can construct an in-memory FeatureCollection object and that will work. The format of FeatureCollection is in the Feature Input page.
FeatureSets are not supported as input to the feature analysis tools.
The following are supported:
The 'Feature Input' reference was to Feature input—ArcGIS REST API: Spatial Analysis Service | ArcGIS for Developers but we should have it a better place in the Python API doc - thanks for alerting us to this.
Thanks Rohit the quick response!. Would it be possible to construct an in-memory feature layer object from a FeatureSet to use as the tool input? If not, can you suggest any alternatives for passing in a subset of points from a feature layer to the tool that does not involve creating a new feature layer item?
You can construct an in-memory FeatureCollection object and that will work. The format of FeatureCollection is in the Feature Input page.
That works. Thanks again!
my_featureset = my_flyr.query(where="state='WY'")
from arcgis.features import FeatureCollection
my_fc = FeatureCollection(my_featureset.to_dict())
from arcgis.features.analyze_patterns import interpolate_points
interpolated_points = interpolate_points(my_fc, field='GHI')
All I can say is... "even better" !