This paper describes in detail how to supermap the PostgreSQL spatial data to extend PostGIS engine data.
First, software download
1, installation PostGIS must first install PostgreSQL. The 9.5.1-1-x64 version is used in this article
PostgreSQL installation package link Http://pan.baidu.com/s/1nvkORmL Password: ixot
2, Postgis_2_3_pg96.exe installation process to select the download.
Second, the software installation
1. PostgreSQL Select installation directory
2. Set password and port number, the default super Administrator:p Oostgres
3.PostgreSQL Installation Complete
4.PostgreSQL installation finished, point "Finish", will open stack Builder, click the dropdown box to select our locally installed database. If the finish interface does not check open stack Builder, you can also open this interface in the start-All Programs-postgresql
5. Select Postgis_2_3_pg96.exe, Next, set up a good download path can be directly downloaded.
6. After the download completes, installs the PostGIS
7. Install and create a space database by default
8. Set Installation path
9. Set PostGIS user name password, default port: 5432
10. Set up space database name
11. Installation Complete
12. After installation, you can use Pgadmin III to connect the PostgreSQL database.
third, database connection
The database connection is divided into two situations: local connection or remote connection;
1, the Local connection direct service address uses 127.0.0.1 connection can.
2. Remote connection
(1) Copy the Postgre dependency library under the Desktop Bin package path (Libeay32.dll, Libiconv-2.dll, Libintl-8.dll, Libpq.dll, Ssleay32.dll, note that the number of digits is consistent with the desktop, and the dependent libraries are installed in the Postgre bin path, so that the open or new data source is not grayed out.
(2) Modify the postgresql.conf file (data\postgresql.conf) to change the database server's listening mode to listen for connection requests made by all hosts. Locate to #listen_addresses = ' localhost '. After the PostgreSQL installation is complete, only connection requests from the native localhost are accepted by default. Remove all lines at the beginning of the line and modify the row content to Listen_addresses = "To allow the database server to listen for connection requests from any host. In the 9.0 Windows Edition, the configuration is already "" without modification.
(3) Modify the pg_hba.conf configuration file (data\pg_hba.conf) and add the following configuration to the host all all 127.0.0.1/32 MD5 line of the profile host all 192.168.1.0/24 MD5, Indicates that all hosts on the 192.168.1.0 of the network segment are allowed to access the database using all legitimate database user names and provide encrypted password authentication.
Where the number 24 is a subnet mask that allows 192.168.1.0–192.168.1.255 computer access.
iv. New PostGIS data Source:
Datasourceconnectioninfo info = new Datasourceconnectioninfo ();
Info. Enginetype = Enginetype.pggis;
Info. Server = "127.0.0.1";//local connection;
//info. Server = "XXX. X.X.XX "//remote connection, after configuring the environment in the previous step, the server IP info is filled in here
. Database = "Cys";
Info. User = "Postgres";
Info. Password = "Postgres";
Info. Alias = "cys123546";
Datasource Datasource = M_workspace. Datasources.create (info);
Note: When using PostgreSQL spatial data to expand PostGIS, do not install PostGIS, only PostgreSQL can create a new data source successfully, but in the creation of a good data source can not create new data sets such operations, you must install PostGIS to normal use. The following figure adds a dataset to a new, good data source.