Types of Spatial Queries in DBMS
Any type of spatial data that is data related to location and which represents objects defined in a geometric space, is stored and maintained by Spatial Databases. These are used to handle these Spatial Databases. Spatial database mainly contain representation of simple geometric objects such as 3D objects, topological coverage, linear networks and TINs(Triangulated irregular networks).
There are mainly three types of spatial queries as given below.
- Nearness queries:
It request objects that present near a specified location. A query to find all Hotels that lie within a given distance of a given point is an example of a nearness query. The nearest-neighbor query requests the object that is nearest to a specified point.
For example, we may want to find the nearest Railway station. Note that this query does not have to specify a limit on the distance, and hence we can ask it even if we have no idea how far the nearest Railway station lies.
- Region queries:
It deal with spatial regions. For example, a query can ask for objects
that is present partially or completely within a fixed region. A query to find all medicine shops within the geographic boundaries of a given town or we can find all the available school in a particular city.
In this type of queries, we may also request intersections and unions of regions.
For example, given region information, such as annual rainfall and population density, a query may request all regions with a low annual rainfall as well as a high population density.
In general, there is a combination of spatial and Non spatial requirements in the queries on spatial data . For example, we may want to find the nearest restaurant that has vegetarian selections and that charges less than $10 for a meal.
Since spatial data are inherently graphical, we usually query them by using a graphical query language. Results of such queries are also displayed graphically, rather than in tables. The user can invoke various operations on the interface, such as choosing an area to be viewed (e.g., by pointing and clicking on suburbs west of Manhattan), zooming in and out, choosing what to display on the basis of selection conditions (e.g., hotels with more than three stars), overlay of multiple maps (e.g., hotels with more than three stars overlaid on a map representing areas with low crime rates), and so on. The graphical interface constitutes the front end.
Extensions of SQL have been proposed to permit relational databases to store and retrieve spatial information efficiently, and also to allow queries to mix spatial and non spatial conditions. Extensions include allowing abstract data types, such as lines, polygons, and bit maps, and allowing spatial conditions, such as contains or overlaps.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.