Select to view content in your preferred language

Extract Multi Values to Points arcpy script fails..but

2906
8
01-07-2019 03:21 PM
GabrielMarcus1
Frequent Contributor

I've created a script that adds several netCDF rasters to a map. The last step is an extract multi values to points. 

When I run the script, I get the following error:

Error: ERROR 001268: Input rasters: The input item, MaxWindGusts, is invalid.
Failed to execute (ExtractMultiValuesToPoints).

Just after it fails, I copy the line that generated the error and paste it into the Python window and it runs without any issues. Has anyone else experienced this? Is there a way to figure out if this is a bug? I've saved/quit and restarted but that doesn't seem to fix it. 

Thanks,

Gabe

0 Kudos
8 Replies
DanPatterson_Retired
MVP Emeritus

ExtractMultiValuesToPoints(inPointFeatures, inRasterList, "BILINEAR")

Can you show your input point layer path? Is it in a geodatabase or is it a shapefile?  If a featureclass in a gdb, have you set the workspace elsewhere?

Can you also copy the line that produced the error but worked in the python window.

We have just had a recent reverse scenario where an extra parameter was added to the copied expression

0 Kudos
GabrielMarcus1
Frequent Contributor
cLocCpy = arcpy.CopyFeatures_management(cLoc,
                                        aprx.defaultGeodatabase + "\\" + cLoc + "Wnd",
                                        None, None, None, None)
print("Extracting multivalues to points...")
arcpy.sa.ExtractMultiValuesToPoints(cLocCpy,
                                    "MaxWindGusts MaxWindGusts_12_13;MaxSustWinds MaxSustWinds_12_13;'NWS Precip pct of normal' NWS_Precip_pct_of_normal_12",
                                    "NONE")

You put "BILINEAR" but that's not required, right? 

The above python script shows me first copying the point file from an existing GDB. 

Point path is in the default GDB. 

cLocCpy is stored in:

C:\\Users\\gmarcus\\Documents\\ArcGIS\\Projects\\MyProject4\\MyProject4.gdb\\LocsJan19Wnd

0 Kudos
DanPatterson_Retired
MVP Emeritus

Gabriel, the last parameter is optional...

The input raster list looks a bit strange... a semicolon delimited list seems normal, but why is each part consist of 2 elements ( ie maxwindgusts maxwindgusts_12_13) ?  Are they in the same geodatabase?

0 Kudos
GabrielMarcus1
Frequent Contributor

The second "strange looking" part is the output field name as illustrated in the screen shot below. 

I'm running ArcGIS Pro 2.2.4 if that make a difference. 

0 Kudos
DanPatterson_Retired
MVP Emeritus

saw it now (I rarely use this tool).  As for the input rasters and the point featureclass, it is more the Environments that I am interested in.  It fails on the MaxWindGusts… which you chose from a drop-down list of layers? or by navigating to the folder and choosing the layer there.  I find that Arc-anything is pretty good at showing stuff that is in the dataframe/map, but less so on making sure that the environments and paths to those layers jive.  My preference in testing is to use the folder icon and navigate to the inputs for the tool directly rather than rely what is showing as 'defaults' in any dialog.  It just rules out path and environment issues

GabrielMarcus1
Frequent Contributor

Dan, I appreciate your help!

Your advice on using folders to choose the file versus click/drag or using the drop down helped me discover a few issues I hadn't known about. Now my script runs in only 1/3 of the time. I appreciate it!

0 Kudos
DanPatterson_Retired
MVP Emeritus

Glad it worked out!... squirrel that info away for next time

0 Kudos
by Anonymous User
Not applicable

I was having a related issue, using a layer my organization provides (Ontario Provincial Digital Elevation Model). I had a few points to extract elevation values from and I wanted to use the Extract Multi Values to Points tool. Another member of my organization had no issues with the two files (point feature and imagery service) but I kept getting the error, "ERROR 001268: Input rasters: The input item, Elevation\Ontario_Provincial_Digital_Elevation_Model, is invalid." But it wasn't. 

Eventually, I tried changing my Processing Extent in the Environments tab within the tool from “Default” setting to “Current Display Extent”, ensuring that all my points were visible on the map. This worked and the tool executed as expected. Not sure of the python equivalent, but putting this here in case anyone else is struggling with this issue.