17

Spatial Queries

An essential capability of any GIS or desktop mapping system is the ability to perform spatial queries. Spatial queries are questions such as "Identify all oil wells in the county," "Find all streets above the water line," "Show all streets that end at the city limits," and "Where are the valves within 20 feet of the pipeline."

This section presents the spatial query capabilities of GeoMedia. The attribute query capabilities of GeoMedia were presented earlier. Material presented later in this chapter will show you what can be done when you link attribute and spatial queries.

Conducting a Spatial Query –
An Overview

A spatial query is one option available through the normal GeoMedia query process. You access spatial queries from the Main Menu using Tools > New Query. You then see the normal New Query dialog, shown in the illustration at left.

At this point you will need to determine what feature class you want to be the SUBJECT of the query. The subject is the feature class that will result from the filtering operation. Clicking on the down arrow at the left of the "Select Features in" dialog shows you all warehouses and any previously created queries. You can expand any warehouse to see what features are in it.

In the illustration to the left, the feature class Parcels has been selected, and any parcel features that meet the query operator will be included in the resulting query set. The use of the terms subject and object here are the same as in standard English sentence usage. In the sentence "Bob went home," Bob is the subject, went is the verb, and home is the object. In the filtering operation, the "sentence" will have the form "SUBJECT spatial operator OBJECT."

2 NOTE: At this point you could restrict the selection to some subset of the parcels (e.g., parcels that have an assessed value less than $50,00) by adding attributes to the filter. Attribute filters are discussed earlier in this chapter, and there is more on combining spatial and attribute filters later in this chapter. Once you have selected the subject feature class, you can click on the Spatial button and the dialog will expand, as shown in the following illustration.

Fig. 23-2

At this point you will need to determine the spatial operator and the OBJECT feature class. In this example, the Contain operator has been chosen and the object feature class is Wells. The object is the feature class that will spatially constrain the subject features. Here, the resulting subject class will consist of those parcels that contain any of the object feature class Wells.

2 NOTE: You can also limit the object feature class with an attribute filter. When you have entered the appropriate information, you can click on OK and the query will be executed. Do not forget to enter a usable name for the query. 2 NOTE: Depending on how you have configured the Query tab (avaliable by clicking on Options on the Filter dialog or via theTools> Options dialog from the main GeoMedia menu), you may see a new query set added to your map window, a new map window created with the query results, a new data window, or all of these. You might see nothing if you did not wish to see the results immediately and set the flags that way. The area in the lower right of the dialog can be very helpful. It provides a graphic representation of the results of the currently selected spatial operator.

Spatial Operators in GeoMedia

There are nine types of spatial operators available to you in GeoMedia. They are Contains and "Are contained by," "Entirely contains" and "Are entirely contained by," Overlap, Meet, Touch, "Are within distance of," and "Are spatially equal." The operators work in a structure of the form:

Select Features in SUBJECT that [operator] Features in OBJECT

as in "Select Features in PARCELS that contain Features in WELLS." The result of the operation will always be features from the SUBJECT class. In this example, the result will be PARCELS that meet the criteria. The following sections discuss the specifics of each operator.

Whenever a spatial operator examines a specific feature (e.g., an instance or record), the entire geometry of the feature is considered. This may be confusing when there are a series of geometries that compose a single entity. For example, a single street might have been digitized as a series of small segments. Each segment (a "feature" in GeoMedia terms) would be represented by a record in the warehouse. Each of the records would have the attribute of "Smith Street," but with different (connecting) geometries. As a result, while you may think of Smith Street as a single feature on the landscape, it may actually be either one or many features in the warehouse, depending on how the data was created and processed.

If Smith Street were digitized as a series of individual blocks (each with a different, individual record in the database) in the warehouse sense, it would consist of multiple features. If Smith Street had been digitized from beginning to end as one (large) geometric entity, there would be only one record in the warehouse and the street would be one feature.

GeoMedia does not "cut" existing geometries. Therefore, the query "Find the parts of Smith Street that fall within the city limits" would not locate any because Smith Street is one geometry and any part extends beyond the city limits. On the other hand, if Smith Street consisted of a lot of small segments, those segments within the city would be returned, and those outside (in whole or part) would not.

Contain

The contain operator identifies those subject features surrounded by object features. Examples of contain operators are:

