Syntax Highlighing:
comments, key words, predefined symbols, class members & methods, functions & classes
# Open the vector point coverage of your choice, and
# for each element, find the same point in the raster
# of your choice and print the focal mean of that raster
# to a text file
#
# Author: Ray L. Harris, Jr.
# Date: Feb 2, 1997
#
#
# Clear the console window
#
clear();
# Get the input vector and raster
vector V;
raster R;
class Georef georef;
class FILE f;
GetInputVector(V);
GetInputRaster(R);
# Get the Raster georeferencing
georef = GetGeorefObject(R);
# Open a text file with write permission
f=fopen("c:/fieldfoc.txt","w+");
#
# Cycle through each vector point and
# convert its map coordinates to the
# raster row,col
#
numeric vx, vy, rx, ry;
for each point in V {
vx = V.point.Internal.x;
vy = V.point.Internal.y;
# Uncomment this line if you want to see the values
# in the console window
# print(vx, vy)
MapToObject(georef,vx,vy,R,rx,ry);
# print the raster focal mean to the text file
fprint(f,vx,vy,FocalMean(R,3,3,int(ry),int(rx),1));
}
# close the text file
fclose(f);