Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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")
share|improve this answer
  • concatenate all your xyz files together
  • use a csv2dbf converter, because your xyz file is a form of csv file. There are tons of those available by googling. I found python source code at https://github.com/fitnr/census2dbf/blob/master/census2dbf.py , which seems to be a generic csv2dbf python module, despite the name.
  • import this big dbf into arcgis

or

  • concatenate all your xyz files together
  • import directly to arcGIS using import xy data

edit: I assume by ".xyz file" you mean a simple ascii file of the following format (for x y and z values):

x1 y1 z1
x2 y2 z2
x3 y3 z3
x4 y4 z4
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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