[GIS] Importing XYZ to ArcMap

arcgis-desktoparcmapconvertxyz

My colleague has several hundred xyz files (*.xyz) and wants to make a DEM to use it in ArcMap.
Files have three columns witohut first lane (variable names).

I suggested her:

  1. to add first line with x, y and z column names (i know just manual way)
  2. to convert xyz to dbf or similar
  3. to add it in arcmap (as add x y data)
  4. finally to use point to raster tool

I would probably know how to make a script for step 3 and 4, but i don't have any ideas how to solve step 1 and 2.

Or maybe there is an easier way (a tool,script) for direct conversion from xyz to dem?

Best Answer

This was my final solution. There are basicaly two tools that are needed to convert *.xyz to arcmap friendly raster format. You can use this script when adding a script tool to arcmap toolbox. Some parameters are set for my example (e.g. resolution is 5 m).

import arcpy
arcpy.CheckOutExtension("3D")

workspace=arcpy.GetParameterAsText(0)
arcpy.env.workspace = workspace

projection=arcpy.GetParameterAsText(1)

suffix = arcpy.GetParameterAsText(2)

xyz_list=arcpy.ListFiles()

for xyz in xyz_list:
    shape_name = str(xyz[:-4])+".shp"
    raster_name = str(xyz[:-4])+"."+str(suffix)
    arcpy.ASCII3DToFeatureClass_3d(xyz, "XYZ", shape_name, "POINT", "1", projection, "5", "","DECIMAL_POINT")
    arcpy.PointToRaster_conversion(shape_name, "Shape.Z", raster_name, "MEAN", "NONE", "5")