クエリビルダ

提供: OSGeo.JP Wiki
2009年10月4日 (日) 19:28時点におけるSanak (トーク | 投稿記録)による版

移動: 案内検索

Query Builder

The Query Builder allows you to define a subset of a table and display it as a layer in QGIS. It can currently only be used with PostGIS layers. For example, if you have a towns layer with a population field you could select only larger towns by entering population > 100000 in the SQL box of the query builder. Figure fig:query_builder shows an example of the query builder populated with data from a PostGIS layer with attributes stored in PostgreSQL.

Figure xx: Query Builder {{Template:Nix
}caption} QueryBuilder.png

The query builder lists the layer's database fields in the list box on the left. You can get a sample of the data contained in the highlighted field by clicking on the Sample button. This retrieves the first 25 distinct values for the field from the database. To get a list of all possible values for a field, click on the All button. To add a selected field or value to the query, double-click on it. You can use the various buttons to construct the query or you can just type it into the SQL box.

To test a query, click on the Test button. This will return a count of the number of records that will be included in the layer. When satisfied with the query, click OK. The SQL for the where clause will be shown in the SQL column of the layer list.

{{Template:Tip |num=xx |caption=Changing the Layer Definition |qgistip=You can change the layer definition after it is loaded by altering the SQL query used to define the layer. To do this, open the vector Layer Properties} dialog by double-clicking on the layer in the legend and click on the Query Builder button on the General tab. See Section sec:vectorprops for more information.}