4.21 PostGIS of Spatial Database

Tutorial:

postgreSql:https://www.yiibai.com/postgresql/postgresql_java.html

postGIS:http://live.osgeo.org/zh/quickstart/postgis_quickstart.html

If you have access to spatialite, PostGIS is easier to get started with, they have a similar syntax!

Step 1: Install PostGIS on Windows

1. Download the software

The installation files exe downloaded in this example (postgresql-10.3-2-windows-x64.exe and postgis-bundle-pg10x64-setup-2.4.4-1.exe)

下载postgreSql:https://www.enterprisedb.com/downloads/postgres-postgresql-downloads

下载postgis:http://download.osgeo.org/postgis/windows/


2. Software installation

To install PostGIS, PostgreSQL must be installed first.

1. Install postgreSql

The environment is automatically initialized:


  1) Enter the installation page, click Next


  2) Set the installation path, the default is C drive, this example is changed to F drive


  3) Select the installed components, all installed by default


4) Select the storage location of the data


5) Set password for super administrator:poostgres 


6) Set the listening port of the database server, the default is 5432


7) Set the region to use


Just default, otherwise you may end up with a warning!


8) Confirmation information



10) Installing


program directory


2. Install postGIS

  1) Enter the installation page


  2) The installation creates a spatial database by default at the same time


  3) Installation path, set to PostgreSql installation path


4) Enter the password of the PostGIS super user postgres , which is the password of the super user postgres set when installing postgreSql, the default port: 5432


5) Set the spatial database name


6) to install


7) Set the support type for raster data, all the way yes




program directory


Three, pgAdmin management database

1) Open pgAdmin 4 under PostgreSql10


2) Expand the Servers directory, click PostgreSQL 10, enter the password to connect



Import shp files into spatial databases using PostGIS Shapefile Import/Export Manager




Four, java connection database operation spatial data ( Java connection PostgreSQL database )

Off-topic: Since PostgreSql has a database server, after using jdbc to connect to the database, sql operations are ultimately processed by the server, while spatialite does not have a server, so you need to configure the processing environment in the environment variable!

下载postgresql-jdbc:postgresql-jdbc

Select the corresponding jdbc according to the JDK environment



Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326875820&siteId=291194637