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

  • QGIS:Becoming a GIS Power User
  • Anita Graser Ben Mearns Alex Mandel Víctor Olaya Ferrero Alexander Bruy
  • 338字
  • 2021-07-09 19:32:36

Adding data to spatial databases

In Chapter 2, Viewing Spatial Data, we saw how to view data from spatial databases. Of course, we also want to be able to add data to our databases. This is where the DB Manager plugin comes in handy. DB Manager is installed by default, and you can find it in the Database menu (if DB Manager is not visible in the Database menu, you might need to activate it in Plugin Manager).

The Tree panel on the left-hand side of the DB Manager dialog lists all available database connections that have been configured so far. Since we have added a connection to the test-2.3.sqlite SpatiaLite database in Chapter 2, Viewing Spatial Data, this connection is listed in DB Manager, as shown in the next screenshot.

To add new data to this database, we just need to select the connection from the list of available connections and then go to Table | Import layer/file. This will open the Import vector layer dialog, where we can configure the import settings, such as the name of the Table we want to create as well as additional options, including the input data CRS (the Source SRID option) and table CRS (the Target SRID option). By enabling these CRS options, we can reproject data while importing it. In the example shown in the following screenshot, we import urban areas from a Shapefile and reproject the data from EPSG:4326 (WGS84) to EPSG:32632 (WGS 84 / UTM zone 32N), since this is the CRS used by the already existing tables:

Tip

A handy shortcut for importing data into databases is by directly dragging and dropping files from the main window Browser panel to a database listed in DB Manager. This even works for multiple selected files at once (hold down Ctrl on Windows/Ubuntu or cmd on Mac to select more than one file in the Browser panel). When you drop the files onto the desired database, an Import vector layer dialog will appear, where you can configure the import.

主站蜘蛛池模板: 天祝| 舞阳县| 滕州市| 巴塘县| 汉川市| 昌都县| 沂南县| 栖霞市| 义乌市| 宜春市| 岱山县| 米易县| 方山县| 桐柏县| 雅安市| 萨嘎县| 龙陵县| 若羌县| 东阿县| 泰兴市| 青龙| 灯塔市| 历史| 博乐市| 额济纳旗| 上思县| 彭阳县| 星子县| 鄂伦春自治旗| 茂名市| 台北市| 花莲市| 灵璧县| 定边县| 册亨县| 东源县| 邹城市| 广水市| 琼海市| 黄骅市| 宁河县|