Map Calculus in GIS a proposal and demonstration(11)
发布时间:2021-06-07
发布时间:2021-06-07
This paper provides a new representation for fields (continuous surfaces) in Geographical Information Systems (GIS), based on the notion of spatial functions and their combinations. Following Tomlin’s (1990) Map Algebra, the term “Map Calculus” is used
)
(define distance
(lambda (x1 y1 x2 y2)
(sqrt (+ (power2 (- x2 x1)) (power2 (- y2 y1))))
)
)
(define length
(lambda (polyline)
(if (null? (rest(rest polyline)))
(distance
(first(first polyline))(second(first polyline))
(first(second polyline))(second(second polyline))
)
(+ (distance
(first(first polyline))(second(first polyline))
(first(second polyline))(second(second polyline))
)
(length (rest polyline))
)
)
)
)
power2 and distance hold a function and, apart from the use of the “Polish
notation” to represent mathematical operations, it is easy to see that they are similar to
any other representation of these functions in conventional language. Now, assume that a
polyline is represented as a list of co-ordinates in the form ((x1 y1) (x2 y2) (x3 y3) …(xn
yn)). The command first takes the first element of a list, while rest extracts the rest
of the list.
Notably, the function here is recursive and the values are not being assigned to
temporary variables during the various calls to the function but are used directly, thus the
state of the computation is explicit.
Garbage collection and interdependency
The ability to evaluate functions as symbols and the relationship to the Lambda Calculus
are not the only elements that should be borrowed from functional computer languages
to implement Map Calculus-enabled GIS. Other useful elements include the ability to
manage memory and perform “garbage collection”.
“Garbage collection” is the examination of computer memory to return allocated but
unused blocks of memory to the shared memory used by the application or the operating
system. This is required due to the continuous creation of temporary values and the need
to manage interdependency amongst functions. In a Map Calculus-enabled GIS, if f1, f2