7

Using Spatial Filters

One of the most common frustrations in working with geographic data is that you usually obtain a lot more raw data than you need. For example, if you want to investigate the demographics of a four county area, you will probably have to download all the data for the entire state. Or, if you want to do transportation planning for a single town, you will probably acquire a file that has all the roads in the region from which you have to laboriously extract the data you want.
 
 

Using Spatial Filters to Increase Workflow Efficiency

Efficiently managing large data sets is not a problem if you are using GeoMedia. GeoMedia has a feature called Spatial Filters, which allows you to access only the specific data you need from a warehouse. Spatial filters reduce the total extent of your data to a particular area of interest and eliminate the overhead associated with transferring and analyzing data that fall outside the specific study area.

Say your study area is one state or a few counties, and your workflow requires the type of information stored in the USSampleData warehouse included with GeoMedia. By applying a spatial filter to the warehouse, you restrict the number of features to those contained in or near the state or counties of interest. The data representing the rest of the United States is eliminated from your analysis.

Filters restrict what is brought into the map window, and therefore the features available for analysis. However, they have no affect on the data in the source warehouse.

2 NOTE: A spatial filter is an optional component of a warehouse connection. Spatial Filters

There are two types of filters in GeoMedia. There are filters associated with attribute queries. These are filters that allow you to query and select features based on the attribute values a particular column of a feature table. For example, find all water lines whose diameter is greater than two inches. There is no spatial component to this type of filter. Contrast that with a spatial filter. It specifies both a geographic area and the spatial relationship features must have to that area, regardless of nonspatial attributes.

What Is a Spatial Filter?

A spatial filter is like a cookie cutter or a mask. A spatial filter limits what appears in the map or data window to features that have a specific spatial relationship to a specific geographical area. A spatial filter consists of one of three spatial operators and a geographic area that is defined by either a fence, a single area geometry, or by the view extent of the map window.

A spatial filter is created interactively in the map window. It is named and stored in the GeoWorkspace. The same filter can be applied to one, none, or many warehouses or feature classes or to everything in the GeoWorkspace. Alternatively, unique filters can be applied to each warehouse or feature class. Filters can be added, removed, or swapped on any connection or feature class at any time during the workflow. Some filters only affect feature classes that are added to the legend or the data window after the filter is in place while others can be defined to immediately filter the contents of the GeoWorkspace. To create a spatial filter you first ide.gify a geographic area in the map window. You then select the spatial operator that produces the appropriate subset of your data.

Choosing a Geographic Area

There are three commands on the Warehouse menu that can be used to define a spatial filter. Each one provides you with a different way of ide.gifying the geographic area portion of the filter. The "Define Spatial Filter by Area" allows you to select an area feature from the map window. You use this option when you have a feature, such as a state or county boundary, which represents your study area. The "Define Spatial Filter by Fence"command allows you to define the geographic extent of the filter by placing a rectangular fence around the area of interest in the map window. "Apply Spatial Filter by View"uses the view extent of the active map window as the geographic limit for the filter. Filtering by area and fence differ only in the way the area is defined. Filtering by view is a special case. We will look at each of the filter types available after a discussion of the spatial operators.
 
 

Spatial Operators

The spatial operator component of the filter specifies the relationship that qualifying map objects will have to the geographic area. There are three spatial operators available for defining spatial filters. They are Overlap, Inside, and Coarse Overlap. These spatial filters perform much like spatial query operators. The key thing to remember is that the spatial filter reduces the amount of spatial data transferred from the warehouse to your local GeoMedia session. Using the spatial filter on a feature class is analogous to looking at a map through a piece of paper with a hole in it. The filter passes map elements visible in the hole into the active GeoMedia process from the warehouse. The hole might be a rectangle or might be based on existing geometry (such as a state boundary). The filter can pass anything that overlaps the hole or is inside it. In the overlap situation, if any part of a geometry is "visible" in the hole, it is passed. In the inside situation, only those geometries entirely within the hole are passed along.

The Coarse Overlap operator is available for Oracle and Access data servers only. See Chapter 36 for a complete discussion of Oracle Spatial.

The Overlap Operator

c hgm7_1.gif

Caption: Example of the Coarse Overlap operator.

