PostGIS (2): PostGreSQL database space expansion module installation

        Before officially starting to interpret the PostGIS 3.1.10 documentation, let's briefly describe how to install PostGIS.

        It has been learned from the introduction that PostGIS is an extension module of the object-relational database PostGreSQL. In this case, we must first install the PostGreSQL database (for detailed tutorials, please refer to: PostGreSQL official website documentation ), and then install PostGIS. For the installation steps of PostGIS, please refer to: PostGIS installation documentation section .

Excerpt from - official website document

Table of contents

Detailed installation steps

PostGreSQL installation

 PostGIS installation

Database connection test


Detailed installation steps

PostGreSQL installation

        PostGreSQL is a free object-relational database server (ORDBMS), developers usually read it as: post-gress-QL , its Slogan is "the world's most advanced open source relational database", official website address: PostgreSQL: The world's most advanced open source database .

        Let's first take a look at how to download PostGreSQL (official website address: PostgreSQL: Downloads ), which provides support for different operating systems such as Winddows, Linux, and MacOS. Under Windows, it is easier to install PostGreSQL and its PostGIS extension module. And in the actual development, there is not a small chance that you will encounter Windows as the server to provide PostGreSQL database storage services; when installing under the Linux system, it is recommended to give priority to using yum (Yellow dog Updater, Modified) package management It will simplify the installation process, but compiling from source code will be very cumbersome.

       Below, we take the Windows system as an example to illustrate the basic process of installing the PostGreSQL database. For the version of the PostGreSQL database, choose 12.15, and the version of the PostGIS spatial expansion module to select 3.1.0 (note that there is a difference between the PostGreSQL database and the PostGIS spatial expansion module. For the corresponding relationship, the detailed corresponding relationship can refer to: PostgreSQL: File Browser ).

       

        After the download is complete, execute the exe directly to enter the installation process: install PostGreSQL first, and then install PostGIS.

         (1) When installing PostGreSQL, you can customize the installation path,

         (2) The following 4 are checked by default: PostgreSQL Server database server, pgAdmin4 management page, Stack Builder is used to download and install additional tools/drivers/applications, Command Line Tools command line tool, just use the default selection ,

         (3) data database data storage directory (the data folder will be created in the installation directory by default), and can also be customized according to your own needs.

        (4) The next step is to set a password for the super administrator postgres,

         (5) Select the port of the database server, the default is 5432,

         (6) Database cluster related settings, just select the default,

         (7) After the configuration is complete, the following window displays the configuration information, including: installation directory, service installation directory, data directory, database port number, database super administrator name, database service version information, command line tool directory, pgAdmin installation directory , the Stack Builder installation directory, and the installation log path (the default is under the C drive).

         (8) Start the installation,

         (9) During installation,

                 After installation, the PostGreSQL database service will be automatically started by default, and an uninstaller will be created for it.

         (10) After the installation is complete, prompt: You can download and install additional tools, drivers, and applications through Stack Builder.

                 It is necessary to select the service that has been installed locally, namely: the enhanced PostGreSQL database service,

                 Here, you can also use the spatial extensions provided by this tool to complete the installation of the PostGIS spatial extension module, but usually the download will be extremely slow, so it is recommended to install it in the form of an installation package. Therefore, click Cancel here to close the Stack Builder will do.

 PostGIS installation

         What is PostGIS? What application can it do? We have already made a brief introduction in the previous section, so let's go directly to the installation process.

        (0) Before the official installation, pay attention: must not! Be sure not to exit the running state of the PostGreSQL service , otherwise an error will be reported for subsequent installations.

        (1) Select the previously downloaded 3.1.0 version of the PostGIS installation package, execute it directly, and enter the installation step,

         (2) Select the components to be installed: It is recommended to check the second one - create spatial database, so that after the installation is complete, a spatial database template will be created by default (after actual development, other spatial databases can be created based on this template, which is very convenient ).

        Also notice here: After checking PostGIS, the content to be installed will be prompted next to it— PostGIS for PGSQL, Geos, Proj . Each component must also be installed one by one.

         (3) Customize the installation path, you can choose the same installation path of PostGreSQL,

         (4) Set the connection parameters of the PostGIS spatial database: user name, password and port number, which are the basic parameters set when installing the PostGreSQL database in the previous part,

         (5) Set the name of the sample spatial database to be created, use the default one,

         (6) During the installation process, there will be a pop-up window asking for the following (including: registering PROJ, GDAL_DATA, etc. to confirm operations), select Yes,

         (7) At this point, the installation is complete. If your PostGreSQL service is started, congratulations on successful installation; if your PostGreSQL database service is shut down in advance, congratulations, you will get an error log.

         PS: In fact, don’t worry if an error is reported. Click cancel to cancel the installation. After starting the PostGreSQL database service, re-execute the exe installation program and follow the above steps to install it step by step.

Database connection test

        Next, we try to connect to the database through PGAdmin, and check the spatial database created by PostGIS for us by default.

         (1) Find PGAdmin, click the servers node, and output the user password,

        (2) If the following content is displayed, the connection is successful,

         (3) Click the databases database node to view the two existing databases, among which: postgis_31_sample is the sample spatial database created by PostGIS for us.

         Under the PG12 and PostGIS3.1.0 versions, nearly 1,700 spatial expansion functions are provided for us to perform various spatial operations, topology checks, geometric relationship operations, etc. We will gradually study them in depth later.

              At this point, we will come to an end first, and then we will gradually discuss in depth the powerful power of PostGIS in GIS applications with practical examples.

Guess you like

Origin blog.csdn.net/weixin_43524214/article/details/131077910