「クエリビルダ」の版間の差分

提供: OSGeo.JP Wiki
移動: 案内検索
(タグ一括置換状態で一旦保存)
(Query Builder)
 
行7: 行7:
 
{{Template:UserText|population}} field you could select only larger towns by entering
 
{{Template:UserText|population}} field you could select only larger towns by entering
 
{{Template:UserText|population > 100000}} in the SQL box of the query builder. Figure
 
{{Template:UserText|population > 100000}} in the SQL box of the query builder. Figure
[[fig:query_builder]] shows an example of the query builder populated with
+
[[#fig:query_builder|17]] shows an example of the query builder populated with
 
data from a PostGIS layer with attributes stored in PostgreSQL.  
 
data from a PostGIS layer with attributes stored in PostgreSQL.  
  
 
<table align='center'>
 
<table align='center'>
<caption>'''Figure xx:''' Query Builder {{Template:Nix</caption>
+
<caption>'''図 17:''' Query Builder {{Template:Nix}}</caption>
<tr><td>}caption}<span id='fig:query_builder'></span>
+
<tr><td><span id='fig:query_builder'></span>
     [[File:queryBuilder.png]]</td></tr></table>
+
     [[File:queryBuilder.png|435px]]</td></tr></table>
  
 
The query builder lists the layer's database
 
The query builder lists the layer's database
行32: 行32:
 
|qgistip=You can change the layer definition after it is loaded by altering
 
|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  
 
the SQL query used to define the layer. To do this, open the  
vector {{Template:Dialog|Layer Properties} dialog by double-clicking on the layer in the legend and click on the
+
vector {{Template:Dialog|Layer Properties}} dialog by double-clicking on the layer in the legend and click on the
 
{{Template:Button|Query Builder}} button on the {{Template:Tab|General}} tab. See Section
 
{{Template:Button|Query Builder}} button on the {{Template:Tab|General}} tab. See Section
[[sec:vectorprops]] for more information.}
+
[[sec:vectorprops]] for more information.
 
}}
 
}}

2009年10月4日 (日) 19:32時点における最新版

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 17 shows an example of the query builder populated with data from a PostGIS layer with attributes stored in PostgreSQL.

図 17: Query Builder Nix.png
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.


Tip xx Changing the Layer Definition


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.