Find all counties that contain oil wells

Find all pipelines that contain valves

Find all parcels that contain roads

Find all counties that contain lakes

Point features cannot contain other features. That is, they cannot be the subject of the contain operation. However, point features can be the object of the contain operation. Line features can contain point features. A line feature contains a point feature if the point is anywhere on the line or at its ends. The point must be geometrically coincident with the line.

Determining if a point is geometrically coincident with any line segment is a simple operation in basic geometry. Conceptually, it works like this: The formula for the staight line segment between two vertices is defined and the coordinates of the point in question are substituted. If the equation is still balanced, the point is on the line. For example, suppose that point one is at x=1, y=1 and point two at x=10, y=10. Any point where x=y will be "on the line," and any point where x is not equal to y will not be on the line. There is a 1-cm "tolerance." That is, the coordinates can be "off" by up to 1 cm and still be considered the same.

When you are accessing data from warehouses that are in different datum/projections, be aware that the transformation process may mean that the two points at the same point on the earth may end up with slightly different coordinates. This is inherent in the math. If exact correspondence between such data elements is essential, you might want to use the capabilites of GeoMedia Pro to first process the data.

Line features can contain line features. A line feature fully coincident with another line feature contains the second one. If there is a case in which a smaller line feature is coincident with part of a larger line, the larger line contains the smaller one. Note that this is true even if the vertices are not the same. The smaller feature’s vertices simply have to fall along the longer one’s length. If a smaller line feature shares the same starting vertex as a larger one, the larger one contains the smaller one.

Line features cannot contain area features. Area features, however, can contain point, line, and area features. An area contains a point if the point is anywhere within the boundary of the area or on the boundary. An area contains a line if it is totally within the area. If any part of the line is outside the area, the contain operation is not valid. An area that has a line with its starting vertex on the boundary of an area but is otherwise inside the area does contain the line. The first illustration at left shows examples of contains for points.

An area that has a line entirely coincident (on top of) one or more boundary segments of the area contains the line. An area feature contains another area feature if the object feature is completely within the subject feature or if the object feature shares one point or a boundary segment but is otherwise inside the subject area.

In the second illustration at left, the upper line contains both of the points, as does the area. In both the upper and middle examples in this illustration, the thin line contains the thick one. In the bottom example, the thin line does not contain the thick dotted one.

In the first illustration at left, the large box contains all the lines that are highlighted as thicker lines. The line to the lower left ("Jones Street") is not contained because it extends beyond the area, and portions of a single geometry fall outside the area feature. The line to the lower right might appear as a single line ("Smith Street"), but it actually consists of two geometries that connect on the boundary of the area feature. As a result, part of Smith Street is contained in the area and part is not.

In the examples in the second illustration at left, the larger area contains the smaller one in all except the upper right.

"Are contained by"

The "Are contained by" operator identifies features fully surrounded by a feature. Examples of "Are contained by" follow.

Find all wells contained by the county

Find all street segments contained by the city limits

Find all lakes contained by state parks

Points, lines, and areas can all be the subject of an "Are contained by" spatial operator, but points cannot be the object. Points can be the subject of an "Are contained by" operation that has an object of lines or areas. A point feature is returned by the filter if the point is anywhere on the line or at the ends. The point must be geometrically coincident with the line. A point feature is also returned if it falls on the boundary of an area.

Line features can be the subject of an "Are contained by" operation that has an object of other line features. A line feature fully coincident with another line feature meets the filter criteria. If a smaller line feature is coincident with part of a larger line, the smaller line meets the "Are contained by" criteria. Note that lines can be coincident even if the vertices are not the same. The smaller feature’s vertices simply have to fall along the longer one’s length. If a smaller line feature shares the same starting vertex as a larger one, the smaller one meets the "Are contained by" criteria with respect to the larger one. If the two lines are identical, they also meet the "Are contained by" criteria.

2 NOTE: When working with features from different warehouses that have different map projections, it may be the case that two features that in the real world would meet the "contain" conditions may not have the same map coordinates as a result of differences in the map projection computation.

Area features cannot be the subject of an "Are contained by" operation where the object is a line or point feature. An area feature meets the "Are contained by" operation with another area feature if the subject feature is completely within the object feature. If the subject feature shares one point on a boundary or a boundary segment but is otherwise inside the object feature, it still meets the "Are contained by" operator criteria.

