Spatial Query instance
This paper takes the road, lake and administrative division layers in the Sample Data China. UDB Datasource as an example to query:
- Which lakes are included in Hunan Province;
- What are the highways passing through Hunan Province with the highway code of G320.
The specific operation steps are as follows:
- In the Current Workspace, open the Sample Data China. UDB Datasource.
- Create a new Map, and add the Provinces _ R, the Lake _ R, and the ProvinceRoad _ L to the new Map.
- In Map, select the administrative division surface of Hunan Province in the Provinces _ R layer, which is the search object of Spatial Query.
- Click the Spatial Query button in the Spatial Analysis tab > Query group to bring up the Spatial Query "dialog.
- In the searched layer list, set the Spatial Query Condition and Attribute Query Condition to be searched.
- In the Road _ L layer list, click the Spatial Query Condition "Drop-down Button, and set the Spatial Query operator to Intersection _ Planar Line, that is, query which highways pass through Hunan Province;
- In The Road _ L layer list, click the .. button in the Attribute Query Condition "column to pop up the SQL Expression dialog box. In the dialog box, set the road to be searched to meet the attribute condition: Road _ L. CODE = "G320".
- In the Lake _ R layer list, click the Spatial Query Condition "Drop-down Button, and set the Spatial Query operator to Include _ Faces _ Faces, that is, to query which lakes are included in the division range of Hunan Province.
- With the Road _ L and Lake _ R layers selected, place a check mark in the Browse in Attribute Table "and Highlight in Map" check boxes in the Show Results "area.
- Select the Road _ L layer, check the Save Results "check box, and set to save the Search Result of the Road _ L layer to the China. UDB Datasource. And rename the Resulting dataset name as: Hunan Province Highway _ G320.
In the same way, name the query Result Dataset of the Lake _ R layer as: Lake in Hunan Province.
- Click the Query button to execute the Spatial Query operation.
- In the property sheet and Map, browse Search Result at the same time. Select any record in the query Result Table, and the corresponding object will be automatically located in the Map to implement Associated Browse.
Figure: Browsing Spatial Query result