A spatial object passes the Overlap operator if any part of the object touches, or if the object is inside, the selected geographic area or fence. This means that a feature that is entirely within the area, that shares one or more points along an edge with the area, that has part inside and part outside the area, or that is exactly the same as the area will pass through the Overlap filter. An example of the Overlap operator is shown in the first illustration at left.

The Inside Operator

When the Inside operator is used, only map objects that fall entirely within the area geometry are selected. They cannot share line work with the bounding geometry. For example, a county that is inside a state but shares a boundary with the state is not "inside" the state as far as the Inside spatial operator is concerned. An example of the Inside operator is shown in the second illustration at left.
 
 

The Coarse Overlap Operator

The Coarse Overlap spatial operator is only available for Oracle and Access data servers. If you choose this spatial operator with any other data server, Define Spatial Filter reverts to the Overlapspatial operator.

The purpose of the Course Overlap operator is to allow the data server to quickly and efficiently return data according to its internal spatial indexing system, without doing individual geometry comparisons against the boundaries of the spatial filter. This lets you access all data inside or overlapping the boundaries of your filter, but it may also return some additional features. Although excess features are returned, the results are usually returned more quickly.
 
 

Access and Oracle have different indexing systems, so the spatial filtering results may vary drastically. The Oracle data server employs a quadtree algorithm for its spatial indexing. The software compares the extent of the spatial filter area to the appropriate quad tiles and only retrieves those geometries that fall within them. This can dramatically reduce the number of records transferred from the Oracle warehouse to the GeoMedia session. Quadtree indexing is discussed in more detail in Chapter 36.
 
 

The Access data server also employs a quadtree algorithm for its spatial indexing. When applying a spatial filter with the Coarse Overlap operator to data in an Access warehouse, the results returned include all features overlapping the spatial filter boundary, and any features that lie on certain quadtree boundaries. This often includes strips of features that are at some distance from the spatial filter boundary, particularly for linear and

areal features. The graphic, shown below, illustrates this point. These maps display the States and Counties features returned from the USSampleData warehouse, an Access database using the Coarse Overlap spatial operator. The geographic area selected is the boundary of the state of North Carolina. The States features that passed the filter are those shown with crosshatch fill on the left. Notice that this filter only removed 11 states. (If you’re counting, Rhode Island was filtered out, but you can’t really see that in the graphic.) The filtered counties, on the right, are equally impressive and illustrate the point that strips of areal data may pass filters that rely on quadtree indexing rather than geometry comparison. Moral to this story is that if you use the Coarse Overlay operator for performance reasons, you will probably need to apply an attribute query to further filter the data to improve its accuracy.

graphic hgm7_7.gif

Caption: Features returned by the Coarse Overlap operator.

Applying Various Filter Combinations

The following section is intended to give you a feel for the results of applying filters created from the combination of the fences and area geometries with the Inside, Overlaps, and Coarse Overlaps spatial operators. Assume that the counties in Missouri are the features required in your workflow.

Note: When creating spatial filters your primary concern should be insuring that features required for your analysis are not inadvertently excluded.

Overlapping a Fence

The illustration at left shows the result of combining the Overlap operator with a fence. This fence, the dark-dashed rectangle, reduced the number of counties transferred out of the warehouse from 3,111 to 261. If you opened up the data view, you would see 261 records, and only the attribute and geographic data from these 261 records would be available for mapping, analysis, and reporting purposes (as long as this specific filter is in place).

Suppose, however, you wanted to restrict your analysis to the counties in the state of Missouri (the rectangular fence filter is letting in counties from the surrounding states). The counties that fall within the spatial filter can now be effectively eliminated from your analyses by applying an attribute filter in a query that selects counties based on an attribute value, such as state name or FIPS code. A query will not have to search all 3,111 records to find the Missouri counties, but will only have to process the 261 previously selected via this spatial filter.

Note that applying the Overlap operator results in feature classes of varying areal extent. For example, overlapping a state boundary allows a filter to return the entire state feature even when the filter and the feature barely overlap. However applying the same filter to a point feature class, say cities, produces an areal extent that is much closer to that defined by the fence or area. So that although a large polygon feature might pass the filter, point data would only extend as far as those points that touch the fence.

Overlapping an Area

