rtovec.sml

  Download

More scripts: Convert

Syntax Highlighing:

comments, key words, predefined symbols, class members & methods, functions & classes
            
# rtovec.sml
# Converts elevation raster to vector object as contour lines.
# Globals
class RASTER Rin;
class VECTOR Vout;
GetInputRaster(Rin);
GetOutputVector(Vout);
numeric zStart = GlobalMin(Rin); # set range to raster limits
numeric zEnd = GlobalMax(Rin);
numeric range = zEnd - zStart;
numeric zInterval = round(range / 40); # set approx 40 contours
numeric zScale = 1;
numeric zOffset = 0;
numeric sampleRate = 1;
numeric resolution = 2;
numeric filterSize = 1;
string flags$ = "SmoothAverage";
clear();
print(zStart, zEnd, zInterval, zScale, zOffset, 
	 sampleRate, resolution, filterSize, flags$);
Vout = RasterToVectorContour(Rin, zInterval, zStart, zEnd, zScale, zOffset, sampleRate, resolution, filterSize, flags$);
# alternate form - use defaults
# Vout = RasterToVectorContour(Rin, zInterval)
CloseRaster(Rin);
print("Process Completed.", "Vout#Lines:", Vout.$Info.NumLines);