System Spatial Database Design

1. Spatial database

The system spatial database stores the geospatial information of each business map of power pipeline equipment and pipe network, and the GIS server GeoServer determines the location and geometric shape of the ground objects by reading the spatial information in the entity table of the spatial database, and then renders them on the map come out. The list of spatial database entities is shown in the table
insert image description here

The system provides support for spatial database construction through PostGIS, and the geospatial data in the spatial database uniformly uses the Geometry data type. Since PostGIS complies well with the OGC's SFA specification, the Geometry data type can support geometric types such as point, multipoint, line, multiline, polygon, multipolygon, and collection objects. Geometry data type has two forms: one is the text form of geometric objects (CWKT); the other is the form of SQL implementation, that is, Canonical Form o well and PostGIS can pass ST_As Text (geometry) and ST_GeomFromEWKT ( text ) function to realize the free conversion between the two representations.

2. Spatial database entity structure

The entity structure of the spatial database is shown in the figure, and the spatial database entity table is uniformly inherited from the spatial base table (GEO_BASE). The entity table of the top view of the well, the entity table of the one-line diagram, and the entity table of the wiring diagram store the spatial data that can render various business diagrams, and it records the shape and position information of each element of the business diagram.insert image description here

The civil engineering entity table and the electrical entity table record the spatial data of the civil engineering layer and the electrical layer respectively; the section entity table stores the geometric information and key attributes of the cross section of the pipe trench section; the pipe hole entity table and the bracket entity table record The position and geometry of the tube hole on the cross-sectional view. The spatial civil engineering tables, electrical tables, section diagrams, pipe holes and support tables corresponding to the attribute database data are inherited from the spatial object base table (GEO_OBJECT_BASE), GE. The table structure of an OBJECT_BASE is as follows
insert image description here

Attribute and Spatial Database Association Design

The system realizes the release function of spatial data through GIS technology, and realizes the integrated operation of system graphics and text by combining the power pipeline attribute data and geographic data system. From the map, spatial information such as the geographic location of equipment and pipelines can be queried and managed, and equipment can also be managed. related attribute information. Since the system database adopts a two-layer design structure of attribute and space, the key to realize the integrated operation of graphics and text of the system lies in the design of the association between attribute data and spatial data.

The primary key ( AUTO_ID ) of each entity table in the attribute database and the spatial database is a sequence object ( SEQUENCE ) in the PostgreSQL database, which is controlled by the database to generate a unique serial number for each record. The one-to-one association of the same record in the spatial database and the attribute database is realized through the static ID (STATIC_ ID), and the generation rules of the STATIC_ ID are controlled by the system business logic layer through the timestamp generation algorithm.

The generation of static ID controlled by the business logic layer can not only ensure the uniqueness of the static ID, but also ensure that the static ID of the same record in the attribute database and the spatial database is also the same. The consistency of the static ID of the same record in the attribute and spatial database provides the basis for the association operation of attribute and spatial data. Obtain SQL type spatial data Geometry Convert Geometry to WKT form ST_ AsText(geometry) split WKT form string to obtain updated latitude and longitude Judgment device type OBJECT_TYPE Update the latitude and longitude attribute data and space of the corresponding record in the attribute database through STAT IC _ID Data association operations include adding, deleting, and modifying. The association operation of adding data records is controlled by the business logic layer of the system. The business logic layer will simultaneously control the generation of one-to-one corresponding attributes and spatial data records, while the association of data deletion and modification is controlled by database triggers. When the system deletes data and updates specific fields, the trigger will delete and update records in the corresponding database through the static ID field.

The trigger functions designed by the system database include the trigger functions of attribute data deletion, spatial data deletion, NAME field update trigger functions and longitude and latitude update trigger functions. Among them, the flow chart of the trigger function for updating the latitude and longitude is shown in the figure. Its main function is to update the latitude and longitude of the corresponding record in the attribute database when the GEOMETRY data of the point device in the spatial database is modified.insert image description here

Guess you like

Origin blog.csdn.net/leva345/article/details/131370674