The filter shown in the illustration at left depicts the difference in selected features when an area is overlapped. Using the geometry of the state boundary as the filter reduces the number of qualifying county features to 170. Note that all counties "inside" the state boundary are passed through the filter, as well as all counties from surrounding states that share Missouri’s boundary. They also meet the Overlap operator specification.

Inside a Fence

The illustration at left shows the result of using the Inside operator with a fence. Notice that only features entirely within the fence have been selected. This particular filter produces a total of 183 qualifying features.

Inside an Area

The counties shown in the illustration at left result from the use of the Inside operator with a map object, or area, filter. As is evident, the counties in Missouri on the outer edge that share a boundary of the state are not passed through the Inside filter. This is an example of how it is possible to exclude features you might need in your workflow. If you need to conduct an analysis on just those geographic objects "inside" another, you should probably use the overlap filter, and then use an attribute query to specifically ide.gify the area of interest.

Coarse Overlapping a Fence

 graphic hgm7_8.gif

Caption: Coarse Overlapping a fence.

The illustration at the left shows the results of applying the Coarse Overlap operator with a fence. The trade off in this situation is accuracy for speed. This filter has returned a total of 1201 county features based on the database indexing rather than on a comparison of geometry. The extra features returned from index boundaries are apparent.

Coarse Overlapping an Area

graphic hgm7_9.gif

Caption: Coarse Overlapping an area.

When the state boundary area feature is used in conjunction with the Coarse Overlap operator 894 County features are returned. Again accuracy is sacrificed for speed. The strips of features lying on the quadtree boundaries are extraneous. They would have to be eliminated with an attribute query that selected the Missouri counties from the feature class before you proceed with analysis.
 
 

Creating Spatial Filters

In this section you will see how to create spatial filters. Filters are built interactively in the map window by either placing a fence or selecting an area feature. A third kind of filter is created from the map window itself. You can define a spatial filter almost any time, however it’s much easier when you can see at least a map outline. Therefore, you need to have a warehouse connection set up and have at least one of your feature classes added to the legend before you begin. Filters are created with one of three commands "Define Spatial Filter by Area", "Define Spatial Filter by Fence", and "Apply Spatial Filter by View on the Warehouse menu on the Main Menu bar. These dialogs can also be accessed from the Spatial Filters toolbar, shown below, that is delivered with GeoMedia.

graphic hgm7_10.gif

Caption: The Spatial Filters toolbar.
 
 

Filtering by Area or Fence

Before defining a spatial filter you should add a feature class to the map window for reference purposes. Both the "Define Spatial Filter by Area" and "Define Spatial Filter by Fence" menu selections immediately switch you to the active map window where you interactively define the geographic extent of the filter. If you are creating a filter by area, the feature class containing the area geometry should be displayed. The feature class must be locatable. Prompts appear on the Status bar of the application window instructing you to select an existing area feature with a single mouse click. The selected geometry will display in the Highlight color defined on the Map Display tab of the Tools > Options dialog. If you select the wrong feature, click on the Cancel button on the New Spatial Filter dialog and start again.

2 NOTE: When your graphics are dense (very close together), more than one map object may fall into the locate zone of the select tool (the Northwest arrow cursor). When this happens, it initiates a PickQuick dialog that allows you to ide.gify the feature you want to select. See Chapter 15 for a discussion of using Select Sets and PickQuick.
 
You’ll likewise want a feature class displayed for navigation if you intend to define a filter by fence. A fence is simply a rectangle you "draw" in the map window using the cursor. You place the first point by clicking the mouse button at one of the corners of the desired box. With the left mouse button still depressed, drag the cursor to the diagonally opposite corner of the rectangle you want to serve as the filter area. If the fence does not fall exactly where you want it, simply click on the Cancel button on the New Spatial Filter dialog and start over.

You draw a rectangular fence by placing data points at the two opposing corners of the geographic area you want to filter.
 
 

After the fence is placed or an area feature is selected the New Spatial Filter dialog, shown below, will appear.

Ngraphic hgm7_2.gif

Caption: The New Spatial Filter dialog.

The dialog allows you to give the filter a name. If your workflow requires multiple filters, it is recommended that you use this feature and assign meaningful names to the filters. Filter names will otherwise default to SpatialFilter1, SpatialFilter2, and so on.

