How to Query the Map by Attribute

The Mesa County web viewer’s Attribute Query is a powerful tool for finding targeted records from the county’s GIS data. You can currently query on attributes from 22 different layers. The most common layer queried is our parcel data so that’s what we’ll use for this tutorial.

Access this tool by clicking on the map’s query button Query Button

Queries take the form of SQL statements with this syntax:

SELECT FROM [Layer] WHERE [attribute = <value>]

This is how it looks in the map’s query dialog:

 

Attribute Query Dialog

Steps

  1. Choose a layer to select from

There are currently 22 layers that we expose for querying. Here is a list of them:

    • Parcels
    • Property Sales
    • Plats/Subdivisions
    • Sections
    • Townships
    • Trails
    • Rural Future Land Use
    • Grand Junction Future Land Use
    • Deposit Surveys
    • Roads
    • Parks
    • National Park Service
    • BLM NCA/Wilderness
    • BLM
    • National Forest
    • State of Colorado
    • 2010 US Census Blocks
    • Enterprise Zones
    • Streams
    • Lakes
    • Water Wells
    • Soils
  1. Determine your query extent

Check the box that says “Select From Within the Map Extent ” to only search records from the current extent of the map. Leave this box unchecked if you want to search everywhere in the map.

  1. Choose an attribute

Attribute Fields

Attributes are the properties of the layer you have selected. In the example above we have chosen the account number field (ACCOUNTNO). You can choose any attribute field but you will have to have some idea of what the value of that attribute looks like.

You do not, however, have to know exactly what those values are as we will see later when discuss the SQL operators available to us. In this case, we know that Mesa County parcel account numbers start with a letter followed by six digits.

  1. SQL Operators

Operators form the logical connection between an attribute field and its value. These are the operators available to you:

SQL Operators

If you know the exact value of the attribute you are querying you can simply use the  =  operator like this:

ACCOUNTNO = ‘R063925’.

If you are unsure of the exact value but you know part of it you can use the Like operator which searches for partial numbers and strings. For example if you only knew the first five characters of an account number you would write the Where clause like this:

ACCOUNTNO Like %’R0639’%

When you click the Like button it populates the Where clause input box with Like ‘%value%’. The percent signs (%) on either side of the value are wildcard characters that tell the query to search for anything before and after the value you put in. You could have put in the last five characters of the account number and the query would have worked as well but you would have gotten some different results.

The operator buttons are only given as a convenience. You can also enter your operators directly into the Where input box.

  1. Formatting

Notice that field names have a data type after them in parentheses. This will help you format your query properly.

 In our ACCOUNTNO example we see that account numbers are stored as strings. Strings must be enclosed in quotation marks. If you wanted to query parcels based on their last sale price you would choose the SPRICE field which is a double. Doubles are numbers which cannot have quotation marks around them. This Where clause would look like this:

 SPRICE > 100000

The above statement would return all parcels with a sale price greater than $100,000. You will discover that when you select a field some of the operator buttons will become disabled or enabled based on the data type. Some operators can only be used on certain data types.

  1. Get Examples

After you have selected a field you can click the box that says Get Examples located under the operator buttons.  This will give random examples of field values to give you an idea of what the values look like ad how they are formatted.

  1. Run the Query

When you are satisfied with your query statement, click the Submit Query button. The query dialog will be replaced by the Query Results dialog.

 Attribute Query Results Dialog

 

Clicking on a result record reveals its data and zooms the map to the feature

Attribute Results