クエリビルダ

提供: OSGeo.JP Wiki
2009年8月17日 (月) 20:32時点におけるKayama (トーク | 投稿記録)による版

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
移動: 案内検索

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 <A HREF="#fig:query_builder">19</A> shows an example of the query builder populated with data from a PostGIS layer with attributes stored in PostgreSQL. <P>

<A NAME="fig:query_builder"></A><A NAME="850"></A>
Figure: Query Builder

[clip=true, width=11.5cm]queryBuilder

<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 contained in the highlighted field by clicking on the Sample button<A NAME="857"></A>. 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<A NAME="859"></A>. 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 construct the query or you can just type it into the SQL box.

<P> 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 OK. The SQL for the where clause will be shown in the SQL column of the layer list.

<P>
<IMG

WIDTH="217" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
SRC="img18.png"
ALT="\begin{Tip}

% latex2html id marker 864 \caption{\textsc{Changing the Layer Defin... ...General} tab. See Section \ref{sec:vectorprops} for more information.} \end{Tip}">