In the "Spatial operator" portion of the dialog you select from the spatial operators Overlap, Inside, or Coarse Overlap. These operators define the relationship that features must have with the geographic area in order to be selected by the filter. When an operator is selected, a brief description is provided below the radio buttons. The spatial operators were discussed in detail previously.

The final two selections in the New Spatial Filter dialog; "Apply to GeoWorkspace" and "Set as default filter for existing connections" control how, when, and to what the filter is applied. You may choose one, both, or neither of the options.

Warning: You’ve got to be careful when using multiple filters in the course of a workflow. Always insure that the feature class you are working with has the filter you expect. This is especially true if you’re not looking at the features in the map window. Results of spatial or attribute queries may be completely incorrect or at least not what you expected.
 
 

Applying a Filter to a GeoWorkspace

When only "Apply to GeoWorkspace" is checked, the filter is automatically applied to all feature classes that have ever been added to the legend or displayed in a data window in the GeoWorkspace. Features that have never been displayed in the workspace are not filtered by this option. When a new Area or Fence filter is defined and applied to the GeoWorkspace, all feature classes and queries that have been displayed at any time in a map or data window will be refiltered. If they are currently displayed in either type window, the displays are refreshed with the results of the new filter. This type filter can be overridden by using the Warehouse > Spatial Filters dialog, discussed below, to apply a different filter to a feature class.

The following illustrations demonstrate the results of applying an Area or Fence filter to a GeoWorkspace. We start with a new workspace and one connection to the USSampleData warehouse. We add the States, Counties, Interstates, and HighwayInterchanges feature classes to the map window. The map window is shown in the first illustration below.

graphic hgm7_3.gif

Caption: Step 1. Preparing to apply a Filter by Fence to a GeoWorkspace.

We’ll then delete Counties and Interstates from the legend and define a filter by fence. We’ll select the area around the Great Lakes and the Overlap operator. Then we select the "Apply to GeoWorkspace" option only.

 graphic hgm7_4.gif

Caption: Step 2. Placing a filter fence.

When the filter is applied the States and Interchange feature classes are reduced to only the features that intersect or are inside the fence. Now let’s add some more feature classes to the legend. We’ll add the Counties and Interstates to illustrate that even though they were not displayed in the map window when the filter was applied that they too have in fact been filtered. The only feature classes that are unaffected by the filter are those that have never been accessed during the workflow.

 graphic hgm7_5.gif

Caption: The results of applying a filter to a GeoWorkspace.

Tip: You can verify which feature classes will be filtered by looking at the Warehouse > Spatial Filters dialog. Select any filter name listed and click on Apply. When you expand the tree listing in the "Available features" window of the Apply Spatial Filter dialog box, you will see a list of all the feature classes that the Spatial Filters commands know about. This list, shown below, will contain the names of all the feature classes that have ever been added to the legend, displayed in a data window, or queried, whether they are currently being displayed or not. These are the feature classes that will be processed when a filter is applied to the workspace. After reviewing the list you can simply Cancel to dismiss the dialog without taking any action. Managing spatial filters is discussed below.

graphic hgm7_6.gif

Caption: Reviewing the feature classes that will be processed when a filter is applied to a workspace.

Using a Filter as the Default for Existing Connections

The final selection on the New Spatial Filter dialog is "Set as default filter for existing connections". When this option is selected the filter you are defining will be used for all feature classes in existing the first time they are added to a map or data window. In other words this option has no effect on current displays and does not automatically filter features that have been used for displays in the past.

A filter that is defined as the default will appear in the

"Default spatial filter name" column of the Warehouse > Edit Connection dialog. This dialog, discussed in Chapter 5, can be used to remove or change default filters on warehouse connections. As in the "New Spatial Filter" dialog, the filter selected here only affects feature classes that are being added to the workflow for the very first time.

Combining the Filter Options

When you require a single filter for all the features in all your warehouse connections selecting both the filter options is the way to insure that everything is properly filtered. When you do, all features that are in use in map and data windows are automatically filtered by the fence or area you designate and the displays are updated. Features that have not previously been used in the workflow are processed when they are accessed, since the filter is set as the connection default. All queries are updated with the new subset of the feature classes defined by the filter.

Applying No Filter Option

