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

提供: OSGeo.JP Wiki
移動: 案内検索
(ページの作成: <H2> Query Builder </H2> <P> 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. Fo…)
 
(Query Builder)
 
(同じ利用者による、間の1版が非表示)
行1: 行1:
<H2>
+
=== Query Builder ===
Query Builder
+
<span id='sec:query_builder'></span>
</H2>
+
  
<P>
 
 
The Query Builder allows you to define a subset of a table and display
 
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.  
 
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
+
For example, if you have a {{Template:FileName|towns}} layer with a
population field you could select only larger towns by entering
+
{{Template:UserText|population}} field you could select only larger towns by entering
population &gt; 100000 in the SQL box of the query builder. Figure
+
{{Template:UserText|population > 100000}} in the SQL box of the query builder. Figure
<A HREF="#fig:query_builder">19</A> 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.  
  
<P>
+
<table align='center'>
 +
<caption>'''図 17:''' Query Builder {{Template:Nix}}</caption>
 +
<tr><td><span id='fig:query_builder'></span>
 +
    [[File:queryBuilder.png|435px]]</td></tr></table>
  
<DIV ALIGN="CENTER"><A NAME="fig:query_builder"></A><A NAME="850"></A>
+
The query builder lists the layer's database
<TABLE>
+
<CAPTION ALIGN="BOTTOM"><STRONG>Figure:</STRONG>
+
Query Builder </CAPTION>
+
<TR><TD>
+
<DIV ALIGN="CENTER">
+
</DIV>
+
<P></P>
+
<DIV ALIGN="CENTER">    [clip=true, width=11.5cm]queryBuilder
+
 
+
</DIV></TD></TR>
+
</TABLE>
+
</DIV>
+
 
+
<P>
+
The query builder<A NAME="855"></A> lists the layer's database
+
 
fields in the list box on the left. You can get a sample of the data
 
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<A NAME="857"></A>. This retrieves the first 25 distinct values
+
contained in the highlighted field by clicking on the {{Template:Button|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
 
for the field from the database. To get a list of all possible values for a
field, click on the All button<A NAME="859"></A>. To add a selected field or value to the query, double-click on
+
field, click on the {{Template:Button|All}} button. To add a selected field or value to the query, double-click on
it<A NAME="860"></A>. You can use the various buttons to
+
it. You can use the various buttons to
 
construct the query or you can just type it into the SQL box.
 
construct the query or you can just type it into the SQL box.
  
<P>
+
To test a query, click on the {{Template:Button|Test}} button. This will return a count of the number of records that will be
To test a query, click on the Test button<A NAME="862"></A>. This will return a count of the number of records that will be
+
included in the layer. When satisfied with the query, click {{Template:Button|OK}}. The
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.
 
SQL for the where clause will be shown in the SQL column of the layer list.
  
<P>
+
{{Template:Tip
<BR>
+
|num=xx
<IMG
+
|caption=Changing the Layer Definition
WIDTH="217" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
+
|qgistip=You can change the layer definition after it is loaded by altering
SRC="img18.png"
+
the SQL query used to define the layer. To do this, open the
ALT="\begin{Tip}
+
vector {{Template:Dialog|Layer Properties}} dialog by double-clicking on the layer in the legend and click on the
% latex2html id marker 864
+
{{Template:Button|Query Builder}} button on the {{Template:Tab|General}} tab. See Section
\caption{\textsc{Changing the Layer Defin...
+
[[sec:vectorprops]] for more information.
...General} tab. See Section
+
}}
\ref{sec:vectorprops} for more information.}
+
\end{Tip}">
+
<BR>
+

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.