Today's Surfer 13 new feature series article discusses querying attributes of objects in base map layers. Below is a republishing of Sabrina Pearson's recent newsletter article (Issue 79, published July 2015) about querying attributes in Surfer 13.
In the previous article, we covered an important component of base maps, attributes, and how they can be easily accessed and edited. This article will dive into the details of querying map objects based on those attributes, object type, or object properties. This useful query tool allows you to quickly drill down into the details of your map and effortlessly access all of your map properties.
To demonstrate the querying abilities, Weld county Colorado drilling permit data has been downloaded from http://cogcc.state.co.us/COGIS/drillingpermits.asp. Although the well names are real, well locations have been moved. The well information, Weld county outline, and township-range areas have been combined into a single GSI file that's available for download should you wish to follow along in Surfer 13. Each object in the file includes attribute information. Since all of the data is in a single GSI file, a base map can be created by clicking the Map | New | Base Map command in Surfer 13, selecting the GSI file and clicking Open.
The initial map is created, displaying all of the information from the GSI file.
Now that we know what attributes are in the base map layer, we can use the Map | Query Objects command to select objects by object type, by attributes, or by object properties. If you've previously opened it with the Map | Open Attribute Table command, the Attribute Table can remain open during the query process. This makes it easier to get the values of attributes to enter into the Query dialog.
The query command works on individual objects within a single base layer, similar to the geoprocessing commands. To activate the Query Objects command,
- Click on the base layer in the Object Manager to select it.
- Click the Arrange | Edit Group command. Once you are inside the group, you will see a visual indicator that you are in edit group mode:
The Editing group text will appear in the top left corner of the
plot window until Arrange | Stop Editing Group is clicked.
- Once you are in the Editing group mode, click the Map | Query Objects command. The command is not available unless the Arrange | Edit Group command has been clicked.
Selecting objects by type
One common use-case for querying objects is to select all of the objects of a certain type. For instance, we might want to select all of the symbols in the base map layer. To do this,
- Set the Select objects of type to the desired type (Point) by checking the box to the left of the name.
- Leave the where all of the following conditions are met section empty. The dialog should look like:
Set the Select objects of type to a single type and leave the conditions
empty to select all of the objects in the base layer of this type.
Once you click OK, all of the points in the base layer are selected. You can then change the symbol properties in the Property Manager. You can also click the Arrange | Order Objects | Move to Front command to move all of the selected objects to the top of the base map layer. This would ensure that no polygon fill will cover the points.
After selecting all of the symbols, the symbol properties were changed
to show smaller filled circles instead of the larger crosses.
Selecting objects by attribute
Another common use-case for using a query is to select all of the objects that meet a certain criteria, as set by an attribute. The wells file that was downloaded from the Colorado website contains multiple target objectives. If we want to have the points be different colors based on the objective, we can use the query again.
- Click the Map | Query Objects command.
- Notice that the previous query is still present. So, Point is still selected in the Select objects of type. This makes it easy to quickly limit selections with multiple queries.
- In the where all of the following conditions are met section, click on the first --None-- text. A list appears that contains all of the object properties and attributes. From the list, select [Objective_]. This is the attribute that contains the formation name.
- Click on the = sign next to [Objective_]. A list appears showing various comparison options. These include =, !=, <, <=, >, >=. The != indicates is not equal to. So, the options are equals, not equals, less than, less than or equal to, greater than, and greater than or equal to. Select equals (=).
- In the empty box to the right, type the formation information: Niobrara.
- Note that the condition is automatically added to the Query text.
- Even though we typed Niobrara, the attribute values in the base layer are actually in all caps. If we check the Case sensitive compares box, nothing will be selected. So, be sure either the case matches exactly as the text appears in the Attribute Table or this option is not checked.
- Since we want to limit the previous selection, change the Operation at the bottom of the dialog to Select from current selection. Only the objects that match the new query string (and the current selection) will be selected. The dialog should look like:
The Query dialog allows objects to be selected by a single condition or by meeting multiple conditions.
- Click OK.
Once you click OK, all of the proposed wells in the Niobrara objective are selected. You can then change the properties of all of these objects at once in the Property Manager. For instance, you can change the symbol shape and color.
After selecting the Niobrara wells, the symbol shape and color were changed.
Selecting with wildcards
We could further select only the wells in the Niobrara target that were permitted by the Barrett corporation. To do this, the condition option would be changed to [Operator_N]. Because Barrett could be in the base map file in multiple ways, we can use a wildcard to select them all.
- Click the Map | Query Objects command.
- Notice that the previous query is still present.
- In the where all of the following conditions are met section, click on the first --None-- text. Select [Operator_N] from the list. This is the company name that requested the drilling permit.
- Set the text equal to Barrett*. The dialog should look like:
The wildcard * or ? can be used as a replacement for characters in the conditions field.
- Click OK and only the Barrett wells are selected.
The query result includes wells that have the company name Barrett, Barrett Oil, Barrett Corporation, Barrett Corporation* Bill, and any other options. The object properties can be edited in the Property Manager or the objects can be deleted from the map, if desired. In the image below, the Barrett* points have been changed to a different symbol shape and color.
The wildcard options in the Query dialog can be used to select a subset
of objects that contain a partial match for an attribute.
Selecting objects by object properties
Similar to selecting objects based on attribute values, objects can also be selected based on specific object properties. For instance, objects can be selected based on object ID, perimeter length, area, number of vertices, or even the number of sub-polygons (islands/lakes) inside the polygon. This would be very useful to identify large land owners. In this map, a query can be made to find "small" township/range blocks. A normal township/range block is 6 miles on each side, resulting in a 36 square mile area (93,239,494.7236 square meters). If we wanted to identify any blocks that were smaller than this, we could use the query option again. The units on the property should be checked before creating the query. If the values are input in the query incorrectly or in wrong units, objects may be selected that are not desired.
- Click on any of the polygons to select it.
- In the Property Manager, click on the Info tab. Notice the Area has m2 after the value. This means that the area is in square meters. So, a typical township/range block will have 93,239,494.7236 square meters as the area.
- Click the Map | Query Objects command.
- In the Select objects of type, check the box next to Polygon.
- In the where all of the following conditions are met section, click on the first --None-- text. Select Area for the condition type. Notice that Area does not have a bracket around it. This is because area is an object property, not an attribute.
- Set the equality to < and the value to 93239494.7236.
- Change the Operation back to Create a new selection. The dialog should look like:
Select objects based on properties about the object, such as Area.
- Click OK and all of the polygons with an area less than 36 square miles are selected.
It is easier than ever to create informative and professional maps with the
new query command and enhanced attribute tools.
Surfer 13's improved attribute management and new querying abilities allow you to drill down into your map and easily explore map properties. To be able to pinpoint the exact object of interest is a powerful new feature in Surfer's 3D visualization software that will quickly take your maps to the next level.
Do you have any questions about this post? Do you have an idea for a blog post or have a topic you'd like to see featured? Let me know! Leave a comment, or send an email to email@example.com.