No BSD License  

Highlights from
Raster to XYZ

Be the first to rate this file! 6 Downloads (last 30 days) File Size: 4.11 KB File ID: #18894

Raster to XYZ

by Joseph Wheaton

 

23 Feb 2008 (Updated 25 Feb 2008)

Converts an Arc ASCII Raster to a vector point file.

| Watch this File

File Information
Description

This script simple reads in an ASCII raster file (in Arc ASCII Format) and then outputs a CSV file in XYZ format with a point (row) for each grid cell.

This is handy for converting gridded DEMs to raw point data.

It is slow because most of the IO part of the code can not be vectorized, but it does the trick.

Acknowledgements
This submission has inspired the following:
ascii2xyz
MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
25 Feb 2008 Wolfgang Schwanghart

Actually a good idea, but somewhat poorly implemented. First, the file is a script and not a function what may cause that variables in your workspace are overwritten when executing. As the author noticed, the function is slow, yet it CAN be vectorized (see e.g. dlmwrite with the option append). But even if you don't vectorize speed can be significantly improved when preallocating an array where you write the data to (see the Mlint report).

I tried the script on an ascii file I have. The script told me that it worked. Yet, I had a look at the csv and it was empty but the header. But that was my fault, since I forgot that my ascii grid had no header. Hence, this is my stupidity. However, I would have been confronted with my stupidity earlier, if there had been error checking.

In summary: There are many improvements to make. The script is heavily commented which is very good. Hence, I avoid a rating here and hope to see an update of the file soon.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
ascii raster Joseph Wheaton 22 Oct 2008 09:50:24
vector Joseph Wheaton 22 Oct 2008 09:50:24
lidar Joseph Wheaton 22 Oct 2008 09:50:24
dem Joseph Wheaton 22 Oct 2008 09:50:24
lidar Bidhyananda 23 Apr 2010 14:13:22

Contact us at files@mathworks.com