「ベクタプロパティ ダイアログ」の版間の差分

提供: OSGeo.JP Wiki
移動: 案内検索
(タグ・画像調整前に一旦配下を統合)
(タグ一括置換状態(%コメントのみ調整)で一旦保存)
行1: 行1:
==The Vector Properties Dialog==
+
=== The Vector Properties Dialog ===
 +
<span id='sec:vectorprops'></span>
  
 
The {{Template:Dialog|Layer Properties}} dialog for a vector layer  
 
The {{Template:Dialog|Layer Properties}} dialog for a vector layer  
行11: 行12:
 
layer and select {{Template:DropMenuOpt|Properties}} from the popup menu.
 
layer and select {{Template:DropMenuOpt|Properties}} from the popup menu.
  
{{Template:Figure|num=8|caption=Vector Layer Properties Dialog|fname=VectorLayerSymbology|width=520px}}
+
<table align='center'>
 +
<caption>'''Figure xx:''' Vector Layer Properties Dialog {{Template:Nix</caption>
 +
<tr><td>}caption}<span id='fig:vector_symbology'></span>
 +
  [[File:vectorLayerSymbology.png|454px]]</td></tr></table>
  
<H3>
+
==== General Tab ====
General Tab
+
<span id='vectorgeneraltab'></span>
</H3>
+
The {{Template:Tab|General}} tab is essentially like that of the raster dialog. It allows you
The General tab is essentially like that of the raster dialog. It allows you
+
 
to change the display name, set scale dependent rendering options, create a spatial  
 
to change the display name, set scale dependent rendering options, create a spatial  
 
index of the vector file (only for OGR supported formats and PostGIS) and view or
 
index of the vector file (only for OGR supported formats and PostGIS) and view or
 
change the projection of the specific vetor layer.
 
change the projection of the specific vetor layer.
  
<P>
+
The {{Template:Button|Query Builder}} button allows you to create a subset of the features  
The Query Builder button allows you to create a subset of the features  
+
 
in the layer - but this button currently only is available when you open the  
 
in the layer - but this button currently only is available when you open the  
attribute table and select the ... button next to Advanced search.
+
attribute table and select the {{Template:Button|...}} button next to Advanced search.
  
<P>
+
==== Symbology Tab ====
<BR><HR>
+
<span id='sec:symbology'></span>
  
<H3>
 
Symbology Tab
 
</H3>
 
 
<P>
 
 
QGIS supports a number of symbology renderers to control how
 
QGIS supports a number of symbology renderers to control how
 
vector features are displayed. Currently the following renderers
 
vector features are displayed. Currently the following renderers
 
are available:
 
are available:
  
<P>
+
<dl>  
<DL>
+
    <dt>Single symbol<dl> - a single style is applied to every
<DT><STRONG>Single symbol</STRONG>
+
    object in the layer.
<DD>- a single style is applied to every object in the layer.<A NAME="321"></A>
+
     <dt>Graduated symbol<dl> - objects within the layer are
      
+
</DD>
+
<DT><STRONG>Graduated symbol</STRONG>
+
<DD>- objects within the layer are
+
 
     displayed with different symbols classified by the values of a
 
     displayed with different symbols classified by the values of a
     particular field.<A NAME="322"></A>
+
     particular field.
      
+
     <dt>Continuous color<dl> - objects within the layer are
</DD>
+
<DT><STRONG>Continuous color</STRONG>
+
<DD>- objects within the layer are
+
 
     displayed with a spread of colours classified by the numerical
 
     displayed with a spread of colours classified by the numerical
     values within a specified field.<A NAME="323"></A>
+
     values within a specified field.
      
+
     <dt>Unique value<dl> - objects are classified by the unique
</DD>
+
<DT><STRONG>Unique value</STRONG></DT>
+
<DD>- objects are classified by the unique
+
 
     values within a specified field with each value having a
 
     values within a specified field with each value having a
     different symbol.<A NAME="324"></A>
+
     different symbol.
 
+
</dl>
  
<P>
 
 
To change the symbology for a layer, simply double click on its legend  
 
To change the symbology for a layer, simply double click on its legend  
entry and the vector Layer Properties dialog will be  
+
entry and the vector {{Template:Dialog|Layer Properties}} dialog will be  
shown.<A NAME="327"></A>
+
shown.
  
<P>
+
<table align='center'>
 +
<caption>'''Figure xx:''' Symbolizing-options {{Template:Nix</caption>
 +
<tr><td>}caption}
 +
  <table align='center'><caption align='bottom'>(x) Single symbol</caption><tr><td><span id='subfig:single_symbol'></span>[[File:vectorClassifySingle.png|296px]]</td></tr></table>
 +
  <table align='center'><caption align='bottom'>(x) Graduated symbol</caption><tr><td><span id='subfig:graduated_symbol'></span>[[File:vectorClassifyGraduated.png|296px]]</td></tr></table><br>
 +
  <table align='center'><caption align='bottom'>(x) Continous color</caption><tr><td><span id='subfig:cont_color'></span>[[File:vectorClassifyContinous.png|296px]]</td></tr></table>
 +
  <table align='center'><caption align='bottom'>(x) Unique value</caption><tr><td><span id='subfig:unique_val'></span>[[File:vectorClassifyUnique.png|296px]]</td></tr></table>
 +
</td></tr></table>
  
<DIV ALIGN="CENTER"><A NAME="subfig:single_symbol"></A><A NAME="subfig:graduated_symbol"></A><A NAME="subfig:cont_color"></A><A NAME="subfig:unique_val"></A><A NAME="329"></A>
 
<TABLE>
 
<CAPTION ALIGN="BOTTOM"><STRONG>Figure:</STRONG>
 
Symbolizing-options </CAPTION>
 
<TR><TD>
 
<DIV ALIGN="CENTER">
 
  
</DIV>
+
===== Style Options =====
  [Single symbol] [clip=true, width=0.4]vectorClassifySingle
+
<span id='sec:style_options'></span>
  [Graduated symbol] [clip=true, width=0.4]vectorClassifyGraduated
+
<BR>  [Continous color] [clip=true, width=0.4]vectorClassifyContinous
+
  [Unique value] [clip=true, width=0.4]vectorClassifyUnique</TD></TR>
+
</TABLE>
+
</DIV>
+
  
<P>
 
Style Options <A NAME="sec:style_options"></A> <A NAME="341"></A>
 
 
Within this dialog you can style your vector layer. Depending on the selected
 
Within this dialog you can style your vector layer. Depending on the selected
 
rendering option you have the possibility to also classify your mapfeatures.
 
rendering option you have the possibility to also classify your mapfeatures.
  
<P>
 
 
At least the following styling options apply for nearly all renderers:
 
At least the following styling options apply for nearly all renderers:
<DL>
+
<dl>
<DT><STRONG>Outline style</STRONG></DT>
+
<dt>Outline style<dl> - pen-style for your outline of your feature. you can
<DD>- pen-style for your outline of your feature. you can
+
 
  also set this to 'no pen'.
 
  also set this to 'no pen'.
   
+
  <dt>Outline color<dl> - color of the ouline of your feature
</DD>
+
  <dt>Outline width<dl> - width of your features
<DT><STRONG>Outline color</STRONG></DT>
+
  <dt>Fill color<dl> - fill-color of your features.
<DD>- color of the ouline of your feature
+
  <dt>Fill style<dl> - Style for filling. Beside the given brushes you can
   
+
  select {{Template:SelectString|Fill style|? texture}} and click the {{Template:BrowseButton}}
</DD>
+
<DT><STRONG>Outline width</STRONG></DT>
+
<DD>- width of your features
+
   
+
</DD>
+
<DT><STRONG>Fill color</STRONG></DT>
+
<DD>- fill-color of your features.
+
   
