Spatial & Attribute Queries Flashcards
Lecture 15
What is a query?
- Attribute Queries
* Select spatial features based on attribute information. - Spatial Queries
* Select spatial features based on their location relationships.
* The type of query depends on the type of data being inventoried
* Queries are “(que)-stions” being asked.
What is an attribute query?
Attribute queries retrieves a subset of data from a complete set of attribute data
The selected data subset can also be saved for further processing.
* Typically presented in .shp/.dbf format (but doesn’t have to be).
What is SQL?
SQL- structured query language
AcrGIS uses SQL for query operations.
it is designed for the manipulation of relational databases.
It is a command language used to communicate with the database.
new development allows SQL to be used by object orientated databases too.
How do we use SQL?
To use SQL to access a database we must use the following
structure:
select < attribute >
from < relation>
where < condition >
The select keyword selects fields from the database
The from keyword selects tables from the database
The where keyword specifies the condition
SQL expression in ArcGIS?
Query or the where conditions consists of Boolean expressions
and connectors
* A Boolean expression contains two operands and a logical
operator.
The “ = “ is known as a Boolean operator or logical operator
Boolean logic
a>b - greater than
a<b - less than
a=b - equal
a>=b - greater or equal
a<=b - less or equal
a<>b - not equal
Mathematical operators
a+b - addition
a -b - subtraction
a*b - multiplication
a/b - division
a^b - exponention
What are boolean connectors?
used to connect 2 or more expressions.
Complement of data subset A:
Elements that do NOT belong to
Union of data subsets A and B:
Elements that belong to A OR B or both
Intersection of A and B:
Elements that belong to both A AND B
Type of operations?
❑ Type operations select a subset and divide it into two
groups:
1. The selected records
2. Unselected records
❑ The new “New” subset
3 types of operations:
–Add more records
–Subtract records
–Select smaller subset
What kinds of operations are performed?
- “New”subset (=40)
- Add more records to the subset (+2 = 42)
- Remove records from the subset (-5 = 35 )
- Select a smaller subset (=20)
What are spatial queries?
the process of retrieving a data subset from a layer by working directly with feature geometries.
Spatial Queries
** Select spatial features based on their location relationships.**
* e.g. Find all the South African cities within 100 km of the Namibian
border.
* Select features using
* Cursor + Graphic + Spatial relationship between features (topology!)
* Results can be displayed on a map, linked to records in a table,
displayed in charts, or saved as a new data set for further
processing
** Select features based on their spatial/topological relationship
to other features**
* In same layer or in different layers
– Containment: Selects features that fall completely within features
for selection. Eg. find schools in a neighborhood.
– Intersect: Selects features that intersect features for selection
(crossed by the outline..). Eg. Select land parcels that intersect a
proposed road.
– Proximity: Selects features that are within a specified distance of
features for selection. Eg. Find a grocery shop within 1km of
selected roads.
How to combine spatial and attribute queries?
❑ Solving a site selection problem
Wildcat Boat Company is planning to construct a small testing facility and
office building. They have narrowed the proposed site to a farming area
near a large lake. The company now needs to select a specific site that
meets the following requirements:
▪ The site should not have trees. The other land uses (urban, barren and
wetlands) are also out. So, the land cover must be “brush land” or
LUCODE 300.
▪ The site must be at least 4000 square meters in size to provide space
for building and grounds.
▪ A local ordinance designed to prevent rampant development allows
new construction only within 300 meter of existing sewer lines.
What is a raster data query?
- Raster cell represent Value + Location
- Raster query is similar to Vector, the where condition consist of Boolean expressions and connectors
- Boolean expressions - Eg: [road] = 1 - (‘road’ & ’ 1’ are operands & ‘=’
s a logical operator) - Boolean connectors – A compound statement with separate expressions usually applies to multiple rasters. Eg: ([slope] = 2) AND ([aspect] = 1)
- Querying multiple rasters directly is unique to raster data.
- For vector data all attributes in a compound expression, must be from the same table or joined tables
- ArcGIS has dialogs specifically designed for vector data, but NOT for raster query.