A common spatial problem is to identify all smaller area units that constitute larger ones. Examples include the counties that make up a state, the blocks that make up a Census tract, and many others. It would initially seem reasonable to use the "Are contained by" operator in a query such as

Select Features in: Counties That: are contained by Features in: Iowa where Iowa is a single feature class consisting of the area of the sate of Iowa. This is the correct approach if the smaller area boundaries are a proper subset of the larger one. If the county boundaries of the exterior counties exactly correspond with the state boundary, the "Are contained by" operator will work. It will also work if the county boundaries do not exactly correspond but fall slightly inside the state boundaries. If the county boundaries fall, even a small amount, outside the state, however, the "Are contained by" operation will not work.

Normally boundaries of smaller and larger units like this will correspond if they have been drawn from the same data source. If you are integrating data from a number of sources or warehouses, though, it may be the case that the boundaries do not exactly match. In this case, the overlap operator would be preferred because some of the exterior counties may not be returned by the "Are contained by" operator.

"Entirely contains"

This operator works very much like the Contain operator except for boundary cases. A point on an area boundary means that the area does not entirely contain the point, though it does contain it. If a point is at the end of a line, the line does not entirely contain the point, though it does contain it. If an area is inside a larger area but shares some of its boundary, the larger area does not entirely contain the smaller area, but does contain it.

"Are entirely contained by"

"Are entirely contained by" has the same relationship to "Entirely contains" that "Are contained by" has with Contains. In other words, the "Are entirely contained by" operator works like the "Are contained by" operator except for boundary cases. A point on an area boundary means that the point does not meet the "Are entirely contained by" criteria, though it does meet the "Are contained by" criteria.

If a point is at the end of a line, the point does not meet the "Are entirely contained by" criteria, though it does meet the "Are contained by" criteria. If a coincident line shares an end point with another line, it does not meet the "Are entirely contained by" operator’s criteria, though it would meet the "Are contained by" operator’s criteria. If an area is inside a larger area but shares some of its boundary, the larger area does not entirely contain the smaller area, but does contain it.

As noted in the discussion for "Are contained by," a common spatial problem is to identify all the smaller area units that constitute larger ones. Examples include the counties that make up a state, the blocks that make up a Census tract, and many others. It would initially seem reasonable to use the "Are entirely contained by" operator in a query such as

Select Features in: Counties That: are entirely contained by Features in: Iowa

where Iowa is a single feature class consisting of the area of the sate of Iowa. The "Are entirely contained by" process will identify only those counties that are inside the state but do not touch the border. Any county adjacent to the Iowa state line will not be part of the query set. The proper operator to identify all smaller spatial units that constitute a larger one is either "Are contained by" or Overlay, as previously discussed.

As you have seen, there are two pairs of similar operators: Contains and "Are contained by" and "Entirely contains" and "Are entirely contained by." Each pair performs the same spatial operation but has a different order of "subject" and "object, " and will therefore yield different results. The statement "Feature X contains feature Y" will not yield the same result as "Feature Y is contained by feature X."

For example, "Find all wells contained by the counties" is not the same as "Find all counties that contain wells." In the first case, the answer amounts to "all wells"; in the second, the answer amounts to "all counties." In deciding which paired operators to use, you need to determine what feature class you want as the result. The feature class in the left portion of the filter query builder will be the feature class returned by the query.

Meet

The meet operator identifies those subject features that share one or more boundary points with the object feature but that otherwise have no part of the feature that falls within the boundary of the object. Examples of meet operators follow.

Find all wells that meet parcels

Find all streets that meet the city limits

Find all lakes that meet forests

Find all feeder lines that meet the main pipe

A point can meet an area if it is on the boundary of the area. If a particular point is on an area boundary, it will satisfy both the "Are contained by" and the Meet criteria. A point can meet a line if it is coincident with either of the line’s end vertices. If it is coincident with the line anywhere else but at the ends, it does not meet the line but does satisfy the Contain operator.

A line can meet a point if the point is coincident with one of the line’s end vertices. A line can meet another line if the end vertices are coincident. A line can meet an area either by having one or more of its vertices located on the area boundary and no part of the line that falls within the area. Essentially the line must be coincident with the boundary or coincident in some areas and otherwise outside the area’s boundaries. If any portion of the line is within the area’s boundaries, it does not satisfy the Meet criteria.

