• No results found

The manual can be used as a practical tutorial and aims to teach users how to:

N/A
N/A
Protected

Academic year: 2021

Share "The manual can be used as a practical tutorial and aims to teach users how to:"

Copied!
26
0
0

Loading.... (view fulltext now)

Full text

(1)

Introduction

This manual is aimed at users of the Rainforest Foundation UK's PostGIS database. It should be read by people wishing to upload and edit GPS survey data as well as by those who will administer the PostGIS database.

The manual can be used as a practical tutorial and aims to teach users how to: • Install the plugin

• Connect to the PostGIS database • View data from the database • Upload features to the database

• Populate and edit feature attributes in the database

This guide assumes that the audience is already familiar with basic Quantum GIS tasks such as creating shapefiles, editing table attributes etc.

(2)

In the following chapters, we'll be creating tables in the PostGIS database based on GPS point and track data surveyed in the field.

Each of the examples assumes that the user has already loaded their GPS data into QGIS, either directly using theGps Toolsplugin, or through theAdd Vector Layerdialog.

(3)

1.

Installing the plugin

IMPORTANT: If you already have a previous version of the plugin installed, uninstall it by removing the

rfuk_postgis_uploadfolder from your ~/.qgis/python/plugins folder and restarting QGIS.

The RFUK PostGIS Upload Plugin is located in a dedicated Quantum GIS python plugin repository. To install the plugin, we will first need to add the dedicated repository.

1. Open Quantum GIS

2. SelectFetch Python Plugins...from thePluginsmenu 3. Click theRepositoriestab

4. Click theAddbutton

5. Enter the details as shown in the image below and clickOK Name: RFUK Repositry

(4)

6. Click the Plugins tab

7. Typerfukin the filter box and select the plugin in the list:

8. ClickInstall plugin

A message should now be displayed to show that the plugin was successfully installed.

The plugin can be accessed through its icon,

By default, Quantum GIS will check for updates for plugins once a day. Quantum GIS will notify users when there is an update available for the plugin and prompt them to download and install it.

(5)

2.

Setting up PostGIS connections

In order the use RFUK's PostGIS database, you'll need to have been given a username and password. At present, a single login is used by each participating country. The username consists of the prefix

remote_followed by the name or abbreviation of the country. The following table shows a list of available usernames.

Country Username

Cameroon remote_cameroon

Central African Republic remote_car

Congo remote_congo

Democratic Republic of Congo remote_drc

Gabon remote_gabon

Each username will have the following levels of access to different types of data within the database. The wordcountryin the Dataset column should be replaced with the name of the country in which the surveyor is working.

Dataset Dataset Description Access

bg_country Background mapping specific to the country Read only bg_general Non country specific background mapping. These datasets

often cover multiple countries.

Read only

country_draft Survey data that has been uploaded and is in the process of being edited or is awaiting approval

Read / write

country_approved Survey data that has been finalised and approved Read only

It should be noted that surveyors have write access only to draft datasets. The following instructions will show how a PostGIS connection is created.

1. Open Quantum GIS and click theAdd PostGIS Layerbutton, TheAdd PostGIS Table(s)dialog should now be shown.

(6)

2. Click theNewbutton to configure a new connection.

(7)

3. Enter your username in theNameandUsernameentries and fill out the other entriesexactlyas shown above. Your password should have been provided by Rainforest Foundation UK.

4. ClickTest Connect

(8)

3.

Importing Data

The RFUK PostGIS Upload Plugin can be used to upload the following geometry types to the database:

 Points

 Multilinestrings

 Multipolygons

The plugin supports the upload of the following types of data:

 Villages (Point)

 External Actors (Point and Multipolygon)

 Livelihood and Cultural Activities (Point and Multipolygon)

 Natural Features (Point and Multipolygon)

 Routes and Local Rivers (Point and Multilinestring)

For more information on the types of data that can be uploaded to the database and their supported attributes, refer to theRFUK PostGIS Table Attribute Standard (version 008).

3.1

Overview of the process

When the RFUK PostGIS Upload Plugin's Upload button is clicked, the plugin does the following:

 Checks that the input layer is a vector layer

 Checks that the input layer is in WGS84 Lat/Lon projection

 Checks that some features are selected

 Checks that the table name matches the data type

 Connects to the PostGIS database and creates a new, empty PostGIS table with the correct attributes for the data type

 Copies each selected feature into the PostGIS database, re-projecting each feature to a sensible projection for the given country and copies any relevant data from the GPS survey into the correct columns of the database

3.2

Selecting features

In order to upload to the database using the RFUK PostGIS Upload Plugin, features to be uploaded will first need to be selected. Selection can be performed by one of the following methods:

