官术网_书友最值得收藏!

Creating a spatial database

Creating a spatial database in QGIS is a simple operation. QGIS supports PostGIS, SpatiaLite, MSSQL, SQL Anywhere, and Oracle Spatial databases. We will cover SpatiaLite, an open source project that is cross-platform, simple, and lightweight, and provides quite a bit of functionality. SpatiaLite is a spatial database management system (DBMS) built on top of SQLite, a lightweight personal DBMS.

Note

SpatiaLite (and thus, SQLite) is built on a personal architecture, which makes installation and management virtually nonexistent. The trade-off, however, is that it neither does a good job of supporting multiple concurrent connections nor does it support a client-server architecture. For a more complex DBMS, PostGIS is an excellent open source option.

We will create a new SpatiaLite database that we will use for the remaining exercises in this chapter; to do this, perform the following steps:

  1. Open QGIS Desktop and open the Browser panel. If the Browser panel is missing, click on Browser by navigating to View | Panels. In the Browser panel, you will find the SpatiaLite entry below your hard drive folders.
  2. Create a new SpatiaLite database by right-clicking on SpatiaLite and then choose Create database… (as shown in the following screenshot).
  3. Create a new folder on disk and save the new database as GiffordPinchot.sqlite. The newly created database will appear under the SpatiaLite database entry.
    Creating a spatial database

Now that we have a new SpatiaLite database, let's look at its initial structure and contents. To do this, we will use DB Manager, a built-in QGIS plugin. DB Manager provides a simple graphical interface to manage PostGIS and SpatiaLite databases. Using DB Manager, we will be able to view and manage our SpatiaLite database. Let's start by getting familiar with the DB Manager interface.

  1. Click on DB Manager under Database to open the DB Manager. The DB Manager interface (as shown in the following screenshot) is composed of four parts: menu bar, toolbar, tree view, and information panel.
  2. Navigate to SpatiaLite | GiffordPinochet.sqlite to see a tree listing of all tables, views, and general information about the database, as shown in in the following screenshot:
    Creating a spatial database

When a new SpatiaLite database is created, it is automatically populated with multiple tables and views. These tables and views hold records used by the DBMS to manage the structure and operation of the database. You should not modify or delete these tables or views unless you are absolutely sure of what you are doing.

主站蜘蛛池模板: 宁阳县| 宁阳县| 利津县| 汉川市| 巨野县| 登封市| 涞源县| 佛坪县| 景德镇市| 东辽县| 新闻| 合川市| 洞口县| 讷河市| 东乌| 津市市| 应用必备| 买车| 抚松县| 临颍县| 徐州市| 察雅县| 余干县| 嵩明县| 巍山| 临武县| 永胜县| 金乡县| 岢岚县| 临江市| 榆社县| 定襄县| 阿勒泰市| 买车| 水富县| 防城港市| 昌黎县| 九龙城区| 清河县| 岐山县| 延长县|