+
</DD>
+
<DT><STRONG>Fill style</STRONG></DT>
+
<DD>- Style for filling. Beside the given brushes you can
+
  select Fill style? texture and click the  
+
 
  button for selecting your own fill-style. Currently the fileformats
 
  button for selecting your own fill-style. Currently the fileformats
  *.jpeg, *.xpm, and *.png are supported.
+
  {{Template:FileName|*.jpeg, *.xpm, and *.png}} are supported.
</DD>
+
</dl>
</DL>
+
  
<P>
 
 
Once you have styled your layer you also could save your layer-style to a
 
Once you have styled your layer you also could save your layer-style to a
separate file (with *.qml-ending).
+
separate file (with {{Template:FileName|*.qml}}-ending).
To do this, use the button Save Style .... No need to say that
+
To do this, use the button {{Template:Button|Save Style ...}}. No need to say that
Load Style ... loads your saved layer-style-file.
+
{{Template:Button|Load Style ...}} loads your saved layer-style-file.
  
<P>
 
 
If you wish to always use a particular style whenever the layer is loaded,  
 
If you wish to always use a particular style whenever the layer is loaded,  
use the Save As Default button to make your style the default. Also,  
+
use the {{Template:Button|Save As Default}} button to make your style the default. Also,  
if you make changes to the style that you are not happy with, use the Restore  
+
if you make changes to the style that you are not happy with, use the {{Template:Button|Restore  
Default Styel button to revert to your default style.
+
Default Styel}} button to revert to your default style.
  
<P>
+
===== Vector transparency =====
Vector transparency <A NAME="sec:vect_transparency"></A> <A NAME="354"></A>
+
<span id='sec:vect_transparency'></span>
QGIS allows to set a transparency for every vector layer. This can be done with
+
QGIS \CURRENT allows to set a transparency for every vector layer. This can be done with
the slider Transparency020mm inside the symbology tab (see fig. <A HREF="node15.html#fig:vector_symbology">10</A>).
+
the slider {{Template:Slider|Transparency|0|20mm}} inside the {{Template:Tab|symbology}} tab (see fig. [[fig:vector_symbology]]).
 
This is very useful for overlaying several vector layers.
 
This is very useful for overlaying several vector layers.
  
<P>
+
==== Metadata Tab ====
  
<H3>
+
The {{Template:Tab|Metadata}} tab contains information about the layer, including specifics
Metadata Tab
+
</H3>
+
 
+
 
+
The Metadata tab contains information about the layer, including specifics
+
 
about the type and location, number of features, feature type, and the editing
 
about the type and location, number of features, feature type, and the editing
capabilities. The Layer Spatial Reference System section, providing  
+
capabilities. The {{Template:GuiHeading|Layer Spatial Reference System}} section, providing  
projection information, and the Attribute field info section,
+
projection information, and the {{Template:GuiHeading|Attribute field info}} section,
 
listing fields and their data types, are displayed  
 
listing fields and their data types, are displayed  
 
on this tab. This is a quick way to get information about the layer.
 
on this tab. This is a quick way to get information about the layer.
  
<H3>
+
==== Labels Tab ====
Labels Tab
+
</H3>
+
  
<P>
+
The {{Template:Tab|Labels}} tab allows you to enable labeling features and control a number of
The Labels tab allows you to enable labeling features and control a number of
+
 
options related to fonts, placement, style, alignment and buffering.
 
options related to fonts, placement, style, alignment and buffering.
  
<P>
 
 
We will illustrate this by labelling the lakes shapefile of the
 
We will illustrate this by labelling the lakes shapefile of the
qgis_example_dataset:
+
{{Template:FileName|qgis_example_dataset}}:
  
<P>
+
<ol>
 
+
<li>Load the Shapefile {{Template:FileName|alaska.shp}} and GML file {{Template:FileName|lakes.gml}} in QGIS.
<OL>
+
<li>Zoom in a bit to your favorite area with some lake.
<LI>Load the Shapefile alaska.shp and GML file lakes.gml in QGIS.
+
<li>Make the {{Template:FileName|lakes}} layer active.
</LI>
+
<li>Open the {{Template:Dialog|Layer Properties}} dialog.
<LI>Zoom in a bit to your favorite area with some lake.
+
<li>Click on the {{Template:Tab|Labels}} tab.
</LI>
+
<li>Check the {{Template:CheckBox|Display labels}} checkbox to enable labeling.
<LI>Make the lakes layer active.
+
<li>Choose the field to label with.  
</LI>
+
   We'll use {{Template:SelectString|Field containing label|NAMES}}.
<LI>Open the Layer Properties dialog.
+
<li>Enter a default for lakes that have no name. The default label will be
</LI>
+
   used each time QGIS encounters a lake with no value in the {{Template:GuiLabel|NAMES}} field.
<LI>Click on the Labels tab.
+
<li>If have labels extending over several lines, check {{Template:CheckBox|Multiline labels?}}.  
</LI>
+
<LI>Check the Display labels checkbox to enable labeling.
+
</LI>
+
<LI>Choose the field to label with.  
+
   We'll use Field containing labelNAMES.
+
</LI>
+
<LI>Enter a default for lakes that have no name. The default label will be
+
   used each time QGIS encounters a lake with no value in the NAMES field.
+
</LI>
+
<LI>If have labels extending over several lines, check Multiline labels?.  
+
 
QGIS will check for a true line return in your label field and insert the line breaks accordingly.
 
