After having converted my xyz-file to a point feature class, I am trying to convert to a grid using a Python snippet. The data represents river bathymetry. However, when executing the script, I get: 'ERROR 999999: Error executing function'.

There must be something wrong with my input data, or with the arguments in the python snippet. I already changed double quotes into singles (worked for me with a previous problem), and before converting my .pts-input file to a point feature class, I checked for any odd lines that might contain string - in this file there are none.

This is my code (the converting-to-point-feature-class section does work):

The variable fn is simply the input file name defined earlier on in the script. RDnew is a coordinate system that was also defined earlier on in the script.

    print 'Converting to point feature class.'
    pts_shp = fn[0:8] + '.shp'  #output file name (using fn[0:8] to get rid of the .pts or .txt extension)
    arcpy.ASCII3DToFeatureClass_3d(fn,'XYZ','.\\shp_points\\' + pts_shp,'POINT','1',RDnew,'#','#','DECIMAL_POINT')

    print 'Converting to grid.'
    output_grid = 'grid_' + fn[3:8]
    arcpy.PointToRaster_conversion('.\\shp_points\\' + pts_shp,'Shape.Z','.\\grids\\' + output_grid,'MOST_FREQUENT','NONE','1')      

Error 999999 does not really get me anywhere. Do you have any suggestions on what might be wrong with my input / code?

  • i don't often utilize that tool, but could it be that 'MOST_FREQUENT' is used in conjunction with a 'NONE' field? - or a cell size of 1 could be ridiculously large depending on the extent and map units? Sep 22 '15 at 3:10
  • That shouldn't be the problem; this is the default. I used it on a different (smaller) dataset, that worked fine. The cell size should be fine too: 1x1m in a ~ 250x350 km map extent.
    – Renée
    Sep 22 '15 at 5:50
  1. Do you have advanced license and the necessary extension 3D analyst? I am not sure if you need it for the ASCII3DToFeatureClass_3d function but you might for the feature to raster conversion. Did you check out the 3D analysis extensions early on in your script? Here is an example code from ESRI to import arcgisscripting (for the ASCII to feature class part) and you can check in 3D using

    /* Check out the 3D license. arcpy.CheckOutExtension("3D") /* your code here /* Check the license in when you finish arcpy.CheckInExtension("3D")

  2. Another issue is you have a field name 'Shape.Z' specified in your point to raster conversion line, I am not sure if dots are allowed within an attribute column name. Try changing it into 'Shape_Z' in the corresponding column name of the resulting shapefile from your ASCII to Shape conversion.

*I don't have enough reps to comment under your post that is why I've put this as an answer.

  • 1
    i think the XYZ refers to the input file type. Sep 22 '15 at 2:31
  • you are correct I missed the file type argument between input file and output file name. thanks. I edited my answer
    – yanes
    Sep 22 '15 at 15:19

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.