Query

You can use the Analysis | Query | Query command to view the boundary data that meets specified criteria. Queries can be performed on multiple objects across multiple layers. Queries require object data and/or object attribute(s), an operator, and an operand (condition). In the Add to query string group, you can select the object data, object attribute, operator, and an optional function. See the Advanced Tutorial - Lesson 3 for querying examples.

This query [Life Expectancy 1997] > 75, shows life expectancy greater than age 75

in 1997. The query action was to show only those countries that met the query

criteria. The outlines of the other countries are shown as a base map on a separate layer.

 

Query Dialog

The Query dialog allows you to build a string to query boundaries. The boundaries can be queried by data and/or attributes. Queries can be used to select, show, or apply properties to objects. A query can also be used to create worksheets, reports, layers, or points.

 

Build query strings, choose what action to perform with queried objects, and select regions or areas to query with the Query dialog

 

 

Add to Query String

In the Add to query string group, you can select the object data, object attribute, operator, and an optional function.

 

Query

The Query group contains options for displaying the query results.

 

You can choose to Select, Show, Apply properties to, Create worksheet with, Create report with, Create layer with, or Create point on the queried boundaries.

 

Select the type of object you wish to query with the Points, Polygons, Polylines, Rectangles, Rounded Rectangles, Squares, Ellipses, and Circles list. For example, if you want to show all counties with a POP 2010 of greater than 500,000, make sure Polygons box is selected. If you have a pin map, make sure Points is selected. Also, you can use this list to select objects of the specified type without building a query. For example, if your map contains polygons, points, and polylines, and you want to select all the points on the map, select Points, leave the Where field blank, and click the OK button to select all the points on the map. The Arrange | Select by Object command can be used for this purpose as well.

 

You can select which layers to query in the on list. Click on layers to select or deselect them.

 

You can further define the scope of your selection by choosing an option from the In list.

 

Where Box

The Where box contains the query. The conditions of the query are typed directly into the Where box. For example, if you want to show all counties with a POP 2000 of greater than 500,000 you can build the [POP 2000] > portion of the query in the Add to query string group, then you need to type 500000 into the Where box. You can use the * and ? wild card characters in the query.

 

Match Case

Check the Match case in string values box to make the query case-sensitive.

 

Query History

Queries are stored in the Query History dialog so that you may reuse queries. To access a previously written query, click the Query History button and select it from the Query History dialog. The last 15 queries are saved in the query history.

 

Saving and Loading Queries

If you plan to perform a query more than once, it may be useful to save the query for future use. To do this, create the query in the Query dialog and then click the Save Query button. This opens the Save As dialog. Saved queries are stored as Map Query [.MQE] files. To use a saved map query, click the Load Query button and select a Map Query [.MQE] file.

 

Clear Query

The contents of the Where box are retained in the dialog between MapViewer sessions. If you would like to delete the contents of this box, click the Clear Where Edit Box button, or highlight the contents of the Where box and press the DELETE button on your keyboard. Use the Save Query button to save a query you have created, and click the Load Query button to load a query a Map Query File [. MQE].

 

Performing the Query

Click the OK button to perform the query and close the Query dialog. Click the Close button to close the Query dialog without performing a query. Click the Apply button to perform the query without closing the Query dialog. The Apply button is useful when you need to perform multiple queries and do not need to return to the plot window. If you use Apply to perform all desired queries, you should click Close to close the Query dialog. Clicking OK will duplicate the most recent query.

 

Data

If you would like to see the data associated with selected objects, use Analysis | Make Report | Records Report | Boundary . Alternatively, you can use Create worksheet with.

 

Example

Open a new plot window and import ny2000.gsb. Load county data with the Home | Data | Load command, and select ny2000.dat in the Open Data File dialog.

To show all counties with a population greater than 500,000:

1.    If there are any queries in the Where box, click the Clear Where Edit Box button.

2.    Double-click on POP 2000 in the Variable list in the upper left corner of the dialog. [POP 2000] is added to the Where box.

3.    Double-click on the greater than sign (>) in the Operator list. > is added to the Where box after [POP 2000].

4.    Type 500000 into the Where box after the greater than sign. Note that you cannot include thousands separators (commas) in the number.

5.    Choose the type of action, Select, in the Query group.

6.    In the next box, highlight Polygons.

7.    Select in map from the In field.

8.    Click the OK button and the areas with population values greater than 500,000 are selected. The number of selected areas appears in the status bar.

The counties with a population greater than 500,000

are selected using the query described in the example.

 

 

See Also

Query within Range

Query Map Data

Boundary Records

Records in Regions

Analysis Tab Commands