I am baffled by some MapBasic code that I want to use to do some spatial
smoothing. Briefly, I want to consecutively buffer each polygon in a table,
and use the buffers to select neighbouring polygons--some of these may be
used to smooth values associated with the central polygon that was used to
make the buffer (I have called this central polygon the "target"). To decide
which subset of the neighbouring polygons will be involved in the smoothing
work, I need to be able to compare their columns to those associated with
the central polygon.
In the following (very abbreviated) code I create the object "oTarget" and
the single-record table "rsTarget" for each record in the table. The
procedure "getNeighbours" buffers oTarget to select nearby records into a
multi-record table called "neighbourhood". The bizarre thing is that when I
cycle through rsTarget and assign the single value in each column to
targetSd (a float), I appear to acquire values that aren't even in
rsTarget--they seem to be coming from the first and last records in the
"neighbourhood" table--right column, wrong record(s). This makes no sense to
me, but I think I have verified this by printing out values of targetSd for
the first record (r=1) halting the program, and then displaying
neighbourhood and rsTarget in a browser. (note remmed out code in block
letters)
I hope I have made sense, and will be very grateful if someone can explain
to me what is going on, and how I might correct things. Thanks!
++++++++++++++++++++++++++++++++++++++
for r=1 to TableInfo(inputFile, Tab_Info_Nrows)
Fetch Rec r From inputFile
oTarget=inputFile.obj
select * from inputFile where rowID=rowCount into rsTarget 'single
record...
'getNeighbours creates table neighbours...
Call getNeighbours (oTarget, rowCount, bufferNodes, bufferSize,
bufferUnits)
neighbourhoodSize=TableInfo(neighbourhood, Tab_Info_Nrows)
for c = 1 to numberColumns
'!!the next line assigns values to targetSd that are not in rsTarget!!
targetSd=rsTarget.col(c+numberColumns+1)
'PRINT TARGETSD
Call smoothCalc (various parameters, including targetSd)
next 'c
'STOP
next 'r
++++++++++++++++++++++++++++++++++++++
--------------------
Ian Robertson
Dept. of Anthropology
Arizona State University
Tempe, AZ, 85287-2402
[EMAIL PROTECTED]
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]