Services
d.5| SPATIAL DATABASE
Spatial database is a database that has the additional textual ability to store and query data representing objects defined in a geometric space. Most databases allow representing objects by points, lines, polygons or more complex structures: 3D objects, topology, linear networks, etc.
The main RDBMS used in GIS are:
Microsoft SQL Server - the way how POLYGONS geometry it's stored ((x1 y1, x2 y2, x3 y3, x4 y4, x5 y5))
eg. DECLARE @g geometry;
SET @g = geometry::STPolyFromText('POLYGON((0 0, 0 3, 3 3, 3 0, 0 0), (1 1, 1 2, 2 1, 1 1))', 10);)
Oracle Spatial - the way how POLYGONS geometry it's stored {X1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3, X4, Y4, Z4, X1, Y1, Z1}
eg. INSERT INTO t1 (i, d, g)
VALUES (
11,
'Polygon',
sdo_geometry (2003, null, null, sdo_elem_info_array (1,1003,1),
sdo_ordinate_array (10,105, 15,105, 20,110, 10,110, 10,105))
PostgreSQL + PostGIS - the way how POLYGONS geometry it's stored((x1 y1, x2 y2, x3 y3, x4 y4, x1 y1))
eg. INSERT INTO geotable ( the_geom, the_name )
VALUES ( ST_GeomFromEWKT('SRID=312;POLYGON((0 0 0,4 0 0,4 4 0,0 4 0,0 0 0))'), 'A Place' )
The most common spatial data storage formats are developed by ESRI :
Shapefile - data is stored in files with the same name but with different extensions. For shapefiles are mandatory three files with the extensions .shp, .dbf and .shx;
Personal Geodatabase - data storage is done using Microsoft Access MDB format, .mdb;
File Geodatabase - data is stored in files of a folder with extension .gdb.
A spatial database enable us:
- store a large collection of spatial data in a centralized location;
- apply rules and complex relationships between data;
- defining complex geospatial models;
- spatial data integration with other databases.