====== Spatial Databases ====== A **spatial database** is a database that is optimized to store and query data that is related to objects in space, including points, lines, and polygons. While typical databases can understand various numeric and character types of data, additional functionality needs to be added for databases to process spatial data types. These are typically called geometry or feature. Anyway **any database** can be used to store spatial information. This spatial data can be viewed and queried using a GIS interface like Orbit. This way, a free and easy-to-install database can be turned into a powerful spatial database. Therefore, some additional fields are required and the geometry needs to be stored using [[http://en.wikipedia.org/wiki/Well-known_text|well-known text or well-known binary]]. Points can also be saved by storing their coordinates in separate fields. The database table stores both spatial information (geometry) and attribute information. ===== Accessing a spatial database in Orbit ===== - **Database Connection** \\ Configure a [[dev:technology:core:database_connection|]] using an available [[dev:technology:core:database_driver|Database Driver]]. \\ \\ - **Orbit DataBase File** \\ Create an [[dev:technology:supported_formats:vector:odb|]] from the datasetlist drop-down. \\ The .odb File describes how spatial information is stored in an external database and allows the translation of spatial data from a database into an Orbit dataset. This odd-file can be considered as a map layer. \\ \\ - **Open dataset** \\ The old-file will be automatically added to the dataset list at creation. {{ :dev:technology:core:createodb_211.png?nolink&400 |}} ===== Supported Databases ===== Orbit supports **any database** via the [[http://en.wikipedia.org/wiki/Java_Database_Connectivity|Java Database Connectivity]]. \\ To make a Connection from a Java application to a database, a database driver is required. Many databases provide a Java class to access their database using the SQL language. These are JDBC drivers : [[dev:technology:core:database_driver|]]. * Oracle * Postgresql * SQLServer * ... ===== Supported Database Geometries ===== Vector geometry can be stored in different ways in a database table. Orbit supports : * [[http://en.wikipedia.org/wiki/Well-known_text|Well-known text]] (Orbit's default geometry format) * [[http://en.wikipedia.org/wiki/Well-known_text|Well-known binary]] * Separate coordinate fields (x,y,z) * [[http://en.wikipedia.org/wiki/Oracle_Spatial_and_Graph|Oracle Spatial]] * [[http://en.wikipedia.org/wiki/PostgreSQL|PostgreSQL]] (Read only support for PostgreSQL WKT) Orbit advises the use of Well-Known text as it is an ISO standard and was originally defined by the [[http://www.opengeospatial.org/|Open Geospatial Consortium]]. \\ The below listed WKT geometry types are supported : * GeometryCollection * LineString * MultiLineString * MultiPoint * MultiPolygon * Point * Polygon * PolyhedralSurface * TIN * Triangle ===== Add spatial bounding boxes ====== To reduce database access and optimize the speed of use in Orbit, object-bounding columns can be added in the database table. \\ This is optional but advised when reading large amounts of vector data stored as Well-known text or well-known binary. It is mandatory for writing (insert or update). \\ When using Oracle Spatial to store and manage the object geometry, these viewing optimizations are managed by Oracle. No Orbit interaction or optimizations are supported. Orbit auto-calculates the bounding values for all objects at first view, and updates them on object edits. \\ The object-bounding database columns must be created by the administrator. \\ Orbit will only use them if available. The value type should be Double and their names are fixed, using the "SPATIAL_COLUMN" name as defined in the [[dev:technology:supported_formats:vector:odb|]] as prefix : * MINX * MAXX * MINY * MAXY ===== Edit database structure ===== However Orbit is able to connect to any by Java supported database, Orbit is not a database management application. Using Orbit following database actions are supported : * Insert a table record * Edit or Update a table record * Remove a table record * Insert a new database table In other words, this means that it is possible in Orbit to : * Create, edit, and remove an object in Orbit. \\ One table record is one object in Orbit. Both spatial component and attribute component can be updated using Orbit * Create and delete a dataset in Orbit stored in an available database connection. (only available from Orbit Asset Inventory). Dataset structure management like adding or removing attributes must be done via the database design table tools.