An area can meet another area if they both share one or more vertices and if no other portion of their areas coincide. Meets is a reciprocal operator. That is, if A meets B then B meets A. The first illustration at left shows examples of meets for points.

In both examples in the previous illustration, the points meet the line and the area features, and the line and area features meet the points. In the second illustration at left, the point is not at an end vertex and therefore the point does not meet the line, nor does the line meet the vertex.

In the first of the following illustrations, there are a number of examples of lines that meet (dark) and that do not (light). The zigzag line to the lower right actually consists of two geometries that meet on the area border. The feature on the border but outside satisfies the Meet criteria. However, the one on the inside does not. The second of the following illustrations provides examples of meet relationships among area features.

Fig. 23-9

The Meet operator is effective for identifying all area units that abut a linear feature. Suppose for example you wanted to identify all parcels that abutted a particular road. The following filter would identify the proper parcels.

Select Features from: parcels That: meet Features in: main_road

Meet is also an appropriate operator to identify area units outside but abutting another area feature. For example, suppose you wanted to identify all parcels outside the city limits but abutting it. The following filter would identify the proper parcels.

Select Features from: parcels That: meet Features in: city_limit

Overlap

The following are examples of overlap.

Find all wells overlapped by the county

Find all street segments overlapped by the water line

Find all lakes overlapped by state parks

Points cannot overlap points. However, points can overlap lines and a line can overlap a point or points. If a point is coincident with any part of a line except the vertices, it overlaps it, and vice versa. A point overlaps an area if it is wholly within the interior of the area. Lines overlap lines if any vertex on the subject line is coincident with any part of the object line. If the subject overlaps the object, the object line also overlaps the subject.

2 NOTE: If a second line is coincident with a first at only the exterior vertices, or if the points of coincidence do not actually include interior vertex locations, the lines may not be reported as overlapping due to computational differences in the determination of the coordinates. A line that is wholly or partially within an area, or one wholly inside an area and terminating on the boundary (but does not extend "outside"), overlaps the area (and the area overlaps the line). A line coincident with a portion of an area’s boundary does not overlap the area (but an area in this situation overlaps the line).

An area overlaps a line if any vertex of the line is interior to the area’s boundary. If a line is wholly on an area’s boundary, the area overlaps the line. An area overlaps a point if the point is wholly within the area. If, however, the point is on the area’s boundary, the area does not overlap the point. Areas overlap areas if any point within the subject area coincides with the interior of the object area. A subject area that shares only a boundary point or points with the object area and is otherwise outside the object area does not overlap it.

The overlap operator is reciprocal (e.g., if A overlaps B then B overlaps A) if one element is a line and one a point feature. If line A overlaps point B, point B overlaps line A. The operator is also reciprocal if the features are both members of the line or area classes. If line A overlaps line B, line B overlaps line A. If area A overlaps area B, area B overlaps area A. They are not always reciprocal if one is a line and one is an area. An area can overlap a line if the line is coincident with a portion of the area’s boundary. In this case, however, the line does not overlap the area.

The first of the illustrations at left shows examples of point and line overlap. In the upper example in this illustration, the point does not overlap the line and the line does not overlap the point. In the lower example, the point and line overlap each other. In the second of illustration at left, all of the smaller dark lines overlap the lighter ones, and vice versa.

In the third illustration at left, all the lines overlap the area except for the zigzag line to the right that starts at the area boundary, and the line at the bottom, which is coincident with the area boundary. The point on the boundary (the open circle) does not overlap the area, but the dark point in the upper right does. The area does not overlap the line to the right, but it does overlap all others, including the line on the boundary. The area overlaps the dark point but not the light one on the boundary.

As noted in the discussion of "Are contained by" and "Are entirely contained by," a common spatial problem is to identify all smaller area units that constitute a larger one. Examples include the counties that make up a state, the blocks that make up a Census tract, and many others. When the boundaries exactly correspond, the proper operator to find all the smaller constituent areas is the "Are contained by" operator. If the boundaries do not correspond, however, the best GeoMedia operator to accomplish this goal would be Overlap.

