All posts by Ryan Davison

About Ryan Davison

Sr. GIS Administrator for Mesa County in western Colorado.

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

 

 

How to Query the Map by Location

The Mesa County web viewer’s Location 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 to query is our parcel layer so t we’ll use it for this tutorial. You can access this tool by clicking on the map’s query button   Query Button then clicking location query at the top of the Attribute Query dialog. Query Selector Location queries use drawing tools like these to select records: Drawing Tools

The names of the tools from left to right are: Point, Line, Polygon, Rectangle, Freehand Line and Freehand Polygon.

Simple Location Query

  1. Choose a layer to select from

Here is a list of the 22 layers that are currently exposed for querying: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. Select a drawing tool

 Click on one of the six drawing tools used to select records spatially on the map.

  1. Draw your query parameter

With a tool selected you will draw a point, line or polygon graphic on the map. If the graphic intersects the layer you chose, the intersecting records will be selected.

 Checking the box that says “Clear Previous Graphics” will clear the last query selection made each time you draw a new one. If this box is left unchecked, subsequent queries will compound adding your selections to each other.

As soon as you finish drawing your graphic, the query will run and the Query Results dialog will open.

Query Results Dialog

Location Query with Buffer

If you want to query layers within a given distance of your drawn graphic you can do so with the buffer option. Below are the steps to adding a buffer to your location query.

  1. Choose a layer to select from
  2. Click “Add Buffer to Query”

 Enter your buffering distance and choose a unit of measure. The default unit is feet.

Query Buffer

  1. Select a drawing tool

 Click on one of the six drawing tools used to select records spatially on the map

  1. Draw your query parameter

With a tool selected you will draw a point, line or polygon graphic on the map. If the graphic intersects the layer you chose, the intersecting records will be selected.

 Checking the box that says “Clear Previous Graphics” will clear the last query selection made. If this box is left unchecked, subsequent queries will compound adding your selections to each other.

Location Query Filtered with Attributes

In addition to the option to buffer your query graphic you can also limit the results of the query to ones with particular attributes. The attribute filter can be used by itself or with the buffer option.

  1. Choose a layer to select from
  1. Click “Filter by attributes”

Select an attribute field to filter on. Using the query operators (=, LIKE, OR, <…), build your SQL statement. See How to Query the Map by Attribute for more information.

  1. Select a drawing tool

 Click on one of the six drawing tools used to select records spatially on the map

  1. Draw your query parameter

With a tool selected you will draw a point, line or polygon graphic on the map. If the graphic intersects the layer you chose, the intersecting records will be selected.

 Checking the box that says “Clear Previous Graphics” will clear the last query selection made. If this box is left unchecked, subsequent queries will compound adding your selections to each other.

You can also query map layers using attributes only using the standalone Attribute Query tool.