Summary
Keywords
Full Transcript
spatial data is a simple geometric object such as points, lines and polygons. They are represented as coordinates in an N-dimensional space, and they can be 2D or 3D. Well-Known Text (WKT) is the format for writing spatial data, which specifies a shape name followed by vertex coordinates. Spatial data can be either geometric or geographic: Geometric data is embedded in a flat plane or a Cartesian coordinate system, which is square 3D space. Geographic data is defined in relation to the Earth’s surface. Ex: A geographic point can be described as latitude, longitude, and elevation above sea level. Since the Earth’s surface is not flat and is curved, distance and area computations for geometric and geographic data are different. Spatial types MySQL types are restricted to two-dimensional coordinate systems. MySQL supports four basic spatial types: POINT - a location, like your home address. LINESTRING - of one or more line segments and represents objects like streets on a map, or state boundaries. The line can also be formed into a rectangle or other shape, but is 1D and does not have an area. POLYGON - 2D surfaces such as regions or cities on a map. Polygons are closed and have an area, and can also have holes, which are just inner polygons inside an outer polygon. GEOMETRY - can be either a POINT, LINESTRING, or POLYGON. MySQL supports types that contain multiple geometric elements in each value: MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, and GEOMETRYCOLLECTION. MySQL also supports around 100 functions that manipulate spatial data, such as ST_AREA() to get the area of a polygon, and ST_DISTANCE() to get the distance between two spatial values. There are also MySQL functions for manipulating the minimum bounding rectangle (MBR) , which is the smallest rectangle that contains a spatial value. A spatial index is a data structure that allows for accessing a spatial object efficiently. It is a common technique used by spatial databases. Without indexing, any search for a feature would require a "sequential scan" of every record in the database, resulting in much longer processing time. Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!