When "Apply to GeoWorkspace" and "Set as default filter for existing connections" are left unchecked you can create spatial filters without applying them to your data. This feature is useful for workflows that require multiple filters. Say, for example, your workflow involves analysis of school locations within census tracts. You could set up all the tract area features as spatial filters first and apply them with the Warehouse > Spatial Filters dialog as the workflow progresses. Managing spatial filters is discussed later in this chapter.

Spatial Filters and Vicinity Connections

A vicinity connection is a connection to a warehouse that contains feature classes you want to use for creating locator maps. A vicinity warehouse typically contains enough sparse data to provide an overview display of features. It helps you navigate and orient yourself in your data. The display of the features in the Vicinity connection is often used when placing spatial filters. If one of your connections has been designated as the vicinity connection on the General tab of the Options dialog, the features in that connection are excluded from all the spatial filter dialogs and are never spatially filtered, regardless of the filter options you apply. Vicinity connections are discussed in Chapter 5.

Workflow 7-1
Defining a Spatial Filter by Area

A spatial filter is used to reduce the amount of data available for analysis and for display in the map and data windows. Spatial filters are not required but are useful when you need to focus analysis only on a specific portion of a large dataset.

Applying a spatial filter restricts features in the GeoWorkspace to a subset of the data defined by one of three placement methods. A filter can be set up with a fence, by selecting one "unit" of contiguous geometry, or it can be constrained to the active map window view. The geographic definition of the filter is refined by the application of a spatial operator. Using the Inside operator, a filter can be set up to include only the map objects that fall entirely within the filter. Features that cross the filter boundaries are included in the workspace when the Overlaps operator is activated.

A filter affects only the workspace and makes no changes to information in the Warehouse. Spatial filters are named and stored in the GeoWorkspace. A spatial filter defined for any given warehouse can be applied to new warehouse connections as they are added and to feature classes in existing connections, excluding features in a vecinity connection. Changing spatial filters as you work allows you to display subsets of your warehouse data in terms of discontiguous geometries. Filters can be removed or replaced with other filters at any time.

In this exercise you will define and apply filters based on Census-tract-boundary area features. You need to establish a warehouse connection to your census warehouse and add one of the tract feature classes to the map window.

    1. Start the "New Spatial Filter" dialog. On the Main Menu bar, click on Warehouse > Define Spatial Filter by Area.

    2.  

       

      The map window must be active, and the feature class to be used for filter definition must be added to the legend.

    3. Select contiguous geometry for the geographic area filter. You are immediately transferred to the active map window. Prompts appear on the Status bar of the application window telling you to ide.gify the feature to be used as the geographic area. Click on any tract to select it as your filter.

    4.  

       

      The Select Tool functions as usual, highlighting each map object it passes over. In a case in which multiple map objects fall into the Locate Zone, the PickQuick selection box will appear. See Chapter 15 for more information on using PickQuick.

      You can click on the Select Tool (the Northwest arrow) on the Selection toolbar to cancel the Define Filter operation.

    5. Name the spatial filter. The "New Spatial Filter" dialog, shown below, opens. Type Inside Tract 1 in the "Filter name" box.

    6.  

       

      By default, GeoMedia will name your filters SpatialFilter1, SpatialFilter2, and so on.

       graphic hgm7_11.gif
       
       

      3. Select a spatial operator. Click on the Inside radio button.

      4. Do not apply the filter to features in the workspace. Make sure that the "Apply to GeoWorkspace" checkbox is deselected.

      This option insures that all features accessed so far in your workflow will be filtered. In this case, filtering the tract feature class by a tract boundary would effectively ‘remove’ the tract features from the workflow. This is due to the fact that the Inside operator is defined as entirely inside.

    7. Define the new filter as the default for existing connections. Make sure that the "Set as default filter for existing connections" checkbox is selected. Click OK to dismiss the dialog.

    8.  

       

      Setting the new filter as the default insures that as feature classes from this connection are accessed, they will be filtered.

    9. Add a filtered feature class to the map window. From the Legend > Add Feature Class dialog select blocks_stf1bx.
