|
Instead of pointing at the polygons or specifying a search condition based
on the user-defined attributes, we can also select polygons within a
specified area.
|
|
|
Select polygons within an area.
Search for polygons overlapping an irregular area. In the database, we keep a record for each polygon. The structure of each record is rather involved, but in essence it provides information about the theme to which the polygon belongs, the arcs forming its outline, its area, its perimeter, its key, and so on. A method of searching for polygons overlapping a user-defined area, called a window, is as follows.
This method involves a considerable number of geometrical tests on intersections - the vectors on the outline of each polygon will be checked against the vectors on the outline of the window. Although the mathematics involved is not very complicated, the number of intersection tests to be performed could be prohibitively large. One way of reducing the number of intersection tests is to first check whether the bounding rectangle of the polygon overlaps with that of the window. A bounding rectangle is one bounding a feature, and it can be defined by two diagonal points, one from the smallest x and y coordinates, and the other from the largest x and y coordinates of the feature. If the bounding rectangle of a polygon is outside that of the window, then they certainly do not overlap. If the two bounding rectangles cross each other, then we need to invoke the intersection test to ascertain whether they overlap. If one bounding rectangle is entirely within another, then we still need to invoke the intersection test because it is possible that they do not overlap at all, as shown in the following diagram. Each bounding rectangle is composed of just four vectors. This greatly reduces the number of intersection tests required to find out whether the bounding rectangles are overlapping or disjoint. The bounding rectangles are so useful for solving this and similar problems that they are computed by the GIS and stored as system-defined attributes for the features. |
|||
|
|||
|