I'm trying to convert a bunch of rasters to point features to further build a regression of those. Is it possible to do that without a conversion using arcpy? If not what am I doing wrong converting?

import arcpy
from arcpy import env

arcpy.env.workspace = "C:/Users/Sandro/Desktop/Bachelorarbeit/Data/clipped_season/TESTEVI_Heide_clip_season"

rasListe = arcpy.ListRasters()

for ras in rasListe:
    outpoint = r"C:/Users/Sandro/Desktop/Bachelorarbeit/Data/EVI_shp"+ ras.replace('.tif','.shp')
  • 1
    Do you get an error or what is wrong? Are you going to use ArcGIS for the regression? You can use modelbuilder instead of arcpy. And/or switch tool to RasterToNumPyArray – BERA Feb 4 at 12:39
  • This is the Error I get: : "ERROR 999999: Something unexpected caused the tool to fail" – Sandro Golia Feb 4 at 12:45
  • 4
    Try switching from shape output to features in a file geodatabase. Maybe the Point output exceed the shapefile limit of 2GB. Does the output of print outpoint look like a valid path+name of a shapefile? Use os.path.join instead of + when combining path and filenames – BERA Feb 4 at 12:46
  • I already did the RasterToNimpyArray but I couldnt find a tool to create a regression based on arrays. os.path.join somehow doesn't work. This is what I did: outpoint = os.path.join("C:/Users/...", ras.replace('.tif','.shp')). The Error says that os is not a variable. – Sandro Golia Feb 5 at 17:25

I got it to work with the NumpyArray method. This is the Code:

import arcpy
import numpy

arcpy.env.workspace = "C:/Users/..."
rasListe = arcpy.ListRasters()
for ras in rasListe:
arrays = arcpy.RasterToNumPyArray(ras, nodata_to_value=0)

[[0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.