understanding water on the web
about us understanding data curricula resources
what's new at wow site map
Search Site
understanding gis
gis quick start primer

IMS Display

Query function
  Internet Map Server - The Query Function

The Query function in Internet Map Server provides a way to select map features based on a logical operation. For example, you can create a query to select all the polygons in a watershed whose land use is classified as agricultural. Running this query will do two things - it will highlight all the agricultural polygons on the map, and it will return a table containing all the records for those polygons.

A Query is made by creating a Query String, and then Executing it. Here is an example of a simple Query String:

       LANDUSE = "Agricultural"

Here is an example of a slightly more complicated Query String:

      LANDUSE = "Agricultural" AND AREA > 50.0

This query selects those polygons whose LANDUSE type is Agricultural AND whose AREA is greater than 50 hectares.

You can see that queries are based on the Boolean logic operators AND, OR, and NOT. The Booleans were a primitive tribe of programmers, who ultimately produced the SQL language, and promptly went extinct.

The Internet Map Server provides a number of tools for building and executing a query, as shown in the figures below. The three input fields allow the user to select the desired Field from the database, the Boolean operator, and a Sample Value. Once an expression is created, the Add to Query String button will place the completed expression in a window. Once an expression is in the window, the Execute button will run the query.

Two important items:

  • In order to query a particular data layer, that layer must be Active. To make a layer active, check the Acive radio button in the Layers menu on the right side of the screen.
  • While a query string can be typed in manually, it is better to pick the fields from the menus. This is because the query is sensitive to spelling - "Agriculture" will not work if the record in the database is called "Agricultural". The Get Samples button will retrieve the values from a particular field and make them available in the drop-down menu.

This screenshot shows a query that has been created and added to the query string, it is now ready to Execute

This image shows the results after executing a query. Note that the agricultural land uses are highlighted in yellow, and that the first few records are shown below the map.

Finally, it is common to extract data from a GIS and analyze it with another program, such as Excel. The Save Attributes to Text File link will place the selected records into a CSV (comma-separated value) text file, which can be saved to disk and imported into other programs.

The Query function is a powerful tool for retrieving information from maps; the fact that this can be done interactively over the Internet gives a remote user capabilities that were previously only available in a desktop GIS environment.


back to top
Water on the Web
about us  :  understanding  :  data  :  curricula  :  resources
what’s new  :  site search  :  site map  :  contact us

date last updated: Sunday March 07 2004