POST
|
I am working on spatial interpolation. To extract values for my required points, I am using "Extract values to points" tool from Spatial interpolation toolbox. The tool is working good in ArcMap 10.5. But when I try to use the tool from ArcPy. Same value is generated for each point in test set. Here is my code: #point extraction# Set local variablesinPointFeatures = "test.lyr"inRaster = "out1"outPointFeatures = "extractvaluespts.dbf"# Check out the ArcGIS Spatial Analyst extension licensearcpy.CheckOutExtension("Spatial") # Execute ExtractValuesToPointsExtractValuesToPoints(inPointFeatures, inRaster, outPointFeatures, "INTERPOLATE", "VALUE_ONLY") My code for test point layer is as follow: ##XY layer for test# Set the local variablesin_Table = "test.csv"x_coords = "LONGITUDE"y_coords = "LATITUDE"z_coords = ""out_Layer = "test"saved_Layer = r"C:\Users\myc\Desktop\thesis combine\weather parameters\max temp\with elevation\chk1\test.lyr"# Set the spatial referencespRef = r"Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj"# Make the XY event layer...arcpy.MakeXYEventLayer_management(in_Table, x_coords, y_coords, out_Layer, spRef, z_coords) # Print the total rowsprint(arcpy.GetCount_management(out_Layer)) # Save to a layer filearcpy.SaveToLayerFile_management(out_Layer, saved_Layer) I am unable to understand the reason behind this error? P.S. When I work with geostatistical analyst tool set and GA to points, it works perfect, but I require to use raster calculator that's why I cannot use Geostatistical analyst. How can I fix this? Results are attached, no value cahnge in rastervalu.
... View more
10-08-2020
07:09 AM
|
0
|
0
|
343
|
POST
|
I am working on spatial interpolation. To extract values for my required points, I am using "Extract values to points" tool from Spatial interpolation toolbox. The tool is working good in ArcMap 10.5. But when I try to use the tool from ArcPy. Same value is generated for each point in test set. Here is my code: #point extraction # Set local variables inPointFeatures = "test.lyr" inRaster = "out1" outPointFeatures = "extractvaluespts.dbf" # Check out the ArcGIS Spatial Analyst extension license arcpy.CheckOutExtension("Spatial") # Execute ExtractValuesToPoints ExtractValuesToPoints(inPointFeatures, inRaster, outPointFeatures, "INTERPOLATE", "VALUE_ONLY") My code for test point layer is as follow: ##XY layer for test # Set the local variables in_Table = "test.csv" x_coords = "LONGITUDE" y_coords = "LATITUDE" z_coords = "" out_Layer = "test" saved_Layer = r"C:\Users\myc\Desktop\thesis combine\weather parameters\max temp\with elevation\chk1\test.lyr" # Set the spatial reference spRef = r"Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj" # Make the XY event layer... arcpy.MakeXYEventLayer_management(in_Table, x_coords, y_coords, out_Layer, spRef, z_coords) # Print the total rows print(arcpy.GetCount_management(out_Layer)) # Save to a layer file arcpy.SaveToLayerFile_management(out_Layer, saved_Layer) I am unable to understand the reason behind this error? P.S. When I work with geostatistical analyst tool set and GA to points, it works perfect, but I require to use raster calculator that's why I cannot use Geostatistical analyst. How can I fix this?
... View more
10-07-2020
11:48 AM
|
0
|
0
|
331
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|