Touch

Touch is the global (universal) spatial operator. If any of the other operators apply (contain, entirely contain, meet, or overlay), the features touch.

"Are within distance of"

Use of the "Are within distance of" operator in a query is very similar to performing a buffering operation and then finding the features that overlap the buffer zone. The process compares the distance for all features in the subject feature class to the nearest object features. If that value is less than the indicated value, the subject feature is made part of the query set results. The following are examples of the "Are within distance of" operator. A shown in the illustration that follows, the dialog for this operator is somewhat different from the other spatial operators.

Find all valves within 100 feet of other valves

Find all wells within 1 kilometer of the stream

Find all parcels within 1 mile of the city

Fig. 22-14

When you complete the "Are within distance" dialog, be sure you have the sequence of subject and object correct and that you have chosen the appropriate distance and unit. The entry in the left portion of the dialog, the "Select features in" portion, will be the features returned by the query if any meet the criteria. In the right-hand dialog, the "Features in" part, are the features from which distances will be computed. Suppose you wanted all valves within 100 feet of the water line. The valves are what you want; therefore, valves would be entered in the left dialog and the waterline entered in the right. The units in the Units drop-down will always be what you have selected as your default unit of measurement in the Tools > Options Measurement tab. Other units are available from the list, or you can type in the appropriate characters. In the Measurement tab you will also have chosen if you do or do not want the curvature of the earth taken into account in the computation.

Any feature class can be used as either object or subject. In the case of points as subject or object, the process is straightforward, with the simple distance from the object features to candidate subject features being computed. One possibly confusing use of this operator would be to identify all point features within a specified distance of members of the same class. Say you wanted all oil wells within 1 mile of another oil well. You might at first consider entering the feature class oil well in both subject and object feature portions of the New Query dialog and putting 1 mi in the units. This would return all oil wells, however, because any oil well is within 1 mile of itself.

When lines are the subject or object, all coordinates of the object line serve as a starting point, and all points on the subject are assessed to determine if any part of the subject falls within the specified distance of any part of the object. This also applies to areas.

The process does not find the "part" of the object within the distance. If any part of the feature is within the distance, the entire feature is selected. Perhaps a clearer way of understanding the operation is to restate it as "Find the complete feature if any portion of the subject feature is within the specified distance of the object feature."

"Are spatially equal"

The subject and object feature classes for the "Are spatially equal" operator must be of the same type (e.g., point and point, line and line, or area and area). The operator identifies those features that occupy the same space. If points from two feature classes have the same coordinates, they are spatially equal.

Spatial Queries and MGE Segment Manager Warehouses

When you are working with data from an MGE Segment Manager warehouse, you have an additional set of spatial operators. These operators allow you to query linear network data to identify those locations at which segments are similar (or different). When you are using the Segment Manager warehouse, attributes are associated with different portions of a linear network. In a highway, for example, the portion of the road from mile post 100 to 120 might be asphalt, and the segment from 120 to 150 might be concrete. Other properties of the roadway might apply to very specific portions (segments) of the highway.

In Segment Manager you are able to designate the beginning and ending locations, and segments with these properties are dynamically created. In a query you can ask to have the system identify those portions of a linear network that share various attributes. When the query is initiated, the portion of the network that has all the selected attributes is dynamically created and returned in GeoMedia.

The operators that process the linear network data are called overlay operators. When the warehouse you are accessing is an MGSM, there are two new buttons added to the spatial query dialog on the lower left. These are Add Overlay and Remove Overlay, as shown in the following illustration.

Fig. 22-15

The two overlay operators are Intersect and Difference. In this application, Intersect is the operator that finds those portions of a linear network where all the segments with the selected properties occur. Difference identifies those portions of the network that differ on the selected segment attributes. A key point to note is that the criterion of Intersect and the criterion of Difference will dynamically return segments that meet the criteria.

Suppose in the previously mentioned example of road surfacing that there is a second set of attributes; namely, construction dates where the portion of the highway from mile 110 to mile 140 was resurfaced in 1995. An MGSM-directed query that asked for all segments that were asphalt and paved since 1995 would dynamically create the segment from mile 110 to mile 120 (end of the asphalt) and return it. The overlay operator would be Intersect. A Difference operator might be used to identify the portion of the roadway that was asphalt but had not be paved since 1995.