7. Confirm that the new filter is now the default spatial filter for this connection. On the Main Menu bar, click on Warehouse > Edit Connection, or click on the Edit Warehouse icon, shown in the illustration at left. You see that the new filter is listed as the default filter for this connection. It can be removed from the connection in this dialog by clicking on the blank field under the "Default spatial filter" column heading. The drop-down arrow will appear. Click on the arrow to access the list of spatial filters available. Click on Inside Tract 1 to activate the filter. Click on Close.

The scroll arrows on this drop-down are small, but they are there. Scrolling down will reveal a blank entry at the end of the list. This entry is used to remove a spatial filter from the connection. Spatial filters are managed with the Warehouse > Spatial Filters dialog discussed later in this chapter. The Warehouse Connections dialog is shown in the following illustration.

graphic hgm7_12.gif
 
 

The Edit Connection dialog.

2 NOTE: All feature classes added to the legend from this connection will be restricted to those that fall within this spatial filter’s limits until the filter is removed or replaced. This applies to attribute data as well as geometry.
    1. Add a new warehouse connection using a spatial filter. Select Warehouse > New Connection. Set up the connection type and select the tgr05143 warehouse. Instead of defaulting to all features, select "Apply a spatial filter to your warehouse" and click on the filter name in the drop-down. The Warehouse Connection wizard is shown in the following illustration.

    2.  

       

       hgm7_13.tif
       

      11. Add a filtered feature class to the legend. Add one of the tiger features to the display, as indicated in the illustration that follows.
       
       

    3. Remove a default spatial filter. Click on Warehouse > Edit Connection. Click on the spatial filter name for the Tiger connection. Scroll through the spatial list. Click on the blank entry at the end of the list.
In the following workflow exercise, you will set up a spatial filter by fence.
 
 
 
 
Workflow 7-2
Setting Up a Spatial Filter by Fence

In this exercise you will define a filter based on a rectangular fence. You need to establish a warehouse connection to your tgr05143 warehouse and add the tiger_road feature class to the legend.

1. Define a spatial filter by fence. On the Main Menu bar, click on Warehouse > Define Spatial Filter by Fence. You are returned to the map window, with a crosshair cursor displayed. To place a fence, click and hold on the first corner of the rectangle. While keeping the left mouse button depressed, move the cursor to the opposite corner of the fence and release the mouse button. As soon as you place the fence you the New Spatial Filter dialog opens. Select any small portion of the road layer. If you don’t like the selection, click Cancel on the dialog box when it appears. The fence will display as a dashed line using the highlight color set in the Tools > Options dialog. See Chapter 10 for more information about customizing your working environment. The fence placed in the map window is shown in the following illustration.
 
 
    1. Type Tiger Fence Filter in the "Filter name" field.
Because filters are saved in the GeoWorkspace and reused, it is highly recommended that you give all your filters meaningful names. 3. Select a spatial operator. Click on the Overlap button. Examples of the operators are displayed next to each option.
 
  4. Apply the filter to features in the workspace. Make sure that the "Apply to GeoWorkspace" checkbox is selected. This option insures that all features accessed so far in your workflow will be filtered, with the exception of features in a vicinity connection. In this case, the tiger_roads feature class will be filtered as soon as the dialod is completed.
    1. Define the new filter as the default for existing connections. Make sure that the "Set as default filter for existing connections" checkbox is selected. Click OK to dismiss the dialog.

    2.  

       

      Setting the new filter as the default insures that as feature classes from this connection are accessed, they will be filtered.
       
       

    3. Add a filtered feature class to the map window. On the Main Menu bar, click on Legend > Add Feature Class. Select tiger_hydrographic. The following illustration shows filtered roads and hydrographic features.
 graphic hgm7_14.gif ig190018
 
 
 
 

Filtering by View

Applying a spatial filter by View is slightly different that the Fence and Area commands. There is no dialog associated with this command. This option creates a filter from the map window using the geographic area displayed. You can think of the boundary of the map window as the fence this filter will use. Therefore the window must be contain the area of interest before you select the Warehouse > Define Spatial Filter by View menu option. Much of the View filter is predefined. The filter is named ViewFilter and its spatial operator is Overlaps. There can be only one View filter in a workspace. The View filter is automatically applied to all existing feature classes and queries in the GeoWorkspace. The View filter is assigned as the default spatial filter for existing connections. To see the result of a View filter, you use the "Fit All" command to change the map display. You will see that your feature classes have been cropped to fit the view extent of the map window.
 
 

