|
Note on the creation of the geographic database
Preamble: This document lists the operations necessary to create a new geographic database and to insert the vector layers (shapefiles) used in MDweb’s cartographic client. It not covers the use of the cartographic editor, especially for selecting the layers to display, and for setting their display properties and their legend.
Accessing the geo database management module. Creating a geographic database Modifying a geographic database Deleting a geographic database Configuring the connection to the geographic database
Utility and use of the geographic database for the cartographic client
The geographic database which is associated with MDweb contains the layers of geographic information that we want to display during the searches and cartographic data-entry.
These information layers within the cartographic client are used:
To offer the user relevant geographic objects during data-entry as well as during searches, it is necessary to define a set of information layers representing geographic objects of interest to the cataloguing project which can be used to reference the data sets. MDweb’s module for creating and managing the geographic database can be used when MDweb is being installed to create a database, insert information layers without having any specialized knowledge of the PostgreSQL/PostGIS management system and then to configure the cartographic client.
Current limitations
Limitations in constructing the database
The geographic database has to be created using shapefiles (or vector layers) in the ESRI shape format on data that is georeferenced in a system of projection. The shapefiles should be accompanied by their *.proj projection definition files. Keep in mind that MDweb’s cartographic module is not a detailed navigation or display module but a basis for entering the spatial extent and of data searches based on location. These two functions necessitate the inclusion of necessary objects of interest but do not require a very precise representation.
Limitations of the geographic database management module
The geographic database is constructed using PostgreSQL/PostGIS. During the creation or modification of the geographic database, the server hosting MDweb and the server hosting the database should be the same. In addition, the GEOS and PROJ4 libraries should be installed as should the proj and invproj executables. In fact, the scripts used for creating and modifying the database execute SQL commands via PHP scripts. The module has been implemented and tested only on PostgreSQL/Postgis 8.1 and 8.2 under Windows and Linux. Only projected shapefiles can be inserted (use of the shp2psql function). Because of the execution of PostgreSQL functions via PHP, the execution time of postgres commands depends on the max_execution_time php.ini directive which we should set to 180 s. In view of this, the insertion of large shapefiles can prove problematic.
The geographic database management module can be accessed only if you are logged into MDweb as administrator. Go to MDweb’s administration module. All the features of the module are accessible via the ‘Geo DB’ command in the administrator menu.
The geographic database management module offers five major functions: · Add: to create a new geographic database · Modify: to insert or delete information layers from an existing geographic database · Delete: to delete a geographic database · Configuring the connection: to set the parameters for connecting to a PostgreSQL server and to a geographic database that will be used with the cartographic client · Cartographic editor: to specify the layers that will appear (and configure their legends) in the cartographic client · Updating the spatial and thesaurus DBs: to update the ‘hierarchiespatiale’ table with terms of type ‘spatial’ of the application’s thesaurus. (For details, consult the ‘Note on thesaurus management’.)
- This module allows you to create a new geographic database under PostgreSQL/PostGIS. This module requires the PostGIS spatial extension to be installed on your PostgreSQL server. During the creation of a geographic database, the MDweb scripts execute SQL commands and use PostGIS’s lwpostgis.sql and spatial_ref_sys.sql files.
Tables created and their use
The tables created in the geographic database: by default, on creation of a database containing geographic objects of type GEOM, PostgreSQL creates two tables: · geometry_columns which references all the tables containing the geometry (field of type GEOM) and their properties · spatial_ref_sys which contains the definition of the system of projection.
Three additional tables required by MDweb are created:
· objet_geom which contains the geographic objects that are to be used to define the extents of the metadata records of your catalog · metadata_link, a table that links the metadata record identifiers with the extents (geometry) stored in the objet_geom table · hierarchiespatiale, a table for storing the hierarchy between layers of the geographic database. This hierarchy is used to display the information layers in the cartographic module.
Creation of the database using MDweb’s ‘Geo DB’ module
1. Go to the Add a geographic database page from the administration module.
2. Fill in the form that opens. First review the pre-filled default values. If they are not suitable, modify them. As a subsequent step, you will have to modify the default configuration of the connection to the geographic database by going to the ‘Connection to the Geo DB’ page of the same module.
Seven fields relate to the creation of a database: · IP address of the DBMS: Name or IP address of the server hosting the geographic database. · TCP/IP port of the DBMS: Access port number of the database server. By default, the port is 5432. · User account: Name of the user allowed to access the geographic database. He should have write rights on the database. He should also be able to create a database. · Password: The user’s password. · Name of the geographic database: Select a name that does not include spaces or special characters (? ;: ! &, etc.) · Full path of the lwpsotgis.sql file: The full path should include the drive letter for a Windows installation. Normally, this file is located in the share/contrib/ folder of your PostgreSQL installation. If it is not, the PostGIS extension has not been installed. This file is absolutely necessary for the correct execution of the database-creation scripts. · Full path of the spatial_ref_sys.sql file: The full path should include the drive letter for a Windows installation. Normally, this file is located in the share/contrib/ folder of your PostgreSQL installation. This file is absolutely necessary for the correct execution of the database-creation scripts.
3. Once the form is filled in, Submit it. A new page will open for you to fill in the final details for the creation of the geographic database.
4. Choice of the srid (spatial reference identifier)
You have to provide the srid of the system of projection being used. This is a unique numeric identifier. A list of srid’s is stored in the spatial_ref_sys table of your database.
a) The ‘Spatial reference identifier’ field allows you to access the list of the stored srid’s and to select the appropriate one (the same as of your *.proj file).
By clicking on one of the items of the list, you will automatically fill in the two fields ‘Spatial reference identifier’ and ‘System description’.
Or
b) Load the project definition file of your shapefile using the ‘Browse’ button. c) Submit the form.
Help in identifying the srid: The srid is not stored in the definition file of your shape. However, it contains the name of the system of projection:
You can search for the srid of the system of projection on the site of OGP Surveying & Positioning Committee (www.epsgs.org), EPSG Geodetic Parameter Dataset section. If your system of projection is not referenced by this organisation, there are others, for example, ESRI. We make available a file for download, srid.sql, which contains additional systems. Make a text search for the name of your system in this file and you will, no doubt, find the srid corresponding to your system of projection. The file is located with the MDweb scripts at: create_geo_db/srid.sql
1. Go to the Modify a geographic database page from the administration module
Inserting a new layer of geographic information
2. Click on the Modify button to access fields that will allow you to change the shapefile and associated files (shx, dbf).
3. Enter paths of the shapefile that you want to insert into the database. Three files are necessary for the importing of the layer:
· The shp shapefile itself · The shx index file · The dbf file containing the attributes.
Note: The dbf file has to have a column called ‘toponym’ of type ‘text’ of a maximum of 50 characters. This column is used to display the toponym.
4. You then have to provide a name for the table that will be created in the database. This table name will then be used during editing in the cartographic client.
5. Submit the completed form.
Remark: An information layer can only be inserted when it is already projected in a system and is accompanied by its *.proj projection definition file.
Deleting a geographic information layer
You delete a table starting from the same page used for inserting a table.
1. Go to the Modify a geographic database page from the administration module.
2. Select the database from which you want to delete a table.
3. Delete the table that you want removed. The deletion is immediate and irreversible..
1. Go to the Delete a geographic database page from the administration module.
3. Select the database that you want to delete.
4. Validate. The database is immediately deleted.
This module is used to configure the connection to a PostgreSQL server and to a geographic database that will be used with the cartographic client. Use of this module leads to changes in the values of the connection variables contained in the config/config.inc.carto.php file. Access this module: Geo DB > Configuration > Geo DB connection
A form will allow you to change the existing or default configuration:
Seven fields allow you to change the settings for connecting to the geographic database:
After modification and verification of the values entered into the fields, validate your choices with the ‘Creation of the geographic module’s configuration file’. The config/config.inc.carto.php file will be modified.
Remark: For this operation to succeed, it is necessary for the ‘apache’ user (user of the httpd service) to have write rights for the directory where the MDweb scripts are stored.
Contacts
IRD/ ESPACE unit (US 140) 500, rue Jean François Breton, 34093 Montpellier Cedex 05, France TEL: +33 (0)4 67 54 87 02 J.C Desconnets jcd@teledetection.fr
Site of the MDweb project: www.mdweb-project.org Online demonstration: demo.mdweb-project.org
|