The first few introduced the open source WebGIS Development environment, this article began to introduce the use of these software,WebGIS Development, the primary problem is to solve the data source, this article mainly introduces the vector data in the open source space database the storage in PostgreSQL. Additional data storage is described in the following pages.
1. software and data preparation
Make sure that the correct installation PostgreSQL and the spatial database plugin.
Open pgadmin IIIas shown in
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/8E/70/wKiom1jADcOw7637AADmoKmdQQ4291.png-wh_500x0-wm_ 3-wmp_4-s_4058312384.png "title=" SHP data import 1.png "alt=" Wkiom1jadcow7637aadmokmdqq4291.png-wh_50 "/>
On the above interface, you can see the Postgis_21_sample spatial database that was established when the extension was installed .
Data files that need to be imported:
due to the use of tool shp2pgsql import, I need to prepare the shp files that need to be imported :
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/8E/6E/wKioL1jADdTjvfOpAACCe3rVTlc359.png-wh_500x0-wm_ 3-wmp_4-s_3829610211.png "title=" SHP data import 2.png "alt=" Wkiol1jaddtjvfopaacce3rvtlc359.png-wh_50 "/>
Note: To prepare the shp file, it is best to wgs84 coordinates.
2. Spatial Database establishment
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/8E/70/wKiom1jADeLgCSZ9AACyu074G_8537.png-wh_500x0-wm_ 3-wmp_4-s_2689483004.png "title=" SHP data import 3.png "alt=" Wkiom1jadelgcsz9aacyu074g_8537.png-wh_50 "/>
as shown, in the property page, enter the name of the spatial database to be established, in the definition template, select the spatial data created at installation Postgis_21_sample, note that it is important to select this database template in order to import data.
3,shp data import
Open shp2pgsql, enter your account number, password, and the testDB Database You just created, click Connect as shown
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/8E/6E/wKioL1jADfWgVmG5AABtBJvERB0772.png-wh_500x0-wm_ 3-wmp_4-s_3981966009.png "title=" SHP data import 4.png "alt=" Wkiol1jadfwgvmg5aabtbjverb0772.png-wh_50 "/>
Click The Options button, the character set, the original default is UTF-8, here must be changed to GBK, or import Chinese will be garbled, such as:
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/8E/6E/wKioL1jADgayUVzjAAEAilqWmZM963.png-wh_500x0-wm_ 3-wmp_4-s_3915003446.png "title=" SHP data import 5.png "alt=" Wkiol1jadgayuvzjaaeailqwmzm963.png-wh_50 "/>
Click the Add File button to add the shp file you want to import, and click the Import button to import the layer .
650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/8E/70/wKiom1jADhuyOKFFAACUO6yURYE056.png-wh_500x0-wm_ 3-wmp_4-s_3360026560.png "title=" SHP data import 6.png "alt=" Wkiom1jadhuyokffaacuo6yurye056.png-wh_50 "/>
4. View the imported data
as shown, use pgadmin III to Open the established spatial database, point schema under the Public node under the Data Table node, to view the imported data.
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/8E/70/wKiom1jADjCDX_3gAAFShWTu88g677.png-wh_500x0-wm_ 3-wmp_4-s_39048326.png "title=" SHP data import 7.png "alt=" Wkiom1jadjcdx_3gaafshwtu88g677.png-wh_50 "/>
This article is from the "open source GIS offline map" blog, so be sure to keep this source http://cdguiyi.blog.51cto.com/4275617/1904550
Webgis vector Data import of open source solutions