Workflow 7-3
Creating a Spatial Filter by View

The View filter is similar to a Fence filter, except that instead of placing a fence in the map window you use the map window itself as the fence. For this exercise you have nationwide data sets of rail nodes and intermodal terminal nodes, but you want to focus on those on the Gulf coast. Create a new GeoWorkspace and connect to the BTSTransportationNodes and to the USSampleData warehouses. Add the States feature class to the legend.

  1. Set up the map window view extents. Using the Zoom and Pan tools position the States feature class so that only the Gulf coast states can be seen. A sample map window is shown in the illustration below.

  2.  

     

     graphic hgm7_15.gif

    Caption: Using the map window to set view filter extents.

    Since the boundary of the map window will be the ‘fence’ for the View filter, it must contain the features you are interested in. Since the View filter uses the Overlaps spatial operator you should insure that only the states of interest are visible. Make sure that you don’t accidentally include part of Georgia or Arkansas.

  3. Create a View filter. On the Main Menu bar click Warehouse > Apply Spatial Filter by View. Since all the parameters of the View filter are predefined, no dialog box appears. In fact, it appears that nothing happened.

  4.  

     

    The "Apply Spatial Filter by View" command automatically names the filter ViewFilter and uses the Overlaps operator. It applies the filter to the workspace and sets it as the default filter on existing connections.

  5. Inspect the results of applying the ViewFilter. Click on View > Fit All or on the Fit All toolbar button.
  6. Add a feature class to the map window. Using Legend > Add Feature Class, add rail2m_Node and terminal_Point.

  7.  

     

    The features that pass this filter are shown in the illustration below. Note that the point data is more areally restricted than the polygon data. This may or may not be the result you want. Remember, you can subtract unwanted features with an attribute query, but you cannot add necessary features that were inadvertently excluded unless you remove the filter. Managing filters is discussed in the final section of this chapter.

    graphic hgm7_16.gif

    Caption: The results of applying the ViewFilter.

  8. Verify that the ViewFilter has been set up as the default filter on your warehouse connections. On the Main Menu bar click Warehouse > Edit Connection. This dialog, shown below, can be used to remove or change the default spatial filter for existing connections. The default filter does not affect new connections unless it is explicitly selected in the New Connection Wizard.
 graphic hgm7_17.gif

Caption: The Warehouse Connections dialog showing the default spatial filter name.
 
 

Working with Spatial Filters

The tools that you need to manage your spatial filters are found in the Warehouse > Spatial Filters dialog, shown below. The dialog contains a list of all the filters that have been created in the workspace. It contains an additional entry, <None>, which is used to remove filters, restoring feature classes to their complete extent. The command allows you to display filters in the map window and to view the spatial operator associated with each filter. With this command you can delete filters, remove filters from feature classes, and reapply existing filters.

Note: The Warehouse > Spatial Filters dialog is only available when a map window is active.

Spatial Filter Properties

You can review filters in two ways. When you need to know where a filter is simply select the filter name in the "Spatial filters" window. You are provided with a display of the filter boundary in the map window. The filter is shown in the highlight color you selected in the Tools > Options > Map Display. The display persists as long as the filter name remains selected and is cleared when any other command is selected or when the dialog is dismissed. While this may seem trivial, it is the only way to find out which filter is associated with a feature class. The second tool for reviewing filters is the Properties button. This command provides you with a read-only display that indicates the spatial operator employed by the filter.

Deleting Spatial Filters

Filters are removed from the GeoWorkspace by selecting the filter name and clicking the Delete button on the Spatial Filters dialog. Although the Delete command removes the filter from your workspace, it has no affect on existing data. Feature classes and queries in the workspace remain filtered until the filter is explicitly removed by applying the <None> filter to them.

If the selected filter was originally defined as the default filter for existing connections in the New Spatial Filter dialog, it is automatically removed from those connections when it is deleted.

Manipulating Spatial Filters

The Apply button is used to change the filter on one or more feature classes or queries. Applying the <None> filter effectively removes an existing filter and restores the feature class to its original extent. When you select a filter name and click Apply you are presented with a tree listing of all the connections, feature classes, and queries that have been used in the workspace. The "Available Features" window, shown below, does not contain all the feature classes in your warehouse connections, nor will it contain any features in a vicinity connection.

 graphic hgm7_19.gif