The process of creating an MGSM-based segment query is very similar to the normal query operation. You will need to access the Query dialog from Tools > New Query and identify a feature class to serve as the subject for the query.

2 NOTE: In the process of identifying the warehouse for the feature class, you will be indicating that the source is an MGSM warehouse. You may wish to select attributes to filter the subject class using the same process as for adding attributes to the filter. Once you have selected the subject feature class and any attribute filters, you can click on the Add Overlay button and the Add Overlay dialog, shown in the illustration at left, will appear.

The Add Overlay dialog acts in a very similar way to the Select Feature dialog in that it identifies those feature class attribute tables associated with segment data. Only attribute tables associated with linear network segments will be displayed. When you select the appropriate attribute table, a new tab appears in the query dialog.

Suppose, for example, the feature class you were interested in was called Construction and the segments of interest were those from the average daily traffic tables where the traffic was greater than 1,000 units. Your query tabs would have "From construction where" on the left tab and "Intersect from avg_dly_trfc" on the center tab. The Attributes column would have "volume" and the Values column "1000. The query would return all line features dynamically created by MSGM meeting the criteria, to which you would assign a meaningful name.

This section has considered the powerful spatial query options in GeoMedia and the preceding section looked at attribute queries. The next section will bring together these two and show you how to build queries that deal with both.

Combining Attribute
and Spatial Queries

In the previous two sections you have seen how attribute and spatial queries are created and used. The discussion in this section combines attributes and spatial operators. With the combination of these two classes of operations, you will have a very powerful set of ways to look at geographic data. In this section a series of analysis scenarios will be used to show how these types of queries can be created and used.

Finding a City

In this scenario your goal is to identify a good location for a new plant. You have decided that the ideal location is one where the surrounding area has a good amount of college educated individuals (at least 20% of the population), is fairly rural (to keep down costs), and is on or near an interstate.

There are a number of ways in which to proceed, depending on how you feel the analysis may be reused later, or if there is the possibility you will be asked to change factors as you move forward. In this example, each set of location factors will be identified individually so that you can see how they interact. In other situations you might want to combine more than one criterion in a single step.

2 NOTE: Before you perform the analysis, be sure to connect to the US Sample Data Access warehouse. You might also want to apply a connection filter to reduce the area involved and speed up the process. You will need to start the New Query dialog, Tools > New Query, and select the Counties feature class from the US Sample data. In the Query dialog you would build the following query using the county attributes EDCOL, EDGRAD, EDSOMCOL, and POP:

Select Features in: Counties From: Counties where (EDCOL + EDGRAD + EDSOMCOL) > POP / 5

2 NOTE: You could accomplish the same query with Select Features in: Counties From: Counties where (EDCOL + EDGRAD + EDSOMCOL)/POP > 0.20. You should name this query something like Counties - College > 20%. This query set will represent all counties where the total college educated population in the county is greater than 20% of the total population.

You would next identify those cities that are in these counties. The query string would use Cities as the subject feature class and the new query, Counties - College > 20%, as the object. It would look like this:

Select Features in: Cities That: are contained by Features in: Counties - College > 20%

You should name this Cities in acceptable counties. You want features from the feature class Cities as your result. Therefore, you should use the "Are contained by" operator. In this case, the "Are entirely contained by" operator was not used because a city on the county border would be acceptable.

You have now identified potential cities that meet your selection criteria. The final step is to determine which, if any, are close to the interstate. You have two options here. If you want only those cities that actually have an interstate going through them, you would want to use the Overlap or Touch spatial operators. If this was what you wanted, you would create the following query, and name it Candidate plant cities.

Select Features in: Cities in acceptable counties That: touch Features in: Interstates

Because these are smaller, rural areas, however, it may well be the case that the interstates do not actually run through many of the desirable cities and you may want to relax the criterion to allow any city within 5 miles of an interstate to meet the selection criterion. To do this, you would create the following selection filter.

Select Features in: Cities in acceptable counties That: are within distance of 5 mi Features in: Interstate

Processing Requirements of a Query

In the previous query process it would have been possible to start the process by identifying all cities in the United States within 5 miles of an interstate and then winnowing them down. The final results would have been the same. Obviously this would not have been the best approach, however, because the computation of distance between interstates and cities would have to have been performed on all 3,702 cities that met the criterion.