QGIS will check for a true line return in your label field and insert the line breaks accordingly.
A true line return is a <SPAN  CLASS="textbf">single</SPAN> character &#92;n,  
+
A true line return is a '''single''' character \n,  
(not two separate characters, like a backlash &#92;&nbsp;followed by the character n).
+
(not two separate characters, like a backlash \~followed by the character n).
</LI>
+
<li>Click {{Template:Button|Apply}}.
<LI>Click Apply.
+
</ol>  
</LI>
+
</OL>  
+
  
<P>
 
 
Now we have labels. How do they look? They are probably too big and poorly
 
Now we have labels. How do they look? They are probably too big and poorly
 
placed in relation to the marker symbol for the lakes.
 
placed in relation to the marker symbol for the lakes.
  
<P>
+
Select the {{Template:Tab|Font}} entry and use the {{Template:Button|Font}} and {{Template:Button|Color}}
Select the Font entry and use the Font and Color
+
 
buttons to set the font and color. You can also change the angle and the
 
buttons to set the font and color. You can also change the angle and the
 
placement of the text-label.
 
placement of the text-label.
  
<P>
 
 
To change the position of the text relative to the feature:
 
To change the position of the text relative to the feature:
  
<P>
+
<ol>  
 
+
<li>Click on the {{Template:Tab|Font}} entry.
<OL>
+
<li>Change the placement by selecting one of the radio buttons
<LI>Click on the Font entry.
+
in the {{Template:ClassName|Placement}} group. To fix our labels, choose the
</LI>
+
{{Template:RadioButtonOn|Right}} radio button.
<LI>Change the placement by selecting one of the radio buttons
+
<li>the {{Template:ClassName|Font size units}} allows you to select between
in the Placement group. To fix our labels, choose the
+
{{Template:RadioButtonOn|Points}} or {{Template:RadioButtonOn|Map units}}.
Right radio button.
+
<li>Click {{Template:Button|Apply}} to see your changes without closing the dialog.
</LI>
+
</ol>  
<LI>the Font size units allows you to select between
+
Points or Map units.
+
</LI>
+
<LI>Click Apply to see your changes without closing the dialog.
+
</LI>
+
</OL>  
+
  
<P>
 
 
Things are looking better, but the labels are still too close to the marker. To
 
Things are looking better, but the labels are still too close to the marker. To
fix this we can use the options on the Position entry. Here we can add
+
fix this we can use the options on the {{Template:Tab|Position}} entry. Here we can add
 
offsets for the X and Y directions. Adding an X offset of 5 will move our
 
offsets for the X and Y directions. Adding an X offset of 5 will move our
 
labels off the marker and make them more readable. Of course if your marker
 
labels off the marker and make them more readable. Of course if your marker
 
symbol or font is larger, more of an offset will be required.
 
symbol or font is larger, more of an offset will be required.
  
<P>
+
The last adjustment we'll make is to {{Template:Tab|buffer}} the labels. This just means
The last adjustment we'll make is to buffer the labels. This just means
+
 
putting a backdrop around them to make them stand out better. To buffer the
 
putting a backdrop around them to make them stand out better. To buffer the
 
lakes labels:
 
lakes labels:
  
<P>
+
<ol>
 
+
<li>Click the {{Template:Tab|Buffer}} tab.
<OL>
+
<li>Click the {{Template:CheckBox|Buffer Labels?}} checkbox to enable buffering.
<LI>Click the Buffer tab.
+
<li>Choose a size for the buffer using the spin box.
</LI>
+
<li>Choose a color by clicking on {{Template:Button|Color}} and choosing your
<LI>Click the Buffer Labels? checkbox to enable buffering.
+
</LI>
+
<LI>Choose a size for the buffer using the spin box.
+
</LI>
+
<LI>Choose a color by clicking on Color and choosing your
+
 
   favorite from the color selector. You can also set some transparency for the
 
   favorite from the color selector. You can also set some transparency for the
 
   buffer if you prefer.
 
   buffer if you prefer.
</LI>
+
<li>Click {{Template:Button|Apply}} to see if you like the changes.
<LI>Click Apply to see if you like the changes.
+
</ol>  
</LI>
+
</OL>  
+
  
<P>
 
 
If you aren't happy with the results, tweak the settings and then test again
 
If you aren't happy with the results, tweak the settings and then test again
by clicking Apply.
+
by clicking {{Template:Button|Apply}}.
  
<P>
 
 
A buffer of 1 points seems to give a good result.
 
A buffer of 1 points seems to give a good result.
 
Notice you can also specify the buffer size in map units if that works out
 
Notice you can also specify the buffer size in map units if that works out
 
better for you.
 
better for you.
  
<P>
+
The remaining entries inside the {{Template:Tab|Label}} tab allow you control the appearance of the
The remaining entries inside the Label tab allow you control the appearance of the
+
labels using attributes stored in the layer. The entries beginning with {{Template:Tab|Data defined}} allow you to
labels using attributes stored in the layer. The entries beginning with Data defined allow you to
+
 
set all the parameters for the labels using fields in the layer.
 
set all the parameters for the labels using fields in the layer.
  
<P>
+
Not that the {{Template:Tab|Label}} tab provides a {{Template:ClassName|preview-box}} where your
Not that the Label tab provides a preview-box where your
+
 
selected label is shown.
 
selected label is shown.
  
<H3>
+
==== Actions Tab ====
Actions Tab
+
<span id='label_actions'></span>
</H3>
+
  
<P>
 
 
QGIS provides the ability to perform an action based on the attributes of a
 
QGIS provides the ability to perform an action based on the attributes of a
 
feature. This can be used to perform any number of actions, for example,
 
feature. This can be used to perform any number of actions, for example,
行276: 行194:
 
passing parameters to a web reporting tool.
 
passing parameters to a web reporting tool.
  
<P>
 
 
Actions are useful when you frequently want to run an external application or
 
Actions are useful when you frequently want to run an external application or
 
view a web page based on one or more values in your vector layer. An example
 
view a web page based on one or more values in your vector layer. An example
行282: 行199:
 
the following discussion.
 
the following discussion.
  
<P>
+
===== Defining Actions =====
Defining Actions<A NAME="410"></A>
+
  
<P>
+
Attribute actions are defined from the vector {{Template:Dialog|Layer Properties}} dialog. To
Attribute actions are defined from the vector Layer Properties dialog. To
+
define an action, open the vector {{Template:Dialog|Layer Properties}} dialog and click on the
define an action, open the vector Layer Properties dialog and click on the
+
{{Template:Tab|Actions}} tab. Provide a descriptive name for the action. The action
Actions tab. Provide a descriptive name for the action. The action
+
 
itself must contain the name of the application that will be executed when the
 
itself must contain the name of the application that will be executed when the
 
action is invoked. You can add one or more attribute field values as arguments
 
action is invoked. You can add one or more attribute field values as arguments
 
to the application. When the action is invoked any set of characters that
 
to the application. When the action is invoked any set of characters that
 
start with a % followed by the name of a field will be replaced by the value of
 
start with a % followed by the name of a field will be replaced by the value of
that field. The special characters %% <A NAME="414"></A>will be replaced by the value
+
that field. The special characters %% will be replaced by the value
 
of the field that was selected from the identify results or attribute table (see
 
of the field that was selected from the identify results or attribute table (see
 
Using Actions below).  Double quote marks can be used to group text into a
 
Using Actions below).  Double quote marks can be used to group text into a
行299: 行214:
 
ignored if preceded by a backslash.
 
ignored if preceded by a backslash.
  
<P>
+
If you have field names that are substrings of other field names (e.g., {{Template:UserText|col1}}
If you have field names that are substrings of other field names (e.g., col1
+
and {{Template:UserText|col10}}) you should
and col10) you should
+
 
indicate so, by surrounding the field name (and the % character) with square
 
indicate so, by surrounding the field name (and the % character) with square
brackets (e.g., [%col10]). This will prevent the %col10 field
+
brackets (e.g., {{Template:UserText|[%col10]}). This will prevent the {{Template:UserText|%col10}} field
name being mistaken for the %col1 field name with a 0
+
name being mistaken for the {{Template:UserText|on the end. The brackets will be removed by QGIS when it substitutes in the
 +
value of the field. If you want the substituted field to be surrounded by square
 +
brackets, use a second set like this: {{Template:UserText|%col1}} field name with a {{Template:Usertext|0}}
 
on the end. The brackets will be removed by QGIS when it substitutes in the
 
on the end. The brackets will be removed by QGIS when it substitutes in the
 
value of the field. If you want the substituted field to be surrounded by square
 
value of the field. If you want the substituted field to be surrounded by square
brackets, use a second set like this: [[%col10]].
+
brackets, use a second set like this: {{Template:Usertext|[[%col10]]}}.
  
<P>
+
The {{Template:Dialog|Identify Results}} dialog box includes a ''(Derived)'' item that
The Identify Results dialog box includes a <EM>(Derived)</EM> item that
+
 
contains information relevant to the layer type. The
 
contains information relevant to the layer type. The
 
values in this item can be accessed in a similar way to the other fields
 
values in this item can be accessed in a similar way to the other fields
by using preceeding the derived field name by (Derived).. For
+
by using preceeding the derived field name by {{Template:UserText|(Derived).}}. For
example, a point layer has an X and Y field and the
+
example, a point layer has an {{Template:UserText|X}} and {{Template:UserText|Y}} field and the
value of these can be used in the action with %(Derived).X and
+
value of these can be used in the action with {{Template:UserText|%(Derived).X}} and
%(Derived).Y. The derived attributes are only available from the
+
{{Template:UserText|%(Derived).Y}}. The derived attributes are only available from the
Identify Results dialog box, not the Attribute Table dialog box.
+
{{Template:Dialog|Identify Results}} dialog box, not the {{Template:Dialog|Attribute Table}} dialog box.
 
+
<P>
+
Two example actions are shown below:<A NAME="431"></A>
+
  
<P>
+
Two example actions are shown below:
  
<UL>
+
<ul>
<LI>konqueror http://www.google.com/search?q=%nam
+
<li>{{Template:UserText|konqueror http://www.google.com/search?q=%nam
</LI>
+
<li>{{Template:UserText|konqueror http://www.google.com/search?q=%%
<LI>konqueror http://www.google.com/search?q=%%
+
</ul>
</LI>
+
</UL>
+
  
<P>
 
 
In the first example, the web browser konqueror is invoked and passed a URL to
 
In the first example, the web browser konqueror is invoked and passed a URL to
open. The URL performs a Google search on the value of the nam field
+
open. The URL performs a Google search on the value of the {{Template:UserText|nam}} field
 
from our vector layer. Note that the application or script called by the
 
from our vector layer. Note that the application or script called by the
 
action must be in the path or you must provided the full path. To be sure, we could
 
action must be in the path or you must provided the full path. To be sure, we could
rewrite the first example as: /opt/kde3/bin/konqueror
+
rewrite the first example as: {{Template:UserText|/opt/kde3/bin/konqueror
http://www.google.com/search?q=%nam. This will ensure that the konqueror
+
http://www.google.com/search?q=%nam}}. This will ensure that the konquerorapplication will be executed when the action is invoked.
application will be executed when the action is invoked.
+
  
<P>
 
 
The second example uses the %% notation which does not rely on a particular
 
The second example uses the %% notation which does not rely on a particular
 
field for its value. When the action is invoked, the %% will be replaced by
 
field for its value. When the action is invoked, the %% will be replaced by
 
the value of the selected field in the identify results or attribute table.
 
the value of the selected field in the identify results or attribute table.
  
<P>
+
===== Using Actions =====
Using Actions<A NAME="439"></A><A NAME="label_usingactions"></A>Actions can be invoked from either the Identify Results dialog or an
+
<span id='label_usingactions'></span>
  Attribute Table dialog.  
+
Actions can be invoked from either the {{Template:Dialog|Identify Results}} dialog or an
 +
  {{Template:Dialog|Attribute Table}} dialog.  
 
(Recall that these dialogs can be opened by clicking
 
(Recall that these dialogs can be opened by clicking
mActionOpenTableIdentify Features
+
{{Template:ToolBtnTwo|mActionOpenTable|Identify Features}}
 
or
 
or
mActionOpenTableOpen Table.)
+
{{Template:ToolBtnTwo|mActionOpenTable|Open Table}}.)
 
To invoke an action,  
 
To invoke an action,  
 
right click on the
 
right click on the
行358: 行266:
 
wish to invoke.
 
wish to invoke.
  
<P>
 
 
If you are invoking an action that uses the %% notation, right-click on the
 
If you are invoking an action that uses the %% notation, right-click on the
field value in the Identify Results dialog or the
+
field value in the {{Template:Dialog|Identify Results}} dialog or the
Attribute Table dialog that you wish to pass to the application or script.
+
{{Template:Dialog|Attribute Table}} dialog that you wish to pass to the application or script.
  
<P>
 
 
Here is another example that pulls data out of a vector layer and inserts them
 
Here is another example that pulls data out of a vector layer and inserts them
into a file using bash and the echo command (so it will only work
+
into a file using bash and the {{Template:UserText|echo}} command (so it will only work
or perhaps ). The layer in question has fields for a species name
+
{{Template:Nix}} or perhaps {{Template:OSX}}). The layer in question has fields for a species name
taxon_name, latitude lat and longitude
+
{{Template:UserText|taxon_name}}, latitude {{Template:UserText|lat}} and longitude
long. I would like to be able to
+
{{Template:UserText|long}}. I would like to be able to
 
make a spatial selection of a localities and export these field values to a
 
make a spatial selection of a localities and export these field values to a
 
text file for the selected record (shown in yellow in the QGIS map area). Here is
 
text file for the selected record (shown in yellow in the QGIS map area). Here is
 
the action to achieve this:
 
the action to achieve this:
  
<P>
+
<pre>
<PRE>
+
   bash -c "echo \"%taxon_name %lat %long\" >> /tmp/species_localities.txt"
   bash -c "echo \"%taxon_name %lat %long\" &gt;&gt; /tmp/species_localities.txt"
+
</pre>  
</PRE>  
+
  
<P>
 
 
After selecting a few localities and running the action on each one, opening
 
After selecting a few localities and running the action on each one, opening
 
the output file will show something like this:
 
the output file will show something like this:
  
<P>
+
<pre>
<PRE>
+
 
   Acacia mearnsii -34.0800000000 150.0800000000
 
   Acacia mearnsii -34.0800000000 150.0800000000
 
   Acacia mearnsii -34.9000000000 150.1200000000
 
   Acacia mearnsii -34.9000000000 150.1200000000
 
   Acacia mearnsii -35.2200000000 149.9300000000
 
   Acacia mearnsii -35.2200000000 149.9300000000
 
   Acacia mearnsii -32.2700000000 150.4100000000
 
   Acacia mearnsii -32.2700000000 150.4100000000
</PRE>  
+
</pre>  
  
<P>
 
 
As an exercise we create an action that does a Google search on the  
 
As an exercise we create an action that does a Google search on the  
lakes layer. First we need to determine the URL needed to perform a search on a
+
{{Template:FileName|lakes}} layer. First we need to determine the URL needed to perform a search on a
 
keyword. This is easily done by just going to Google and doing a simple
 
keyword. This is easily done by just going to Google and doing a simple
 
search, then grabbing the URL from the address bar in your browser. From this
 
search, then grabbing the URL from the address bar in your browser. From this
little effort we see that the format is: <TT><A NAME="tex2html72"
+
little effort we see that the format is: {{Template:URL|http://google.com/search?q=qgis}},
  HREF="http://google.com/search?q=qgis">http://google.com/search?q=qgis</A></TT>,
+
where {{Template:UserText|qgis}} is the search term. Armed with this information, we can
where qgis is the search term. Armed with this information, we can
+
 
proceed:
 
proceed:
  
<P>
+
<ol>
 
+
<li>Make sure the {{Template:FileName|lakes}} layer is loaded.
<OL>
+
<li>Open the {{Template:Dialog|Layer Properties}} dialog by double-clicking on the layer in the
<LI>Make sure the lakes layer is loaded.
+
   legend or right-click and choose {{Template:DropMenuOpt|Properties}} from the popup menu.
</LI>
+
<li>Click on the {{Template:Tab|Actions}} tab.
<LI>Open the Layer Properties dialog by double-clicking on the layer in the
+
<li>Enter a name for the action, for example {{Template:UserText|Google Search}}.
   legend or right-click and choose Properties from the popup menu.
+
<li>For the action, we need to provide the name of the external program to
</LI>
+
<LI>Click on the Actions tab.
+
</LI>
+
<LI>Enter a name for the action, for example Google Search.
+
</LI>
+
<LI>For the action, we need to provide the name of the external program to
+
 
   run. In this case, we can use Firefox. If the program is not in
 
   run. In this case, we can use Firefox. If the program is not in
 
   your path, you need to provide the full path.
 
   your path, you need to provide the full path.
</LI>
+
<li>Following the name of the external application, add the URL used for
<LI>Following the name of the external application, add the URL used for
+
 
   doing a Google search, up to but not included the search term:
 
   doing a Google search, up to but not included the search term:
   <TT><A NAME="tex2html73"
+
   {{Template:URL|http://google.com/search?q=}}
  HREF="http://google.com/search?q=">http://google.com/search?q=</A></TT>
+
<li>The text in the {{Template:GuiLabel|Action}} field should now look like this:<br>
</LI>
+
   {{Template:UserText|firefox {{Template:URL|http://google.com/search?q=}}}}
<LI>The text in the Action field should now look like this:
+
<li>Click on the drop-down box containing the field names for the
<BR>
+
   {{Template:UserText|lakes}} layer. It's located just to the left of the
firefox <TT><A NAME="tex2html74"
+
   {{Template:Button|Insert Field}} button.
   HREF="http://google.com/search?q=">http://google.com/search?q=</A></TT>
+
<li>From the drop-down box, select {{Template:SelectString||NAMES}} and click {{Template:Button|Insert Field}}.
</LI>
+
<li>Your action text now looks like this:<br> {{Template:UserText|firefox
<LI>Click on the drop-down box containing the field names for the
+
   {{Template:URL|http://google.com/search?q=%NAMES}}
   lakes layer. It's located just to the left of the
+
<li>Fo finalize the action click the {{Template:Button|Insert action}} button.
   Insert Field button.
+
</ol>
</LI>
+
<LI>From the drop-down box, select NAMES and click Insert Field.
+
</LI>
+
<LI>Your action text now looks like this:
+
<BR>
+
firefox
+
   <TT><A NAME="tex2html75"
+
  HREF="http://google.com/search?q=%NAMES">http://google.com/search?q=%NAMES</A></TT>
+
</LI>
+
<LI>Fo finalize the action click the Insert action button.
+
</LI>
+
</OL>
+
  
<P>
 
 
This completes the action and it is ready to use. The final text of the action
 
This completes the action and it is ready to use. The final text of the action
 
should look like this:
 
should look like this:
  
<P>
+
This completes the action and it is ready to use. The final text of the action
<DIV ALIGN="CENTER">
+
should look like this:
firefox <TT><A NAME="tex2html76"
+
  HREF="http://google.com/search?q=%NAMES">http://google.com/search?q=%NAMES</A></TT>
+
  
</DIV>
+
<p style="text-align:center">
 +
{{Template:UserText|firefox {{Template:URL|http://google.com/search?q=%NAMES}}}}
 +
</p>
  
<P>
+
We can now use the action. Close the {{Template:Dialog|Layer Properties}} dialog and zoom in to an area
We can now use the action. Close the Layer Properties dialog and zoom in to an area
+
of interest. Make sure the {{Template:FileName|lakes}} layer is active and identify a
of interest. Make sure the lakes layer is active and identify a
+
 
lake. In the result box you'll now see that our action is visible:
 
lake. In the result box you'll now see that our action is visible:
  
<P>
+
<table align='center'>
 +
<caption>'''Figure xx:''' Select feature and choose action {{Template:Nix</caption>
 +
<tr><td>}caption}<span id='fig:identify_action'></span>
 +
  [[File:action_identifyaction.png|302px]]</td></tr></table>
  
<DIV ALIGN="CENTER"><A NAME="fig:identify_action"></A><A NAME="484"></A>
+
When we click on the action, it brings up Firefox and navigates to the URL
<TABLE>
+
{{Template:URL|http://www.google.com/search?q=Tustumena}}. It is also possible to add further  
<CAPTION ALIGN="BOTTOM"><STRONG>Figure:</STRONG>
+
Select feature and choose action </CAPTION>
+
<TR><TD>
+
<DIV ALIGN="CENTER">
+
</DIV>
+
<P></P>
+
<DIV ALIGN="CENTER">  [clip=true, width=8cm]action_identifyaction
+
 
+
</DIV></TD></TR>
+
</TABLE>
+
</DIV>
+
 
+
<P>
+
When we click on the action, it brings up Firefox and navigates to the URL http://www.google.com/search?q=Tustumena . It is also possible to add further  
+
 
attribute fields to the action. Therefore you can add a ``+'' to the end of the action  
 
attribute fields to the action. Therefore you can add a ``+'' to the end of the action  
text, select another field and click on Insert Field. In this example there  
+
text, select another field and click on {{Template:Button|Insert Field}}. In this example there  
 
is just no other field available that would make sense to search for.
 
is just no other field available that would make sense to search for.
  
<P>
 
 
You can define multiple actions for a layer and each will show up in the
 
You can define multiple actions for a layer and each will show up in the
Identify Results dialog. You can also invoke actions from the attribute table
+
{{Template:Dialog|Identify Results}} dialog. You can also invoke actions from the attribute table
 
by selecting a row and right-clicking, then choosing the action from the popup
 
by selecting a row and right-clicking, then choosing the action from the popup
 
menu.
 
menu.
  
<P>
 
 
You can think of all kinds of uses for actions. For example, if you have a point layer
 
You can think of all kinds of uses for actions. For example, if you have a point layer
 
containing locations of images or photos along with a file name, you could
 
containing locations of images or photos along with a file name, you could
行492: 行359:
 
actions to launch web-based reports for an attribute field or combination of
 
actions to launch web-based reports for an attribute field or combination of
 
fields, specifying them in the same way we did in our Google search example.
 
fields, specifying them in the same way we did in our Google search example.
<H3>
+
 
Attributes Tab
+
==== Attributes Tab ====
</H3>
+
<span id='label_attributes'></span>
Within the Attributes tab the attributes of the selected dataset can be
+
 
manipulated. The buttons New Column and Delete Column can be
+
Within the {{Template:Tab|Attributes}} tab the attributes of the selected dataset can be
 +
manipulated. The buttons {{Template:Button|New Column}} and {{Template:Button|Delete Column}} can be
 
used, when the dataset is in editing mode. At the moment only columns from  
 
used, when the dataset is in editing mode. At the moment only columns from  
 
PostGIS layers can be edited, because this feature is not yet supported by  
 
PostGIS layers can be edited, because this feature is not yet supported by  
 
the OGR library.  
 
the OGR library.  
  
<P>
+
The {{Template:Button|Toggle editing mode}} button toggles this mode.
The Toggle editing mode button toggles this mode.
+
  
<P>
+
===== edit widget =====
edit widget
+
  
<P>
+
Within the {{Template:Tab|Attributes}} tab you also find an <tt>edit widget</tt> and a  
Within the Attributes tab you also find an <TT>edit widget</TT> and a  
+
<tt>value</tt> column. These two columns can be used to define values or a range  
<TT>value</TT> column. These two columns can be used to define values or a range  
+
 
of values that are allowed to be added to the specific attribute table columns.  
 
of values that are allowed to be added to the specific attribute table columns.  
 
They are used to produce different edit widgets in the attribute dialog. These  
 
They are used to produce different edit widgets in the attribute dialog. These  
 
widgets are:
 
widgets are:
  
<P>
+
<ul>
 
+
<li>line edit: an edit field which allows to enter simple text (or restrict to  
<UL>
+
<LI>line edit: an edit field which allows to enter simple text (or restrict to  
+
 
numbers for numeric attributes).
 
numbers for numeric attributes).
</LI>
+
<li>unique value: a list of unique attribute values of all pre-existing features
<LI>unique value: a list of unique attribute values of all pre-existing features
+
 
is produced and presented in a combo box for selection.
 
is produced and presented in a combo box for selection.
</LI>
+
<li> unique value (editable): a combination of `line edit' and `unique value'.
<LI>unique value (editable): a combination of `line edit' and `unique value'.
+
 
The edit field completes entered values to the unique value, but also allows
 
The edit field completes entered values to the unique value, but also allows
 
to enter new values.
 
to enter new values.
</LI>
+
<li>value map: a combobox to select from a set of values specified in the
<LI>value map: a combobox to select from a set of values specified in the
+
<tt>value</tt> column the {{Template:Tab|Attributes}} tab.  The possible values are  
<TT>value</TT> column the Attributes tab.  The possible values are  
+
delimited by a semicolon (e.g. <nowiki>high;medium;low</nowiki>).  It is also possible
delimited by a semicolon (e.g. <code>high;medium;low</code>).  It is also possible
+
 
to prepend a label to each value, which is delimited with an equal sign (e.g.
 
to prepend a label to each value, which is delimited with an equal sign (e.g.
<code>high=1;medium=2;low=3</code>). The label is shown in the combobox instead of
+
<nowiki>high=1;medium=2;low=3</nowiki>). The label is shown in the combobox instead of
 
the value.
 
the value.
</LI>
+
<li>classification: if a unique value renderer is selected for the layer, the
<LI>classification: if a unique value renderer is selected for the layer, the
+
 
values used for the classes are presented for selection in a combobox.
 
values used for the classes are presented for selection in a combobox.
</LI>
+
<li>range (editable): A edit field that allows to restrict numeric values to a
<LI>range (editable): A edit field that allows to restrict numeric values to a
+
 
given range.  That range is specified by entering minium and maximum value
 
given range.  That range is specified by entering minium and maximum value
delimited by a semicolon (e.g. <code>0;360</code>) in the <TT>value</TT> column of
+
delimited by a semicolon (e.g. <nowiki>0;360</nowiki>) in the <tt>value</tt> column of
the Attributes tab.
+
the {{Template:Tab|Attributes}} tab.
</LI>
+
<li>range (slider): A slider widget is presented that allows selection of a value
<LI>range (slider): A slider widget is presented that allows selection of a value
+
 
in a given range and precision.  The range is specifed by minimum, maximum
 
in a given range and precision.  The range is specifed by minimum, maximum
value and a step width (e.g. <code>0;360;10</code>) in the <TT>value</TT> column of
+
value and a step width (e.g. <nowiki>0;360;10</nowiki>) in the <tt>value</tt> column of
the Attributes tab.
+
the {{Template:Tab|Attributes}} tab.
</LI>
+
<li>file name: the line edit widget is accompanied by a push button. When pressed
<LI>file name: the line edit widget is accompanied by a push button. When pressed
+
 
it allows to select a filename using the standard file dialog.
 
it allows to select a filename using the standard file dialog.
</LI>
+
</ul>
</UL>
+
<H3>
+
Diagram Tab
+
</H3>
+
  
<P>
+
==== Diagram Tab ====
The Diagram tab allows you to add a grahic overlay to a vector layer.
+
<span id='sec:diagram'></span>
 +
 
 +
The {{Template:Tab|Diagram}} tab allows you to add a grahic overlay to a vector layer.
 
To activate this feature, open the Plugin Manager and select the Diagram Overlay'  
 
To activate this feature, open the Plugin Manager and select the Diagram Overlay'  
plugin. After this, there is a new tab in the vector Layer
+
plugin. After this, there is a new tab in the vector {{Template:Dialog|Layer
Properties dialog where the settings for diagrams may be entered (see
+
Properties}} dialog where the settings for diagrams may be entered (see
figure&nbsp;<A HREF="#fig:diagramtab">13</A>).
+
figure~[[fig:diagramtab]]).
  
<P>
+
<table align='center'>
 +
<caption>'''Figure xx:''' Vector properties dialog with diagram tab {{Template:Nix</caption>
 +
<tr><td>}caption}<span id='fig:diagramtab'></span>
 +
  [[File:diagram_tab.png|491px]]</td></tr></table>
  
<DIV ALIGN="CENTER"><A NAME="fig:diagramtab"></A><A NAME="519"></A>
 
<TABLE>
 
<CAPTION ALIGN="BOTTOM"><STRONG>Figure:</STRONG>
 
Vector properties dialog with diagram tab </CAPTION>
 
<TR><TD>
 
<DIV ALIGN="CENTER">
 
</DIV>
 
<P></P>
 
<DIV ALIGN="CENTER">  [clip=true, width=13cm]diagram_tab
 
 
</DIV></TD></TR>
 
</TABLE>
 
</DIV>
 
 
<P>
 
 
The current implementation of diagrams provides support for pie- and barcharts
 
The current implementation of diagrams provides support for pie- and barcharts
 
and for linear scaling of the diagram size according to a classification
 
and for linear scaling of the diagram size according to a classification
行584: 行426:
 
layer a barchart diagramm showing some temperature data from a climate vector
 
layer a barchart diagramm showing some temperature data from a climate vector
 
layer. Both vector layers are part of the QGIS sample dataset (see
 
layer. Both vector layers are part of the QGIS sample dataset (see
Section&nbsp;<A HREF="#label_sampledata"><IMG  ALIGN="BOTTOM" BORDER="1" ALT="[*]"
+
Section~[[label_sampledata]].
SRC="/usr/share/latex2html/icons/crossref.png"></A>.
+
  
<P>
+
<ol>
 
+
<li>First click on the {{Template:ToolBtnTwo|mActionAddOgrLayer|Load Vector}} icon,
<OL>
+
<LI>First click on the mActionAddOgrLayerLoad Vector icon,
+
 
browse to the QGIS sample dataset folder and load the two vector shape layers
 
browse to the QGIS sample dataset folder and load the two vector shape layers
alaska.shp and climate.shp.
+
{{Template:FileName|alaska.shp}} and {{Template:FileName|climate.shp}}.
</LI>
+
<li>Double click the {{Template:FileName|climate}} layer in the map legend to open the
<LI>Double click the climate layer in the map legend to open the
+
{{Template:Dialog|Layer Properties}} dialog.
Layer Properties dialog.
+
<li>Click on the {{Template:Tab|Diagram Overlay}} and select {{Template:Button|Bar chart}} as
</LI>
+
<LI>Click on the Diagram Overlay and select Bar chart as
+
 
Diagram type.
 
Diagram type.
</LI>
+
<li>In the diagram we want to display the values of the three columns
<LI>In the diagram we want to display the values of the three columns
+
{{Template:FileName|T_F_JAN, T_F_JAN}} and {{Template:FileName|T_F_MEAN}}. First select
T_F_JAN, T_F_JAN and T_F_MEAN. First select
+
{{Template:FileName|T_F_JAN}} as Attributes and click {{Template:Button|Add attribute}}, then
T_F_JAN as Attributes and click Add attribute, then
+
{{Template:FileName|T_F_JUL}} and finally {{Template:FileName|T_F_MEAN}}.   
T_F_JUL and finally T_F_MEAN.   
+
<li>For linear scaling of the diagram size we define {{Template:FileName|T_F_JUL}}
</LI>
+
<LI>For linear scaling of the diagram size we define T_F_JUL
+
 
as classification attribute.
 
as classification attribute.
</LI>
+
<li>Now click on {{Template:Button|find maximum value}}, choose a size value and unit
<LI>Now click on find maximum value, choose a size value and unit
+
and click {{Template:Button|Apply}} to display the diagram in the QGIS main window.
and click Apply to display the diagram in the QGIS main window.
+
<li>You can now adapt the chart size, or change the attribute colors double
</LI>
+
<LI>You can now adapt the chart size, or change the attribute colors double
+
 
clicking on the color values in the attribute field.
 
clicking on the color values in the attribute field.
Figure&nbsp;<A HREF="#fig:climatediagram">14</A> gives an impression.
+
Figure~[[fig:climatediagram]] gives an impression.
</LI>
+
<li>Finally click {{Template:Button|Ok}}.  
<LI>Finally click Ok.  
+
</ol>
</LI>
+
</OL>
+
 
+
<P>
+
 
+
<DIV ALIGN="CENTER"><A NAME="fig:climatediagram"></A><A NAME="548"></A>
+
<TABLE>
+
<CAPTION ALIGN="BOTTOM"><STRONG>Figure:</STRONG>
+
Diagram from temperature data overlayed on a map </CAPTION>
+
<TR><TD>
+
<DIV ALIGN="CENTER">
+
</DIV>
+
<P></P>
+
<DIV ALIGN="CENTER">  [clip=true, width=13cm]climate_diagram
+
  
</DIV></TD></TR>
+
<table align='center'>
</TABLE>
+
<caption>'''Figure xx:''' Diagram from temperature data overlayed on a map {{Template:Nix</caption>
</DIV>
+
<tr><td>}caption}<span id='fig:climatediagram'></span>
 +
  [[File:climate_diagram.png|491px]]</td></tr></table>

2009年10月4日 (日) 17:54時点における版

The Vector Properties Dialog

The Layer Properties dialog for a vector layer provides information about the layer, symbology settings and labeling options. If your vector layer has been loaded from a PostgreSQL / PostGIS datastore, you can also alter the underlying SQL for the layer - either by hand editing the SQL on the General tab or by invoking the Query Builder dialog on the General tab. To access the Layer Properties dialog, double-click on a layer in the legend or right-click on the layer and select Properties from the popup menu.

Figure xx: Vector Layer Properties Dialog {{Template:Nix
}caption} VectorLayerSymbology.png

General Tab

The General tab is essentially like that of the raster dialog. It allows you to change the display name, set scale dependent rendering options, create a spatial index of the vector file (only for OGR supported formats and PostGIS) and view or change the projection of the specific vetor layer.

The Query Builder button allows you to create a subset of the features in the layer - but this button currently only is available when you open the attribute table and select the ... button next to Advanced search.

Symbology Tab

QGIS supports a number of symbology renderers to control how vector features are displayed. Currently the following renderers are available:

Single symbol
- a single style is applied to every object in the layer.
Graduated symbol
- objects within the layer are displayed with different symbols classified by the values of a particular field.
Continuous color
- objects within the layer are displayed with a spread of colours classified by the numerical values within a specified field.
Unique value
- objects are classified by the unique values within a specified field with each value having a different symbol.

To change the symbology for a layer, simply double click on its legend entry and the vector Layer Properties dialog will be shown.

Figure xx: Symbolizing-options {{Template:Nix
}caption}
(x) Single symbol
VectorClassifySingle.png
(x) Graduated symbol
VectorClassifyGraduated.png

(x) Continous color
VectorClassifyContinous.png
(x) Unique value
VectorClassifyUnique.png


Style Options

Within this dialog you can style your vector layer. Depending on the selected rendering option you have the possibility to also classify your mapfeatures.

At least the following styling options apply for nearly all renderers:

Outline style
- pen-style for your outline of your feature. you can also set this to 'no pen'.
Outline color
- color of the ouline of your feature
Outline width
- width of your features
Fill color
- fill-color of your features.
Fill style
- Style for filling. Beside the given brushes you can select Fill style ? texture SelectString.png and click the ... button for selecting your own fill-style. Currently the fileformats *.jpeg, *.xpm, and *.png are supported.

Once you have styled your layer you also could save your layer-style to a separate file (with *.qml-ending). To do this, use the button Save Style .... No need to say that Load Style ... loads your saved layer-style-file.

If you wish to always use a particular style whenever the layer is loaded, use the Save As Default button to make your style the default. Also, if you make changes to the style that you are not happy with, use the Restore Default Styel button to revert to your default style.

Vector transparency

QGIS \CURRENT allows to set a transparency for every vector layer. This can be done with the slider Transparency 0% Slider.png inside the symbology tab (see fig. fig:vector_symbology). This is very useful for overlaying several vector layers.

Metadata Tab

The Metadata tab contains information about the layer, including specifics about the type and location, number of features, feature type, and the editing capabilities. The Layer Spatial Reference System section, providing projection information, and the Attribute field info section, listing fields and their data types, are displayed on this tab. This is a quick way to get information about the layer.

Labels Tab

The Labels tab allows you to enable labeling features and control a number of options related to fonts, placement, style, alignment and buffering.

We will illustrate this by labelling the lakes shapefile of the qgis_example_dataset:

  1. Load the Shapefile alaska.shp and GML file lakes.gml in QGIS.
  2. Zoom in a bit to your favorite area with some lake.
  3. Make the lakes layer active.
  4. Open the Layer Properties dialog.
  5. Click on the Labels tab.
  6. Check the CheckBox.pngDisplay labels checkbox to enable labeling.
  7. Choose the field to label with. We'll use Field containing label NAMES SelectString.png.
  8. Enter a default for lakes that have no name. The default label will be used each time QGIS encounters a lake with no value in the NAMES field.
  9. If have labels extending over several lines, check CheckBox.pngMultiline labels?. QGIS will check for a true line return in your label field and insert the line breaks accordingly. A true line return is a single character \n, (not two separate characters, like a backlash \~followed by the character n).
  10. Click Apply.

Now we have labels. How do they look? They are probably too big and poorly placed in relation to the marker symbol for the lakes.

Select the Font entry and use the Font and Color buttons to set the font and color. You can also change the angle and the placement of the text-label.

To change the position of the text relative to the feature:

  1. Click on the Font entry.
  2. Change the placement by selecting one of the radio buttons in the Placement group. To fix our labels, choose the RadioButtonOn.png Right radio button.
  3. the Font size units allows you to select between RadioButtonOn.png Points or RadioButtonOn.png Map units.
  4. Click Apply to see your changes without closing the dialog.

Things are looking better, but the labels are still too close to the marker. To fix this we can use the options on the Position entry. Here we can add offsets for the X and Y directions. Adding an X offset of 5 will move our labels off the marker and make them more readable. Of course if your marker symbol or font is larger, more of an offset will be required.

The last adjustment we'll make is to buffer the labels. This just means putting a backdrop around them to make them stand out better. To buffer the lakes labels:

  1. Click the Buffer tab.
  2. Click the CheckBox.pngBuffer Labels? checkbox to enable buffering.
  3. Choose a size for the buffer using the spin box.
  4. Choose a color by clicking on Color and choosing your favorite from the color selector. You can also set some transparency for the buffer if you prefer.
  5. Click Apply to see if you like the changes.

If you aren't happy with the results, tweak the settings and then test again by clicking Apply.

A buffer of 1 points seems to give a good result. Notice you can also specify the buffer size in map units if that works out better for you.

The remaining entries inside the Label tab allow you control the appearance of the labels using attributes stored in the layer. The entries beginning with Data defined allow you to set all the parameters for the labels using fields in the layer.

Not that the Label tab provides a preview-box where your selected label is shown.

Actions Tab

QGIS provides the ability to perform an action based on the attributes of a feature. This can be used to perform any number of actions, for example, running a program with arguments built from the attributes of a feature or passing parameters to a web reporting tool.

Actions are useful when you frequently want to run an external application or view a web page based on one or more values in your vector layer. An example is performing a search based on an attribute value. This concept is used in the following discussion.

Defining Actions

Attribute actions are defined from the vector Layer Properties dialog. To define an action, open the vector Layer Properties dialog and click on the Actions tab. Provide a descriptive name for the action. The action itself must contain the name of the application that will be executed when the action is invoked. You can add one or more attribute field values as arguments to the application. When the action is invoked any set of characters that start with a % followed by the name of a field will be replaced by the value of that field. The special characters %% will be replaced by the value of the field that was selected from the identify results or attribute table (see Using Actions below). Double quote marks can be used to group text into a single argument to the program, script or command. Double quotes will be ignored if preceded by a backslash.

If you have field names that are substrings of other field names (e.g., col1 and col10) you should indicate so, by surrounding the field name (and the % character) with square brackets (e.g., {{Template:UserText|[%col10]}). This will prevent the %col10 field name being mistaken for the {{Template:UserText|on the end. The brackets will be removed by QGIS when it substitutes in the value of the field. If you want the substituted field to be surrounded by square brackets, use a second set like this: %col1 field name with a テンプレート:Usertext on the end. The brackets will be removed by QGIS when it substitutes in the value of the field. If you want the substituted field to be surrounded by square brackets, use a second set like this: テンプレート:Usertext.

The Identify Results dialog box includes a (Derived) item that contains information relevant to the layer type. The values in this item can be accessed in a similar way to the other fields by using preceeding the derived field name by (Derived).. For example, a point layer has an X and Y field and the value of these can be used in the action with %(Derived).X and %(Derived).Y. The derived attributes are only available from the Identify Results dialog box, not the Attribute Table dialog box.

Two example actions are shown below:

In the first example, the web browser konqueror is invoked and passed a URL to open. The URL performs a Google search on the value of the nam field from our vector layer. Note that the application or script called by the action must be in the path or you must provided the full path. To be sure, we could rewrite the first example as: {{{1}}}. This will ensure that the konquerorapplication will be executed when the action is invoked.

The second example uses the %% notation which does not rely on a particular field for its value. When the action is invoked, the %% will be replaced by the value of the selected field in the identify results or attribute table.

Using Actions

Actions can be invoked from either the Identify Results dialog or an

Attribute Table dialog. 

(Recall that these dialogs can be opened by clicking MActionOpenTable.png Identify Features or MActionOpenTable.png Open Table.) To invoke an action, right click on the record and choose the action from the popup menu. Actions are listed in the popup menu by the name you assigned when defining the actions. Click on the action you wish to invoke.

If you are invoking an action that uses the %% notation, right-click on the field value in the Identify Results dialog or the Attribute Table dialog that you wish to pass to the application or script.

Here is another example that pulls data out of a vector layer and inserts them into a file using bash and the echo command (so it will only work Nix.png or perhaps Osx.png ). The layer in question has fields for a species name taxon_name, latitude lat and longitude long. I would like to be able to make a spatial selection of a localities and export these field values to a text file for the selected record (shown in yellow in the QGIS map area). Here is the action to achieve this:

  bash -c "echo \"%taxon_name %lat %long\" >> /tmp/species_localities.txt"

After selecting a few localities and running the action on each one, opening the output file will show something like this:

  Acacia mearnsii -34.0800000000 150.0800000000
  Acacia mearnsii -34.9000000000 150.1200000000
  Acacia mearnsii -35.2200000000 149.9300000000
  Acacia mearnsii -32.2700000000 150.4100000000

As an exercise we create an action that does a Google search on the lakes layer. First we need to determine the URL needed to perform a search on a keyword. This is easily done by just going to Google and doing a simple search, then grabbing the URL from the address bar in your browser. From this little effort we see that the format is: {{{1}}} , where qgis is the search term. Armed with this information, we can proceed:

  1. Make sure the lakes layer is loaded.
  2. Open the Layer Properties dialog by double-clicking on the layer in the legend or right-click and choose Properties from the popup menu.
  3. Click on the Actions tab.
  4. Enter a name for the action, for example Google Search.
  5. For the action, we need to provide the name of the external program to run. In this case, we can use Firefox. If the program is not in your path, you need to provide the full path.
  6. Following the name of the external application, add the URL used for doing a Google search, up to but not included the search term: {{{1}}}
  7. The text in the Action field should now look like this:
    firefox {{{1}}}
  8. Click on the drop-down box containing the field names for the lakes layer. It's located just to the left of the Insert Field button.
  9. From the drop-down box, select NAMES SelectString.png and click Insert Field.
  10. Your action text now looks like this:
    {{Template:UserText|firefox {{{1}}}
  11. Fo finalize the action click the Insert action button.

This completes the action and it is ready to use. The final text of the action should look like this:

This completes the action and it is ready to use. The final text of the action should look like this:

firefox {{{1}}}

We can now use the action. Close the Layer Properties dialog and zoom in to an area of interest. Make sure the lakes layer is active and identify a lake. In the result box you'll now see that our action is visible:

Figure xx: Select feature and choose action {{Template:Nix
}caption} Action identifyaction.png

When we click on the action, it brings up Firefox and navigates to the URL {{{1}}} . It is also possible to add further attribute fields to the action. Therefore you can add a ``+ to the end of the action text, select another field and click on Insert Field. In this example there is just no other field available that would make sense to search for.

You can define multiple actions for a layer and each will show up in the Identify Results dialog. You can also invoke actions from the attribute table by selecting a row and right-clicking, then choosing the action from the popup menu.

You can think of all kinds of uses for actions. For example, if you have a point layer containing locations of images or photos along with a file name, you could create an action to launch a viewer to display the image. You could also use actions to launch web-based reports for an attribute field or combination of fields, specifying them in the same way we did in our Google search example.

Attributes Tab

Within the Attributes tab the attributes of the selected dataset can be manipulated. The buttons New Column and Delete Column can be used, when the dataset is in editing mode. At the moment only columns from PostGIS layers can be edited, because this feature is not yet supported by the OGR library.

The Toggle editing mode button toggles this mode.

edit widget

Within the Attributes tab you also find an edit widget and a value column. These two columns can be used to define values or a range of values that are allowed to be added to the specific attribute table columns. They are used to produce different edit widgets in the attribute dialog. These widgets are:

  • line edit: an edit field which allows to enter simple text (or restrict to numbers for numeric attributes).
  • unique value: a list of unique attribute values of all pre-existing features is produced and presented in a combo box for selection.
  • unique value (editable): a combination of `line edit' and `unique value'. The edit field completes entered values to the unique value, but also allows to enter new values.
  • value map: a combobox to select from a set of values specified in the value column the Attributes tab. The possible values are delimited by a semicolon (e.g. high;medium;low). It is also possible to prepend a label to each value, which is delimited with an equal sign (e.g. high=1;medium=2;low=3). The label is shown in the combobox instead of the value.
  • classification: if a unique value renderer is selected for the layer, the values used for the classes are presented for selection in a combobox.
  • range (editable): A edit field that allows to restrict numeric values to a given range. That range is specified by entering minium and maximum value delimited by a semicolon (e.g. 0;360) in the value column of the Attributes tab.
  • range (slider): A slider widget is presented that allows selection of a value in a given range and precision. The range is specifed by minimum, maximum value and a step width (e.g. 0;360;10) in the value column of the Attributes tab.
  • file name: the line edit widget is accompanied by a push button. When pressed it allows to select a filename using the standard file dialog.

Diagram Tab

The Diagram tab allows you to add a grahic overlay to a vector layer. To activate this feature, open the Plugin Manager and select the Diagram Overlay' plugin. After this, there is a new tab in the vector Layer Properties dialog where the settings for diagrams may be entered (see figure~fig:diagramtab).

Figure xx: Vector properties dialog with diagram tab {{Template:Nix
}caption} Diagram tab.png

The current implementation of diagrams provides support for pie- and barcharts and for linear scaling of the diagram size according to a classification attribute. We will demonstrate an example and overlay the alaska boundary layer a barchart diagramm showing some temperature data from a climate vector layer. Both vector layers are part of the QGIS sample dataset (see Section~label_sampledata.

  1. First click on the MActionAddOgrLayer.png Load Vector icon, browse to the QGIS sample dataset folder and load the two vector shape layers alaska.shp and climate.shp.
  2. Double click the climate layer in the map legend to open the Layer Properties dialog.
  3. Click on the Diagram Overlay and select Bar chart as Diagram type.
  4. In the diagram we want to display the values of the three columns T_F_JAN, T_F_JAN and T_F_MEAN. First select T_F_JAN as Attributes and click Add attribute, then T_F_JUL and finally T_F_MEAN.
  5. For linear scaling of the diagram size we define T_F_JUL as classification attribute.
  6. Now click on find maximum value, choose a size value and unit and click Apply to display the diagram in the QGIS main window.
  7. You can now adapt the chart size, or change the attribute colors double clicking on the color values in the attribute field. Figure~fig:climatediagram gives an impression.
  8. Finally click Ok.
Figure xx: Diagram from temperature data overlayed on a map {{Template:Nix
}caption} Climate diagram.png