Caption: Features available for filtering.

It lists only the feature classes and queries currently displayed in the map and data windows, and all that have been accessed and subsequently removed. Therefore, in order for a feature class to be available in this dialog, it must have been used at some point in the workflow. Move the connection, feature class, or query name from the "Available features" list to the "Selected features" window using the ">" for single items or ">>" to select all available entries. The "<" and "<<" are used to deselect entries.

The selected filter is applied to the selected classes and queries and map and data window displays are appropriately updated. Adding, changing, or removing a filter from a feature class does not cause an automatic update to existing queries based on the class. Queries must be explicitly refiltered if you want them to stay in synch with their parent feature classes. This feature does allow you to mix filters within a workflow. You can apply one filter to a feature class, and a different filter to each query based on that class, providing you with a variety of different views into your data.
 
 

Workflow 7-4
Managing Spatial Filters

In this exercise you will use spatial filters to develop base map of selected regional features for a transportation analysis workflow. You have been provided with a GeoWorkspace that contains connections to the BTSTransportationNodes and the USSampleData warehouses. The ViewFilter created in the previous exercise filters both feature classes. The workspace contains several different filters and some queries. Open the ManagingFilters.gws workspace. The workspace is shown in the following illustration.

graphic hgm7_20.gif

Caption: The ManagingFilters workspace.
 
 
 
 

  1. Review the location of the existing filter. On the Main Menu bar click on Warehouse > Spatial Filter. Select ViewFilter from the Spatial Filters list. The filter will be displayed in the map window in the Options highlight color. You may have to drag the dialog box out of the way to see the fence.
  2. Find out which spatial operator the filter used. With ViewFilter selected click on the Properties button to review a read-only display of the operator used by this filter.
  3. Restore a feature class to its complete extent. You want to be able to view the entire continental U.S. so you need to remove the filter from the feature class. Select the filter <None> from the list and click Apply. Expand the listings, click on States in the US connection, and click the ">" right arrow. Click OK.

  4.  

     

    graphic hgm7_21.gif

    Caption: The Apply Spatial Filter dialog.

  5. Add a query to the map window. Add the Oil Facilities query to the map using Legend > Add Query.
  6. Apply a filter to a query. Run Warehouse > Spatial Filters. Select MississippiValley and click Apply. From the Queries tree select Oil Facilities. Click OK.
  7. Restore a query to its complete coverage. Click on Warehouse > Spatial Filter. Select <None> and click the Apply button. Expand the Queries listing and select Grain Elevators. Click OK.
graphic hgm7_22.gif

Caption: The Terminal base map.

You now have a base map that contains terminal nodes on the Gulf coast, all the grain elevators in the country, and oil facilities in the central portion of the country.
 
 

Optimizing Spatial Queries

As previously mentioned, filters reduce the amount of data that has to be processed and therefore improve the performance of spatial queries. It is recommended that you define spatial filters and apply them to the connections where spatial queries are to be performed. Spatial filters reduce the amount of processing for all features to only those that fall within the defined filter’s geographic extent. When large numbers of features are involved, using a spatial filter can dramatically increase the speed at which you can perform queries, create maps, and otherwise process warehouse data.

For spatial queries in which you are locating subject features within a certain distance of the criteria features, you may get better performance by first creating a merged buffer zone around the subject features, then defining the buffer zone as map object spatial filter. Applying this type of spatial filter will reduce the processing time for SQL queries.
 
 

Applying Default Spatial Filters
in the Connection Wizard

The Warehouse Connection Wizard, shown in the following illustration, gives you an opportunity to apply an existing spatial filter when you create a new connection. This saves you the steps involved in editing the connection to add a filter or applying the filter in the Warehouse > Spatial Filters dialog.
 

Importing with Spatial Filters

Be aware that spatial filters affect how feature classes are added to a warehouse. When you import features, the filter on the source warehouse is honored. Only the features that qualify to pass the filter are imported to the target warehouse. This can be a useful tool when you want to create small data sources from your large warehouses. On the other hand, it can yield unexpected results if you unintentionally import filtered classes.