A spatial data mining apparatus for calculating an optimal distance from a database,
wherein spatial information, such as addresses, is stored, includes an input mechanism,
for the input of an objective function required for the optimization of a distance,
an intermediate table generator 30, for employing in the database starting
point data and query point data for calculating the distances between each starting
point and each query point and for generating an intermediate table, and an optimal
distance calculator for calculating a distance based on the intermediate table
generated by the intermediate table generator, in order to optimize the value of
the objective function that is entered by the input mechanism.