In the approach used here, the first criterion was a selection criterion that quickly reduced the number of possible counties using only attribute comparisons. Once the candidate number of counties was identified, the more computationally intensive spatial calculations were performed. As a general rule, this is a good strategy.

Locating Intersecting Linear Features

This example discusses the workflow you would follow to identify such selections as all "feeder" streets that intersect a main highway, or all small sewers that connect to a main sewer. The appropriate way to approach this type of problem is determined by the design of the feature classes in the warehouse.

There are two major ways the data could be organized. In the first case, the "main" road, sewer, or whatever is a separate feature class (e.g., feature class main_sewer). In the second case, big_sewer is simply identified by some different attribute value in the overall feature class sewer. In the first case, you would identify all feeder features with the following query.

Select Features in: feeder_sewers That: meet Features in: big_sewer

If both the big sewer and feeder sewers are in the same feature class (sewers) and are simply identified by different attribute values in the field size, for example, the approach is quite different. You can identify the smaller sewers that meet the larger one in a two-step process or in a single step. The two-step process involves creating a query set consisting of all features that make up the main sewer line. The query filter might look something like the following.

Select Features in: sewer where sewer_size >= 8

You would name this query main sewer. You would then perform a second filter operation to find the feeders with a query filter such as the following.

Select Features in: sewer where sewer_size < 8 That: meet Features in: main sewer

The result of this filter would be the smaller sewers that meet the larger one. Note that you must include the attribute clause "where sewer_size <8" or the filter will find all feeders and identify the main sewer again. The clause "where sewer_size < 8" will eliminate the main sewer from the filter results. A single step that would yield the same results would be written as the following query filter.

Select Features in: sewer where sewer_size < 8 That: meet Features in: sewer where sewer_size >= 8

The second example has the advantage of requiring only one step. Approaching the problem in this way, however, does not create the "intermediate" query of big_sewer, which could be a negative if you wanted to have the main sewer on map output or for other uses. If you were planning on using the main sewer for other queries (e.g., to create maps or reports), it would probably be better to use a two-step process.

Identifying Smaller Area Units
Within Larger Area Units

A common query filter is to find all area units that fall totally inside a larger one and fill it, such as counties within states, Census blocks within tracts, and so on. In considering this filter structure, it would be reasonable for you to suspect that the proper spatial operator might be "Are entirely contained by," but this would not produce the desired results, as previously discussed. Instead, the "Contained by" operator will identify the proper counties, provided the boundaries of the counties and the boundaries of the state are geometrically identical.

Geometrically identical boundaries are usually the case when data are derived from the same source. However, if you are combining data from two different warehouses, the boundary of the larger area (e.g., the state) may not exactly correspond with the exterior boundaries of the smaller areas (e.g., the counties). If the smaller area extends even a fraction beyond the boundary of the larger, it will not be returned by the "Contains" or "Contained by" operators.

If there is not a perfect correspondence between boundaries, the proper operator to identify all constituent area units that make up a larger one is Overlap. The following query filter would yield just those counties that constitute Iowa but that might have a small portion extending beyond state lines.

Select Features from: counties That: overlap Features in: states where statename LIKE ‘IOWA’

The "Are contained by" operator is the correct one to use if the smaller features are a "proper subset" of the larger one. That is, if the boundaries of the smaller areas do not extend beyond the larger area’s boundaries, the collection of the smaller areas are a true subset.

If you have a data set where (because the data has come from different sources) the counties for the surrounding states extend slightly "under" the boundary of the state line, they will be identified as overlapping IOWA. This is another example of the effect of the potential lack of correspondence in geographic extents of data that have come from different sources.

In addition to the situation where boundaries that are supposed to correspond do not, there are many cases where there is not a perfect relationship between the boundaries of smaller units within larger ones. For example, market areas may cross city limits or zip codes areas will not correspond with Census block units. In these cases, the correct operator would also be Overlap.

Identifying Areas at a Specified Distance from a Location

Suppose you wanted to identify all parcels within 3 km of a school. There are two ways to perform the query: using the "Are within distance of" spatial operator or creating a buffer zone and using it. Deciding on which to use depends on the specifics of your problem.