3.2.1 Manual selection (within Quantum GIS)

(9)

3.2.2 Select by attributes (within Quantum GIS)

Features can be selected based on their attributes using thesearchoradvanced searchoptions in a layer's Attribute Table dialog.

3.2.3 Select all (within the RFUK PostGIS Upload Plugin)

The Select All button will select all features in the current layer.

3.2.4 Select based on dates (within the RFUK PostGIS Upload Plugin)

The select based on dates feature allows the user to select features based on the GPS date stamp present in layers loaded directly from GPS devices or GPX files. This feature could be used, for example, to quickly select survey data from a particular day from a much larger collection of survey information.

It is important to note that GPS time stamps will be in universal time (UTC) where the dates used for selection entered by the user are in local time.

3.3

3.4

Uploading data – an example

According to theRFUK PostGIS Table Attribute Standard (version 008), points can be used to represent villages, external actors, livelihood activities and cultural activities, natural features and routes.

In this example, we'll add two surveyed villages, Carefour and Ngamakossou, from a GPS file containing multiple surveyed points.

(10)
(11)

Zoom in to ensure that the selection is correct

(12)
(13)

The dialog consists of controls associated with the upload of the data as well as controls associated with the selection of data to be uploaded.

The selection tools allow the user to select features based on the date they were surveyed. This method of selection requires that the survey date is included in the comment attribute by the GPS device (it usually is). If the plugin cannot find the date in the comment attribute for some features, a warning will be issued to the user.

(14)

The upload controls allow the user to specify options relating to how the data should be inserted into the database.

The first option is the PostGIS connection to use for the upload. It is important that the correct connection is used for a given country as the name of the schema that the data will be uploaded to is derived from the connection name. In this case we are uploading data located in Congo, so are using theremote_congoPostGIS connection.

The next option describes the type of data we are uploading. In this case, the points being uploaded are villages, so we have chosen the Villages option. The data types correspond to theRFUK PostGIS Table Attribute Standard (version 008).

The next option is the name to give the new PostGIS layer. Layer names can contain only lower case letters, numbers and underscores (the '_' character). The RFUK database specification specifies a naming convention for PostGIS layers enabling them to be easily identified. The name prefixes required for different data types are described below.

(15)

Data Type Table name prefix

Villages v__

External Actors ea__

Livelihood Activities la__ Cultural Activities ca__

Natural Features nf__

Routes or Local Rivers rr__

3. Ensure that thePostGIS Connectionis set to remote_congo, theType of Datais set to Villages and enter a name for the new layer, such as v__test_layer_001

4. ClickUpload

(16)

5. Next, open the attribute table of the PostGIS layer using theOpen Attribute Tablebutton,

The table attributes for the two imported points should now be visible(your attributes may differ slightly

from the image below).

It can be seen that information from the GPS data has been copied to the database, such as the name of the waypoint and the date the waypoint was surveyed.

Additional attributes such as the population of adult males and females has not been automatically populated. This data will need to be entered manually from within Quantum GIS.

(17)

4.

Loading PostGIS survey layers

In this chapter, the user will learn how to view survey data that already exists in the PostGIS database.

PostGIS layers are loaded using theAdd PostGIS Layerbutton,

1. Click theAdd PostGIS Layerbutton to open theAdd PostGIS Table(s)dialog

2. Ensure that the remote_congo connection is selected and clickConnect

A list of PostGIS layers should now be displayed.

Layers are grouped into containers called schemas. Background data will be located in schemas starting withbg_while survey data will be located in schemas prefixed with the name of the country associated with the data.

Background data relevant to multiple countries will be located in the bg_general schema while, for example, background data specific to congo will be located in the bg_congo schema.

(18)

example, we'll be uploading data to the congo_draft schema. Surveyors in Congo have read/write access to the congo_draft schema.

Once layers have been reviewed and finalised by Rainforest Foundation UK, they will be moved from the _draft schema to the _approved schema. Surveyors in Congo have read only access to the

congo_approved schema.

3. Select the layer v__test_layer_001 and click Add The layer should now be loaded.

(19)

5.

Uploading polygon data

Polygons may be added to the PostGIS database for the External Actors, Livelihood Activities, Cultural Activities and Natural Features data types.

It is assumed that GPS track data will be used to define a polygon in Quantum GIS which will then be uploaded to the PostGIS database. This is demonstrated in the following example where a track around a lake is used to define a polygon.

A track can bee seen in the image above representing the shore of a lake.

In order to import the lake into the PostGIS database, we must first create a polygon from the track which in currently a polyline.

1. Create a new shapefile by using theNew Shapefile Layerbutton,

