Postgresql installs postgis plugin and imports data

Today I will share postgresql to install the postgis plug-in and import data. First of all, we need to know when the postgis plug-in needs to be installed. This is a very important prerequisite; It is forced to find that this plug-in needs to be installed. Today we will first simulate the scene of importing data and find that the postgis plug-in needs to be installed.

1. Navicat import data

Select the sql file

 Open

click start

 

An error occurred, a core error

[ERR] 错误:  类型 "public.geometry" 不存在
LINE 32:   "the_geom" "public"."geometry",

 The reason for the error is: because this sql file refers to the data type of geographic space, which is not available by default, and the gis plug-in needs to be installed;

If it has been installed, check whether the installation is successful or whether the version matches; after checking, it is found that the postgis plug-in is not installed, and the installation starts below;

 2. Official website download

download link

Find the corresponding database installation version

click

 3. Double-click to install

Note that the postgresql service should be stopped before installation to avoid any impact; at the same time, install it as an administrator

Select the components to install. Optional is a sample database.

Note: You can also check the content in the red box in the figure below: create spatial database to initialize a spatial database. This database will be used as a template for a spatial database to facilitate the creation of a spatial database later. Do not check it here, and we will later Featured presentation.

 Click Next

Here try to choose the path where Postgresql was installed before for easy management.

 

Three pop-up boxes will appear, select Yes. 

The installation is complete. 

Check verification, whether the installation is successful

SELECT postgis_full_version();

Anomalies

 

Execute the following statement in the navicat query to load the extension 

CREATE EXTENSION postgis;

Loaded successfully

 

Continue to query, check and verify whether the installation is successful

 It proves that postgre is installed successfully.

4. Import data with spatial coordinates again

The import is now successful. 

At this point, the plug-in installation and sharing are completed. It is more practical to import missing plug-ins through the business and then query and install them. Friends can refer to them.

Guess you like

Origin blog.csdn.net/nandao158/article/details/129820620