If the problem is to identify those parcels that have some portion of their area within 3 km of the school, you can use a different approach than if the problem is to find all those parcels in which the complete parcel is within the 3-km limit. Restated, the two problems are

Find all parcels where any portion of the parcel is within 3 km of the school

or

Find all parcels where all of the parcel is within 3 km of the school

Both are reasonable questions, but they likely will yield different answers. If you are looking for parcels where any part of the parcel is within 3 km of the school, then you can use either the "Are within distance of" spatial operator or you can create a buffer zone and then use the "Are contained by" operator. Deciding which to use would depend on factors such as wanting to graphically display the 3-km zone or wanting to use the filter again. If that were the case, you would probably want to create a buffer zone first. In this workflow, the first step is to create a buffer zone around the school. This buffer zone might be called "area_within_3_km_of_school." The next step is to create the filter, such as the following.

Select Features in: parcels That: are contained by Features in: area_within_3_km_of_school

This would return parcels within the zone, as well as those that also happened to have part of their boundaries coincident with the buffer zone. If you wanted to ensure that the parcels not share any part of their boundary with the buffer zone, you would want to use the "Are entirely contained by" operator. The following spatial filter would identify all parcels that had any portion of their area within 3 km of the school.

Select Features in: parcels That: are within distance of 3 km from Features in: school

A similar result would be provided by the Overlap operator used with the 3-km buffer zone. The following spatial filter uses the Overlap operator to arrive at the same information.

Select Features in: parcels That: overlap Features in: area_within_3_km_of_school

Identifying Linear Segments
That Cross Linear or Area Features

A common problem facing many planners, engineers, and others is to identify those locations where one linear feature passes over or under another one or under an area feature. Some examples would be to identify those power line segments "above" a roadway or parcel, those telephone lines that cross a sewer that needs replacement, or the parcels through which a pipeline passes.

In these cases, one of the features does not connect in any way to the other. These features may occupy the same space but are not part of the same feature, unlike the case in which you wanted to identify those smaller pipeline features that connected to a main pipe.

Linear Segments

If the features in consideration are both linear and are not actually in contact with each other, the proper operator to identify where they cross is Overlap. The following filter string would return those sewer features that cross under the roadway.

Select Features in: sewer That: overlap Features in: road_way

Note that the process would return the complete geometries of the features that met the overlap operation’s conditions. If the sewer is digitized in a large number of small segments, the feature that will be returned will be only the small portion immediately under the road. If extensive parts of the sewer have been digitized as large, lengthy features, the entire sewer feature will be seen as satisfying the criterion, even if only a small part actually overlays the roadway.

Identifying Linear Segments That Cross Area Features

A similar situation exists when linear features pass over (or under) area features. However, in this situation there are more relationships that exist and more operators that come into play. For example, you may be interested in only the portions of a pipeline that fall within the limits of a parcel, or all parts of a pipeline that pass under a parcel but extend beyond it. If you are interested in identifying any portion of a pipeline (a segment) that passes anywhere under a parcel owned by John Smith, you would use the following query string.

Select Features in: pipeline That: overlap Features in: Parcels where owner_name LIKE ‘John Smith’

Using this filter, any pipeline segments that cross under any portion of the parcel will be returned. However, if the pipeline is outside the parcel but terminates on the boundary of the area, the pipeline segment will not be returned by the Overlap operator. It does not overlap the parcel. If the question, however, were to find all parcels that are crossed by a pipeline, the filter string would be the following.

Select Features in: parcels That: overlap Features in: pipeline

If a portion of the pipeline segment is within the parcel, the parcel will be returned. If the pipeline travels only along the border of the parcel, the parcel will be returned, but the pipeline would not be returned if the filter’s subject was pipeline. If the pipeline segment terminates on the parcel’s boundary, the parcel will not be returned. If you are interested in identifying the pipeline segments limited to being within a parcel, the operator to use would be either "Are contained by" or "Are entirely contained by," depending on your limits. The following filter would find pipeline segments that do not extend beyond the parcel’s boundaries.

Select Features in: pipeline That: are contained by Features in: Parcels where owner_name LIKE ‘John Smith

The following filter would identify only those parcels where the pipeline segments did not extend beyond the parcel’s boundaries.

Select Features in: parcels That: contain Features in: pipeline