2. Ensure the shapefile is set to contain polygons and is in WGS84 Latitude/Longitude (EPSG code 4326).

(20)

If the table contains a text attribute called name, the contents of this attribute will be used to update the name of the feature in the PostGIS database.

3. Save the new shapefile in a sensible location.

Next we must digitise the polygon representing the lake, using the track as a guide. Quantum GIS's snapping feature is very useful to ensure that the new polygon follows the surveyed shore of the lake. 4. Digitise the lake polygon and optionally, give it name by filling out the name attribute.

(21)

5. Save the polygon shapefile.

With the polygon layer selected, the user should be able to upload the polygon to the PostGIS database as was done previously in the villages example.

(22)

6.

Editing PostGIS Layer attributes

Once features have been uploaded to the database, their extended attributes can be populated / edited. PostGIS layer attributes can be edited in the normal way in Quantum GIS using theOpen Attribute

Tablebutton, , or through theEdit Featureform which is available through a right click on the

Identifyform.

TheRFUK PostGIS Table Attribute Standard (version 008)lists a complete set of available attributes for each data type along with a human-readable description.

6.1

Enumerations

Some attributes are set as enumerations. One example of this is the village layer'sinvolvedattribute. Enumerated types may only be set to one of a pre-defined set of values. In the above example, the village layer'sinvolvedattribute can only be set to one of the following values:

 UNSET (no value has been set yet)

 yes

 no

The value of an enumerated attribute can either be typed in manually (it will have to be typed exactly), or can be set using one of Quantum GIS' advanced attribute editing features as described below. A full list of the enumerated types used in the RFUK PostGIS database can be found in theRFUK PostGIS Table Attribute Standard (version 008).

6.1.1 Enabling enumeration drop-down menus

The following instructions describe how to make entering enumerated attribute values easier by enabling drop-down lists.

1. Open the layer'sLayer Propertiesdialog 2. Select theAttributestab

3. For each attribute with a type starting with “enum_”, change the edit widget fromLine editto

(23)

4. Click OK to close theLayer Propertiesdialog.

(24)
(25)

7.

Deleting PostGIS Layers

Layers in_draftschemas can be deleted using thePostGIS Managerplugin.

Please treat this email as sensitive information as it contains the usernames and passwords for

the surveyors (be aware of accidentally forwarding this or replies with quoted text to

un-trusted parties).

I'm happy to announce that the beta version of the RFUK PostGIS Upload Plugin is now complete

and I've set up a Quantum GIS python plugin repository for it on your VPS (hosting). The

docu-mentation (in english) is attached which explains how to install and use the plugin as well as how to

access and modify data in the PostGIS database.

I expected you might want to translate the docs into French so I've passed an editable version.

I've also attached version 008 of the table attribute standard which has very slight modifications

from the last one you sent to us (such as shortening some of the additional attribute names to 10

characters to stay in-line with the ESRI Shapefile standard).

Feel free to start using the database to upload new survey information to the database.

If, in a few weeks, once people have been using the plugin for their work, there are no reported

problems, we can consider the plugin as a release (completed) version, rather than a beta version.

The usernames and passwords for the surveyors are as follows:

Cameroon

remote_cameroon

ofG3ctyg5H

Central African Republic

remote_car

cLoRxiofr0

Congo

remote_congo

utZaYsJbMk

Democratic Republic of Congo

remote_drc

h2OXuzhC5X

Gabon

remote_gabon

moZ21O9ObV

(26)

handjagt

Bigbluesea77

References

Related documents

An analysis of the economic contribution of the software industry examined the effect of software activity on the Lebanese economy by measuring it in terms of output and value

The others (e.g. Playing Videos, adding the shutdown button) are not crucial to the camera project but can be done if you’re also interested in exploring these capabilities.

The FSC logo, the initials ‘FSC’ and the name ‘Forest Stewardship Council’ are registered trademarks, and therefore a trademark symbol must accompany the.. trademarks in

Figure 1 illustrates the proposed hybrid adaptive flight control. The control architecture com- prises: 1) a reference model that translates a rate command into a desired

© 2014 Diane E. The views expressed in this Article are solely those of the author and do not necessarily reflect the views of Arnold & Porter LLP or any of its clients. Thanks

For female children, the disparities across ethnic groups in drop-out rates in grade 0 are even wider: 1.4 percent of ethnic Turkish girls do not complete first grade whereas

The activity described below aims to teach high-intermediate and advanced learners of English how to understand American housing ads.. The main target group is members of the

The purpose of this study was to evaluate the diagnostic utility of real-time elastography (RTE) in differentiat- ing between reactive and metastatic cervical lymph nodes (LN)