23 RS/GIS- Spatial Queries in GIS
Dr Seema Mehra Parihar
Learning Objectives:
In this chapter you will learn about the following:
- Comprehend the meaning of Spatial Queries
- Be able to evolve linkage between database structure and multiple spatial queries
- Appreciate the classification of Queries.
- Be able to understand the basics of thematic query , geometric query and topological query.
- Recognise the relevance of spatial dimension based query in decision making of all kinds.
1. INTRODUCTION
By now you have learned the meaning, relevance and power of Geographic Information system. You have also learned the advantage of GIS and different models that are present with dealing with raster and vector GIS. In this chapter you will take your journey forward and learn about that power of GIS that makes GIS a spatial decision making tool. One of the important step towards it is ‘spatial queries’. This lesson deals with different aspects of spatial queries. “The aim of spatial queries and their analysis is to detect spatial relationships between elements of one or more subjects, in order to locate spatial objects. The results of such analysis can be used in decision making. The database structure, which is included in a GIS, enables the logical, consistent and ordered storage and management of data. Both thematic and geometric information are stored in the form of tables. In the discipline of geo information, the term data analysis includes all those investigations, queries, evaluations, etc., which are carried out on structured and stored spatial data. When a query is performed to obtain and answer to a spatial question, the data are accessed through the basic elements of this structure which is made up of tables, fields, data sets, values and connections, Dolci, 2016 ”. The simplicity or complexity of query many-a-time is also guided by the available software capability. But, foremost of this, is the users requirement and understanding of the capability of the Geographic Information System. The following section deals with the kind of queries that GIS handles and/or can handle.
Figure 1: GIS is a query based Spatial data Management System with multiple Layers
2. Query a Step towards Information System
“ The deduction of new information from existing spatial data is one of the main tasks of a geoinformation system. Spatial analysis comprises analysis and synthesis of spatial data to a unity […] Every spatial analysis implies the professional interpretation of the results.” (Bill 1999) “. Through GIS, what you need to build are multiple queries that are revolving around a unique system where the question and answer system are designed in a system which is a repository of a data set. We know by now that the spatial information system deal with tools, algorithms and technologies in a computerized environment through innumerable queries. This enable handling of large data sets and conversion of raw data into useful information. “a system is called geographic information system (GIS) if the data are geographically referenced. “GIS is composed of various individual components. Some of these functions are basic, while others are more complicated or required for special applications. The user interface, query functions and the data management system play an important role. The user interface enables the user to communicate with the system. It allows users to start operations, query information, etc. Via the user interface, analysis functions can be executed through accessing the data. Data access and data management in general is controlled by the database management system,(Carosio 2000)”.As depicted in Lesson 1 too data is the most important component of any computer based decision making system and so is the case of Geographic Information System. There are two types of datas used in GIS and they include Spatial data and Aspatial data . This makes a base of any query building layer.
Figure 1: All Queries based on existing Spatial & Aspatial data
The data structure comprises the association of theme driven thematic data and spatial oriented geometric information. Certainly , geometry is expressed in the context of reference that has spatial connotation. What is important to understand is that a spatial reference is assigned to all the objects, area or phenomena that one wishes to map and study based on the objective. The extent may be of varied scales- lesser or greater depending on the objective of the spatial inquiry. Spatial reference is also referred as Geo reference indicating specific locational extent of spatial information.
3. Query Classification
A. Based on Spatial & Aspatial relations
What is important for us to understand that the queries are all based on following aspects:
Locational properties
Metric properties (geometry), Topological properties .
Thematic properties
“Topological properties are expressed by information about e.g. relations of neighborhood (what object is neighboring?), containedness (does an object contain other objects?), overlap (is an object overlapped by other objects?), etc. In addition to geometric and topological properties, thematic properties are also assigned to each object. They are stored in tables. The geometric and thematic information affect each other. These so called objects are subject
Based on above properties the approaches that are used for performing a query could be three fold. One of them could be a thematic query –based on a single or particular theme. For example, a query could “ Select all rhododendrons’ from the image given, or “select all springs” located in the given spatial unit/image. Second could be a Geometric Query, where selection is based on a particular query related to a geometric parameter , as for example “ select all the industries that are located less than 100m away from the river Ganges” or “select tobacco shops located within 100m near schools”. The third could be a topological query, where the ‘condition criteria’ related to the surrounding spatial parameters and spatial relations is considered . In other words “Selection of all objects , based on particular spatial relations that achieve certain conditions.For example , select all the buildings that are lying in Seismic zone 4”
B. Queries based on the coverage of Data Sets
Data sets are sometimes so large that query could not be performed on the entire datasets and sometimes the need also is not for covering entire data set. Therfore queries based on the coverage of the datasets could be performed on the entire data with total coverage or query performed on the some portion of the data called sub-set of the data. These are called Subquery and are generated/produced through complete queries. Subquery is a ‘Select Statement’ composed of three parts.
Table 1: Parts of ‘Sub Query’
3: QUERY BASED ON THE ACCESS & RESULT
Direct Query
Manipulation
In direct query , “Data are accessed interactively by the user or by an application program. Thus, a subset can be extracted, while the original data remains unchanged. The selection commands can be entered in
- command lines or query masks.
- sequences of command lines (batch, macro).
- formal query language. (SQL 2 (Structured Query Language
Whereas “by manipulating, new geographic information elements can be created. These new elements can be used for analysis purpose in further steps. In general, the new objects have to be previously conceptually modeled , and their data structure has to be implemented in the GIS. Some GIS can generate a minimal data structure (without thematic attributes) automatically. New information can be generated combining different objects. They can be used for further analysis , (Claudia,2016). ”.
- Different Queries
“A GIS stores spatial and attribute data in two separate files. Corresponding records in the two files (for example, a map of property parcel boundaries and the corresponding data such as the name of the owner, structure, and the value of the structure) are linked by an identification number. This allows a GIS to search and display attribute data, based on spatial criteria, and vice versa. For example, a GIS user can point to a particular property and ask the GIS to retrieve and display the attribute data of that parcel, but can also ask the GIS to locate the corresponding property parcel on the map by supplying a record in the attribute database, (Sidiqui, 2016)”.
Table 1: List of main relational operators used in “Query GIS”
Relational Operator | “Spellings” | Interpretation |
= | EQ | Equal to |
> | GT | Greater than |
>= | GE | Greater than or equal to |
< | LT | Less than |
<= | LE | Less than or equal to |
<> | NE | Not equal to |
GIS also handle much more complex queries. “The Relational Operators are so important in GIS that they are used for all-numeric attributes, text attributes and other data types. Relational attributes are listed in Table 2 . The users can define search parameters involving arithmetic and logical expressions by building a “query statement”. Operators such as +, -, =, not =, <, <=, >, >=, between and others specify the value to be found. Several query statements can be combined to perform a single query. For example, “How many structures are for sale, with a price of RS 12,00,000 or less and in a specific location?” The GIS would first build and send a query statement to the DBMS, which would search the attribute database for those parcels meeting the criteria. The DBMS then would return the parcel numbers to the GIS. “The GIS would then search its spatial data file to find these parcels and their coordinates, and finally it would highlight those parcels on the display of the property parcel map” On the other hand, GIS users can also describe an area on the parcel map and ask the GIS to retrieve the attribute data of all parcels that are within the specified area. This area could be in any shape. Logical operators could be employed to narrow the search or even to specify which attributes to retrieve. SQL also provide many additional functions like aggregate functions” for spatial analysis they include functions as depicted in Table 3:
Table 3 : Additional Aggregate Functions in GIS
Spatial query in GIS relates to characteristics of a spatial entity in geographic space. It could be a point, line or polygon. “Spatial queries are performed by creating a query set based on the spatial relationship of map features. Spatial operators in the queries define the spatial relationships that exist between map features. Most spatial operators (overlaps, entirely contains, entirely contained by, contains, contained by, terminates in, terminus of, passes through, passed through by, on boundary of, has on boundary, touches, meets, and spatially equal) can be combined to answer complex spatial queries. Proximity operators (between, within, beyond, entirely between, entirely within, and entirely beyond) are those that cannot be combined with each other, (Korte,1997). For example, a region with disaster management agency might collect a database of all location addresses and classify them into seismic zone 3 & 4 and non-seismic zone areas by performing a spatial query. Another example is depicted in table 4 where a graphical input image with Unique ID’s produces an output graphical image , based on a spatial query raised and set of relationships established.
Table 4 : Graphical Input & graphical Output image after the Query Input.
Graphical | UID | Shape | Query | Graphical Output Image |
Input Image | ||||
It could use GIS to compare a map of the 100-year flood plain to the tax parcel map as follows:
- First of all, the user would query for all parcels that are within the flood plain area (using the “entirely contains” operator). T
- What follows is These addresses would be classified as “flood-prone”.
- The GIS would then be used to find all parcels crossed by the flood plain boundary (using the “passes-through” operator).
- Address in this category would be classified as “intermediate” and determined that if the structure itself was flood prone or just a portion of the property.
- The remaining parcels would be entirely outside the flood plain and put into the “not flood prone” category.
- The “disjoint” operator may be used to check the identified flood prone parcel and label it.
GIS can also combine AND compare or query sets in several logical ways. Queries that involve two or more query sets are called “set queries.” Set query operators ,commonly known as “Boolean Operators’” often include the following operations:
union,
intersect,
minus and difference,
When conducting a study to find possible sites for a new INDUSTRY , several query sets may be created to find locations that are not suitable .
- The first query set might identify buffer areas surrounding endangered habitats,
- another might identify all forested areas,
- another might show all flat areas, and another might indicate locations of competing industries.
The query sets then could be combined using the “union” operator and all areas on the map that are not suitable would be identified. The remaining areas would then be examined for potential sites.
4. Creation of a Query layer
New Query layer has to be created and in most software you get a new dialog box in the left corner as for example you get in Arc Map. The first and foremost step is finding a way and developing a connection to database. What followed is the visibility of the list of tables. As you are working with different data type check whether, the specific data type is conducive and acceptable by the software you are using. Sometimes less common data bases are not supported by a software. In that situation there is aneed to convert the existing data set into an acceptable format.
Another important thing which we have already learnt is the need for SQL syntax should be used when building a query layer. A common example would be as follows:
SELECT * FROM Test India . This would result in a query layer containing all rows from the India table. Once the query is created, it must be validated. During validation, ArcGIS attempts to determine the properties of the query layer based on the first row returned in the table.
The properties of a query layer are the following:
What is important to understand is the properties of a query layer. As given in the guidance of GITTA ,2016 they are ,
“Unique identifier field—This is one or many fields used by ArcGIS to uniquely identify the layer.
Dimensionality—This determines whether a layer’s coordinates will include m-values to store route data and zvalues to store 3D data.
Geometry type—This determines whether the layer is a point, multipoint, line, or polygon.
Spatial reference—This is the coordinate system and other related spatial properties for the layer”.Gitta,2106.”
That means, that all our work is generally done in the Query Text box. Therefore it is essential to give a meaningful title to the Query text box so that it can be recognized easily. This to be followed by giving a relevant and required SQL query in the Query text box. Next to follow is Validation. Once the query is created, it must be validated. Click Validate to make sure the query syntax is correct and returns data that can be used by ArcGIS. The validation process executes the query in the database and verifies whether the result set from the query meets the data modeling standards enforced by ArcGIS. A query layer is not added to ArcMap until it is valid.
Rules for result set for validation is as follows:
At most, one spatial field.
At most, one spatial reference. Only one shape type.
During the validation process, the dimensionality, geometry type, spatial reference, SRID, and unique identifier properties on the query layer are all considered . These values are based on the first row returned in the query. If you need to change these settings, you can do so through the Advanced Options dialog box. Consequent of a the query being successfully validated, generally there is need to click finish or end depending on the software and add the result set to ArcMap as a query layer.
Advantages of the query further enhances when we use it fully recognizing the power of GIS .Since, GIS visualises all queries related to where, when, what and why possibilities can be enabled in GIS software.Since, GIS enables to create a
comprehensive framework to a concern in hand and supports the policy and decision makers to arrive at the right ground reality. All queries related to the simulation and predictability can b addressed as GIS predict events/outcomes derived based on multi-criteria analyses carried out using the appropriate thematic layers in GIS. Even at the time of quick decision making correct queries can assist in planning strategies, especially useful in case where disastrous events demands quick decision making.
Correct queries helps in geo-visualization of the present scenarios and how the simulation would look like and its consequences. Such scenarios greatly assist disaster managers to plan for future and safe human lives.
Summary:
We know by now that the spatial information system deal with tools, algorithms and technologies in a computerized environment through innumerable queries. Queries enable handling of large data sets and conversion of raw data into useful
information.The simplicity or complexity of query depends on the users requirement, understanding and the capability of the GIS. It could be limited to merely data retrieval or could be a mix of retrieval and manipulation., reference identifier are returned by the query. The queries are all based on locational properties ;metric properties (geometry), topological properties and thematic properties. Most of the time depending on the objective there sub-queries and they consist of three parts:part description; expression and SQL statement. What is important to understand is the properties of a query layer as “Unique identifier field; Dimensionality; Geometry type—and Spatial reference. .” SRID is the layer’s spatial reference identifier and is used to ensure that only geometries with the same spatial. Once the query is created, it must be validated.
you can view video on RS/GIS- Spatial Queries in GIS |
References
- Bonhan – Carter, G.F. 1994. Geographic Information Systems for Geoscientists. Love Printing Service Ltd., Ontario, Canada.
- Burrough, P.A. 1987. Principles of Geographical Information System for Land Assessment. Oxford : Clardon Press.
- Chung, Chang-Jo F. and Fabbri, A.G. 1993. The representation of Geoscience Information for data integration. Nonrenewable Resources, Vol. 2, No. 2, Oxford Univ. Press.
- Chang, Kang-tsung (2002) Introduction to Geographic Information Systems, University of Idaho, Tata McGraw-Hill Publishing Company Ltd, New Delhi, 2002, ISBN 0-07-049552-1.
- Ganesh, A. Ed. (2006) Applications of Geospatial Technology: Serial Publishing House
- Hohl Pat Ed. (1998) GIS Data Conversion, Strategies, Techniques, Management, Onward Press, 1998
- Korte,G,B., (1997) The GIS Book, Understanding the Value and Implementation of Geographic Information Systems, 4th Edition,. Onward Press, 1997.
- Parihar, S.M. (2007),, Standardisation in Geo ICT Arena, Vol.5. Issue 5.p.p 40-46. Feb,2007,Geospatial Today, p.p 40-46.
- Parihar, S.M., (2007)Catching that Fleeting Detail, Vol.6. Issue 6.p.p 42-45. August,2007, Geospatial Today, pp 42-45
- Parihar, S.M.,(2006) 3-D GIS: Much Awaited Technology, Vol.4 . Issue 11. August,2006 ,Geospatial Today, pp 43-46
- Raper, Jonathan, Ed. (1989) Three Dimensional Applications in Geographic Information Systems. Philadelphia, PA: Taylor & Francis, Inc.
- Siddiqui, M.A. (2011) Concepts and Techniques of Geoinformatics, Allahabad: Sharda Pustak Bhawan
- Worboys, M., & M. Duckham (2004) GIS A computing Perspective, London, CRC Press Dolci, Claudia ,et.al., 2016 (www.gitta.info – Version from: 4.5.2016 3)
- Egenhofer, M.J., 1993. A model for detailed binary topological relationships. Geomatica, Vol. 47, no.3-4, 261-273.
- ESRI. ArcInfo Help. Download: http://www.esri.com
- ESRI. GIS Dictionary: SQL [online]. Available from: http://support.esri.com/en/knowledgebase/Gisdictionary/browse
- Longley, P.A.; Goodchild, M.F.; Maguire, D.J.; Rhind D.W., 1999. Geographical Information Systems. Principles, techniques, applications and management. New York, etc.: John Wiley & Sons.
- Saaty, T.L., 1980. The Analytic Hierarchy Process: Planning Setting Priorities, Resource Allocation.New York: McGraw-Hill International.
- Worboys, M., Duckham, M., 2004. GIS. A Computing Perspective. Chapter 4. Models of geospatial information. Boca Raton, etc.: CRC Press.