「編集」の版間の差分

提供: OSGeo.JP Wiki
移動: 案内検索
(タグ・画像調整前に一旦配下を統合)
(タグ一括置換状態で一旦保存)
行1: 行1:
<H2>
+
=== Editing ===
Editing
+
</H2>
+
  
<P>
 
 
QGIS supports basic capabilities for editing vector geometries.  Before reading any
 
QGIS supports basic capabilities for editing vector geometries.  Before reading any
 
further you should note that at this stage editing support is still preliminary.
 
further you should note that at this stage editing support is still preliminary.
行9: 行6:
 
to edit.  
 
to edit.  
  
<P>
+
'''Note''' - the procedure for editing GRASS layers is different - see
<SPAN  CLASS="textbf">Note</SPAN> - the procedure for editing GRASS layers is different - see
+
Section [[grass_digitising]] for details.
Section <A HREF="#grass_digitising"><IMG  ALIGN="BOTTOM" BORDER="1" ALT="[*]"
+
SRC="/usr/share/latex2html/icons/crossref.png"></A> for details.
+
  
<H3>
+
==== Setting the Snapping Tolerance and Search Radius ====
Setting the Snapping Tolerance and Search Radius
+
</H3>
+
  
<P>
 
 
Before we can edit vertices, it is very important to set the snapping
 
Before we can edit vertices, it is very important to set the snapping
 
tolerance and search radius to a value that allows us an optimal editing of
 
tolerance and search radius to a value that allows us an optimal editing of
 
the vector layer geometries.  
 
the vector layer geometries.  
  
<P>
+
===== Snapping tolerance =====
Snapping tolerance
+
  
<P>
+
Snapping tolerance is the distance QGIS uses to {{Template:UserText|search}} for the
Snapping tolerance is the distance QGIS uses to search for the
+
 
closest vertex and/or segment you are trying to
 
closest vertex and/or segment you are trying to
 
connect when you set a new vertex or move an existing vertex. If you aren't
 
connect when you set a new vertex or move an existing vertex. If you aren't
行33: 行23:
 
mouse button, instead of snapping it to an existing vertex and/or segment.  
 
mouse button, instead of snapping it to an existing vertex and/or segment.  
  
<P>
+
<ol>
 
+
<li>A general, project wide snapping tolerance can be defined choosing
<OL>
+
{{Template:MainMenuOpt|Settings}} > {{Template:DropMenuOptTwo|mActionOptions|Options}}.  
<LI>A general, project wide snapping tolerance can be defined choosing
+
(On Mac: go to  {{Template:MainMenuOpt|QGIS}} > Preferences, on Linux: {{Template:MainMenuOpt|Edit}} > {{Template:DropMenuOptTwo|mActionOptions|Options}}.)
Settings &gt; mActionOptionsOptions.  
+
In the {{Template:Tab|Digitizing}} tab you can select between to vertex, to segment or
(On Mac: go to  QGIS &gt; Preferences, on Linux: Edit &gt; mActionOptionsOptions.)
+
In the Digitizing tab you can select between to vertex, to segment or
+
 
to vertex and segment as default snap mode. You can also define a default
 
to vertex and segment as default snap mode. You can also define a default
 
snapping tolerance and a search radius for vertex edits. The tolerance an be set either in map units or in pixels.  
 
snapping tolerance and a search radius for vertex edits. The tolerance an be set either in map units or in pixels.  
行46: 行34:
 
on the order of 300ft should be fine at a scale of 1:10 000 should be a
 
on the order of 300ft should be fine at a scale of 1:10 000 should be a
 
reasonable setting.
 
reasonable setting.
</LI>
+
<li>A layer based snapping tolerance can be defined by choosing
<LI>A layer based snapping tolerance can be defined by choosing
+
{{Template:MainMenuOpt|Settings}} (or {{Template:MainMenuOpt|File}}) > {{Template:DropMenuOptTwo|mActionOptions|Project
Settings (or File) &gt; mActionOptionsProject
+
Properties...}}. In the {{Template:Tab|General}} tab, section {{Template:ClassName|Digitize}} you
Properties.... In the General tab, section Digitize you
+
can click on {{Template:Button|Snapping options...}} to enable and adjust snapping
can click on Snapping options... to enable and adjust snapping
+
mode and tolerance on a layer basis (see Figure~[[fig:snappingoptions]]).
mode and tolerance on a layer basis (see Figure&nbsp;<A HREF="#fig:snappingoptions">15</A>).
+
</ol>
</LI>
+
</OL>
+
  
<P>
+
<table align='center'>
 +
<caption>'''Figure xx:''' Edit snapping options on a layer basis {{Template:Nix</caption>
 +
<tr><td>}caption}<span id='fig:snappingoptions'></span>
 +
  [[File:editProjectSnapping.png|529px]]</td></tr></table>
  
<DIV ALIGN="CENTER"><A NAME="fig:snappingoptions"></A><A NAME="580"></A>
+
===== Search radius =====
<TABLE>
+
<CAPTION ALIGN="BOTTOM"><STRONG>Figure:</STRONG>
+
Edit snapping options on a layer basis </CAPTION>
+
<TR><TD>
+
<DIV ALIGN="CENTER">
+
</DIV>
+
<P></P>
+
<DIV ALIGN="CENTER">  [clip=true, width=14cm]editProjectSnapping
+
  
</DIV></TD></TR>
+
Search radius is the distance QGIS uses to {{Template:UserText|search}} for the closest
</TABLE>
+
</DIV>
+
 
+
<P>
+
Search radius
+
 
+
<P>
+
Search radius is the distance QGIS uses to search for the closest
+
 
vertex you are trying to move when you click on the
 
vertex you are trying to move when you click on the
 
map. If you aren't within the search radius, QGIS won't find and select
 
map. If you aren't within the search radius, QGIS won't find and select
行85: 行58:
 
small and it won't find anything to move.
 
small and it won't find anything to move.
  
<P>
 
 
The search radius for vertex edits in layer units can be defined in the
 
The search radius for vertex edits in layer units can be defined in the
Digitizing tab under Settings &gt;
+
{{Template:Tab|Digitizing}} tab under {{Template:MainMenuOpt|Settings}} >
mActionOptionsOptions. The same place where you define the
+
{{Template:DropMenuOptTwo|mActionOptions|Options}}. The same place where you define the
 
general, project wide snapping tolerance.
 
general, project wide snapping tolerance.
  
<H3>
+
==== Topological editing ====
Topological editing
+
</H3>
+
  
<P>
+
Besides layer based snapping options the {{Template:Tab|General}} tab in menu  
Besides layer based snapping options the General tab in menu  
+
{{Template:MainMenuOpt|Settings}} -> {{Template:DropMenuOptTwo|mActionOptions|Project Properties...}}
Settings -&gt; mActionOptionsProject Properties...  
+
 
also provides some topological functionalities.  
 
also provides some topological functionalities.  
In the Digitizing option group you can Enable topological editing and/or activate  
+
In the Digitizing option group you can {{Template:CheckBox|Enable topological editing}} and/or activate  
Avoid intersections of new polygons.
+
{{Template:CheckBox|Avoid intersections of new polygons}}.
 
+
  
<h4>Enable topological editing</h4>
+
===== Enable topological editing =====
  
<P>
+
The option {{Template:CheckBox|Enable topological editing}} is for editing and maintaining  
The option Enable topological editing is for editing and maintaining  
+
 
common boundaries in polygon mosaics. QGIS "detects" a shared boundary in  
 
common boundaries in polygon mosaics. QGIS "detects" a shared boundary in  
 
a polygon mosaic and you only have to move the vertex once and QGIS will take  
 
a polygon mosaic and you only have to move the vertex once and QGIS will take  
 
care about updating the other boundary.
 
care about updating the other boundary.
  
<P>
+
===== Avoid intersections of new polygons =====
<h4>Avoid intersections of new polygons</h4>
+
  
<P>
+
The second topological option called {{Template:CheckBox|Avoid intersections of new polygons}}
The second topological option called Avoid intersections of new polygons  
+
 
avoids overlaps in polygon mosaics. It is for quicker digitizing of adjacent polygons.  
 
avoids overlaps in polygon mosaics. It is for quicker digitizing of adjacent polygons.  
 
If you already have one polygon, it is possible with this option to digitise the second  
 
If you already have one polygon, it is possible with this option to digitise the second  
行121: 行86:
 
The advantage is that users don't have to digitize all vertices of the common boundary.
 
The advantage is that users don't have to digitize all vertices of the common boundary.
  
<P>
+
==== Editing an Existing Layer ====
  
<H3>
 
Editing an Existing Layer
 
</H3>
 
  
<P>
+
<span id='sec:edit_existing_layer'></span>
 +
 
 
By default, QGIS loads layers read-only: This is a safeguard
 
By default, QGIS loads layers read-only: This is a safeguard
 
to avoid accidentally editing a layer if there is a slip of the mouse.
 
to avoid accidentally editing a layer if there is a slip of the mouse.
行133: 行96:
 
and the underlying data source is writable (i.e. its files are not read-only).
 
and the underlying data source is writable (i.e. its files are not read-only).
  
<P>
 
 
Layer editing is most versatile when used on PostgreSQL/PostGIS data sources.  
 
Layer editing is most versatile when used on PostgreSQL/PostGIS data sources.  
  
<P>
+
{{Template:Tip
<BR>
+
|num=xx
<IMG
+
|caption=Data Integrity
WIDTH="514" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
+
|qgistip=It is always a good idea to back up your data source before you start
SRC="img9.png"
+
editing. While the authors of QGIS have made every effort to preserve the  
ALT="\begin{Tip}
+
% latex2html id marker 606
+
[ht]\caption{\textsc{Data Integrity}}
+
\qg...
+
...ve the
+
 
integrity of your data, we offer no warranty in this regard.
 
integrity of your data, we offer no warranty in this regard.
}
 
\end{Tip}">
 
<BR>
 
  
<P>
+
}}
<BR>
+
<IMG
+
WIDTH="123" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
+
SRC="img10.png"
+
ALT="\begin{Tip}
+
% latex2html id marker 610
+
[ht]\caption{\textsc{Manipulating Attribu...
+
...d, because this feature was recently implemented in GDAL/OGR &gt; 1.6.0
+
}
+
\end{Tip}">
+
<BR>
+
  
<P>
+
{{Template:Tip
<BR>
+
|num=xx
<IMG
+
|caption=Manipulating Attribute data
WIDTH="239" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
+
|qgistip=Currently only PostGIS layers are supported for adding or dropping attribute
SRC="img11.png"
+
columns within this dialog. In future versions of QGIS, other datasources
ALT="\begin{Tip}
+
will be supported, because this feature was recently implemented in GDAL/OGR > 1.6.0
% latex2html id marker 614
+
 
[ht]\caption{\textsc{Save Regularly}}
+
}}
\qg...
+
 
...and also confirms that your data source can accept all
+
 
 +
 
 +
{{Template:Tip
 +
|num=xx
 +
|caption=Save Regularly
 +
|qgistip=Remember to toggle {{Template:ToolBtnTwo|mActionToggleEditing|Toggle editing} off regularly.
 +
This allows you to save your recent changes,
 +
and also confirms that your data source can accept all
 
your changes.
 
your changes.
 
}
 
}
\end{Tip}">
+
}}
<BR>
+
  
<P>
+
{{Template:Tip
<BR>
+
|num=xx
<IMG
+
|caption=Concurrent Edits
WIDTH="128" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
+
|qgistip=This version of QGIS does not track if somebody else is editing a feature at the same time
SRC="img12.png"
+
as you. The last person to save their edits wins.
ALT="\begin{Tip}
+
% latex2html id marker 619
+
[ht]\caption{\textsc{Concurrent Edits}}
+
\...
+
...e at the same time
+
as you. The last person to save their edits wins.
+
}
+
\end{Tip}">
+
<BR>
+
  
<P>
+
}}
<BR>
+
 
<IMG
+
{{Template:Tip
WIDTH="146" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
+
|num=xx
SRC="img13.png"
+
|caption=Zoom in Before Editing
ALT="\begin{Tip}
+
|qgistip=Before editing a layer, you should
% latex2html id marker 623
+
zoom in to your area of interest. This
[ht]\caption{\textsc{Zoom in Before Editi...
+
avoids waiting while all the vertex markers are rendered across the entire layer.
...g while all the vertex markers are rendered across the entire layer.
+
 
}
+
}}
\end{Tip}">
+
<BR>
+
  
<P>
+
{{Template:Tip
<BR>
+
|num=xx
<IMG
+
|caption=Vertex Markers
WIDTH="193" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
+
|qgistip=
SRC="img14.png"
+
The current version of QGIS supports two kinds of vertex-markers -
ALT="\begin{Tip}
+
a semi-transparent circle or a cross. To change the marker style, choose
% latex2html id marker 627
+
{{Template:DropMenuOptTwo|mActionOptions|Options} from the
[ht]\caption{\textsc{Vertex Markers}}
+
{{Template:MainMenuOpt|Settings}} menu and click on the {{Template:Tab|Digitizing}} tab and select
\qg...
+
... click on the \tab{Digitizing} tab and select
+
 
the appropriate entry.
 
the appropriate entry.
 
}
 
}
\end{Tip}">
+
}}
<BR>
+
  
<P>
+
All editing sessions start by choosing the {{Template:DropMenuOptTwo|mActionToggleEditing|Toggle editing}} option.
All editing sessions start by choosing the mActionToggleEditingToggle editing option.
+
 
This can be found in the context menu after right clicking on the legend
 
This can be found in the context menu after right clicking on the legend
entry for that layer.<A NAME="636"></A>
+
entry for that layer.
Alternately, you can use the <A NAME="637"></A>
+
Alternately, you can use the  
mActionToggleEditingToggle editing button from the toolbar to start  
+
{{Template:ToolBtnTwo|mActionToggleEditing|Toggle editing}} button from the toolbar to start  
or stop the editing mode.<A NAME="640"></A> Once the layer is in edit mode,  
+
or stop the editing mode. Once the layer is in edit mode,  
 
markers will appear at the vertices, and additional tool buttons on the editing  
 
markers will appear at the vertices, and additional tool buttons on the editing  
 
toolbar will become available.
 
toolbar will become available.
  
<P>
+
===== Zooming and panning with the mouse wheel =====
Zooming and panning with the mouse wheel
+
  
<P>
 
 
While digitizing you can press the mouse wheel to pan inside of the main
 
While digitizing you can press the mouse wheel to pan inside of the main
 
window and you can roll the mouse wheel to zoom in and out on the map. For
 
window and you can roll the mouse wheel to zoom in and out on the map. For
行241: 行173:
 
to zoom in and backwards (towards you) to zoom out. The mouse cursor position will  
 
to zoom in and backwards (towards you) to zoom out. The mouse cursor position will  
 
be the center of the zoomed area of interest. You can customize the behavior  
 
be the center of the zoomed area of interest. You can customize the behavior  
of the mouse wheel zoom using the Map tools tab under the
+
of the mouse wheel zoom using the {{Template:Tab|Map tools}} tab under the
Settings &gt;Options menu.   
+
{{Template:MainMenuOpt|Settings}} >{{Template:DropMenuOpt|Options}} menu.   
  
<P>
+
===== Panning with the arrow keys =====
Panning with the arrow keys
+
  
<P>
 
 
Panning the Map during digitizing is possible with the arrow keys. Place
 
Panning the Map during digitizing is possible with the arrow keys. Place
 
the mouse cursor inside the map area and click on the right arrow key to
 
the mouse cursor inside the map area and click on the right arrow key to
行253: 行183:
 
key to pan south.
 
key to pan south.
  
<P>
 
 
You can also use the spacebar to temporarily cause mouse movements to pan  
 
You can also use the spacebar to temporarily cause mouse movements to pan  
 
then map. The PgUp and PgDown keys on your keyboard will cause the map  
 
then map. The PgUp and PgDown keys on your keyboard will cause the map  
 
display to zoom in or out without interrupting your digitising session.
 
display to zoom in or out without interrupting your digitising session.
  
<P>
 
 
You can perform the following editing functions:
 
You can perform the following editing functions:
  
<P>
+
<ul>
 +
<li>Add Features: {{Template:ToolBtnTwo|mActionCapturePoint|Capture Point}},
 +
  {{Template:ToolBtnTwo|mActionCaptureLine|Capture Line}} and
 +
  {{Template:ToolBtnTwo|mActionCapturePolygon|Capture Polygon}}
 +
<li>{{Template:ToolBtnTwo|mActionAddRing|Add Ring}}
 +
<li>{{Template:ToolBtnTwo|mActionAddIsland|Add Island}}
 +
<li>{{Template:ToolBtnTwo|mActionSplitFeatures|Split Features}}
 +
<li>{{Template:ToolBtnTwo|mActionMoveFeature|Move Features}}
 +
<li>{{Template:ToolBtnTwo|mActionMoveVertex|Move Vertex}}
 +
<li>{{Template:ToolBtnTwo|mActionAddVertex|Add Vertex}}
 +
<li>{{Template:ToolBtnTwo|mActionDeleteVertex|Delete Vertex}}
 +
<li>{{Template:ToolBtnTwo|mActionDeleteSelected|Delete Selected}}
 +
<li>{{Template:ToolBtnTwo|mActionEditCut|Cut Features}}
 +
<li>{{Template:ToolBtnTwo|mActionEditCopy|Copy Features}}
 +
<li>{{Template:ToolBtnTwo|mActionEditPaste|Paste Features}}
 +
</ul>
  
<UL>
+
===== Adding Features =====
<LI>Add Features: mActionCapturePointCapture Point,
+
  mActionCaptureLineCapture Line and
+
  mActionCapturePolygonCapture Polygon
+
</LI>
+
<LI>mActionAddRingAdd Ring
+
</LI>
+
<LI>mActionAddIslandAdd Island
+
</LI>
+
<LI>mActionSplitFeaturesSplit Features
+
</LI>
+
<LI>mActionMoveFeatureMove Features
+
</LI>
+
<LI>mActionMoveVertexMove Vertex
+
</LI>
+
<LI>mActionAddVertexAdd Vertex
+
</LI>
+
<LI>mActionDeleteVertexDelete Vertex
+
</LI>
+
<LI>mActionDeleteSelectedDelete Selected
+
</LI>
+
<LI>mActionEditCutCut Features
+
</LI>
+
<LI>mActionEditCopyCopy Features
+
</LI>
+
<LI>mActionEditPastePaste Features
+
</LI>
+
</UL>
+
  
<P>
 
Adding Features
 
<A NAME="677"></A>
 
  
<P>
+
Before you start adding features, use the {{Template:ToolBtnTwo|mActionPan|pan}}
Before you start adding features, use the mActionPanpan
+
and {{Template:ToolBtnTwo|mActionZoomIn|zoom-in}}/{{Template:ToolBtnTwo|mActionZoomOut|zoom-out}}
and mActionZoomInzoom-in/mActionZoomOutzoom-out  
+
 
tools to first navigate to the area of interest.
 
tools to first navigate to the area of interest.
  
<P>
+
Then you can use the {{Template:ToolBtnTwo|mActionCapturePoint|Capture point}},
Then you can use the mActionCapturePointCapture point,
+
{{Template:ToolBtnTwo|mActionCaptureLine|Capture line}} or
mActionCaptureLineCapture line or
+
{{Template:ToolBtnTwo|mActionCapturePolygon|Capture polygon}} icons on the toolbar to put the QGIS cursor
mActionCapturePolygonCapture polygon icons on the toolbar to put the QGIS cursor
+
 
into digitizing mode.
 
into digitizing mode.
  
<P>
 
 
For each feature, you first digitize the geometry, then enter its attributes.
 
For each feature, you first digitize the geometry, then enter its attributes.
  
<P>
 
 
To digitize the geometry, left-click on the map area to create the
 
To digitize the geometry, left-click on the map area to create the
 
first point of your new feature.
 
first point of your new feature.
  
<P>
 
 
For lines and polygons, keep on left-clicking for each additional
 
For lines and polygons, keep on left-clicking for each additional
 
point you wish to capture.  When you have finished adding points,
 
point you wish to capture.  When you have finished adding points,
行320: 行228:
 
the geometry of that feature.
 
the geometry of that feature.
  
<P>
 
 
The attribute window will appear, allowing you to enter the information for the new feature.
 
The attribute window will appear, allowing you to enter the information for the new feature.
Figure <A HREF="#fig:vector_digitising">16</A> shows setting attributes for a fictitious
+
Figure [[fig:vector_digitising]] shows setting attributes for a fictitious
 
new river in Alaska.
 
new river in Alaska.
  
<P>
+
<table align='center'>
 +
<caption>'''Figure xx:''' Enter Attribute Values Dialog after digitizing a new vector
 +
  feature {{Template:Nix</caption>
 +
<tr><td>}caption}<span id='fig:vector_digitising'></span>
 +
  [[File:editDigitizing.png|302px]]</td></tr></table>
  
<DIV ALIGN="CENTER"><A NAME="fig:vector_digitising"></A><A NAME="693"></A>
+
{{Template:Tip
<TABLE>
+
|num=xx
<CAPTION ALIGN="BOTTOM"><STRONG>Figure:</STRONG>
+
|caption=Attribute Value Types
Enter Attribute Values Dialog after digitizing a new vector
+
|qgistip=
  feature </CAPTION>
+
At least for shapefile editing the attribue types are validated during the
<TR><TD>
+
entry. Because of this, it is not possible to enter a number into the text-column in
<DIV ALIGN="CENTER">
+
the dialog {{Template:Dialog|Enter Attribute Values} or vica versa. If you need to do so,
</DIV>
+
you should edit the attributes in a second step within the {{Template:Dialog|Attribute
<P></P>
+
table}} dialog.
<DIV ALIGN="CENTER">  [clip=true, width=8cm]editDigitizing
+
 
+
</DIV></TD></TR>
+
</TABLE>
+
</DIV>
+
 
+
<P>
+
<BR>
+
<IMG
+
WIDTH="135" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
+
SRC="img15.png"
+
ALT="\begin{Tip}
+
% latex2html id marker 698
+
[ht]\caption{\textsc{Attribute Value Type...
+
...ributes in a second step within the \dialog{Attribute
+
table} dialog.
+
 
}
 
}
\end{Tip}">
+
}}
<BR>
+
  
<P>
+
===== Move Feature =====
Move Feature
+
<A NAME="704"></A>
+
  
<P>
+
 
You can move features using the mActionMoveFeatureMove Feature icon
+
You can move features using the {{Template:ToolBtnTwo|mActionMoveFeature|Move Feature}} icon
 
on the toolbar.
 
on the toolbar.
  
<P>
+
===== Split Feature =====
Split Feature
+
<A NAME="708"></A>
+
  
<P>
+
 
You can split features using the mActionSplitFeaturesSplit Features icon
+
You can split features using the {{Template:ToolBtnTwo|mActionSplitFeatures|Split Features}} icon
 
on the toolbar.
 
on the toolbar.
  
<P>
+
===== Editing Vertices of a Feature =====
Editing Vertices of a Feature
+
 
<A NAME="712"></A>
+
  
<P>
 
 
For both PostgreSQL/PostGIS and shapefile-based layers, the vertices of features can be edited.  
 
For both PostgreSQL/PostGIS and shapefile-based layers, the vertices of features can be edited.  
  
<P>
 
 
Vertices can be directly edited, that is, you don't
 
Vertices can be directly edited, that is, you don't
 
have to choose which feature to edit before you can change
 
have to choose which feature to edit before you can change
行387: 行274:
 
down near map features:
 
down near map features:
  
<P>
+
<ul>
 
+
<li>'''Lines'''   - The nearest line to the mouse position
<UL>
+
<LI><SPAN  CLASS="textbf">Lines</SPAN>   - The nearest line to the mouse position
+
 
                           is used as the target feature.
 
                           is used as the target feature.
 
                           Then (for moving and deleting a vertex)
 
                           Then (for moving and deleting a vertex)
行396: 行281:
 
                           on that line is the editing target.
 
                           on that line is the editing target.
  
<P>
+
<li>'''Polygons''' - If the mouse is inside a polygon, then it is
</LI>
+
<LI><SPAN  CLASS="textbf">Polygons</SPAN> - If the mouse is inside a polygon, then it is
+
 
                           the target feature; otherwise the nearest polygon
 
                           the target feature; otherwise the nearest polygon
 
                           is used.
 
                           is used.
行404: 行287:
 
                           the nearest vertex
 
                           the nearest vertex
 
                           on that polygon is the editing target.
 
                           on that polygon is the editing target.
</LI>
+
</ul>
</UL>
+
  
<P>
 
 
You will need to set the property
 
You will need to set the property
Settings&gt;mActionOptionsOptions&gt;Digitizing&gt;Search Radius10
+
{{Template:MainMenuOpt|Settings}}>{{Template:DropMenuOptTwo|mActionOptions|Options}}>{{Template:Tab|Digitizing}}>{{Template:SelectNumber|Search Radius|10}}
 
to a number greater than zero.  Otherwise QGIS will not be able to tell which feature is being edited.
 
to a number greater than zero.  Otherwise QGIS will not be able to tell which feature is being edited.
  
<P>
 
Adding Vertices of a Feature
 
<A NAME="724"></A>
 
  
<P>
+
===== Adding Vertices of a Feature =====
 +
 
 +
 
 
You can add new vertices to a feature by using the
 
You can add new vertices to a feature by using the
mActionAddVertexAdd Vertex icon
+
{{Template:ToolBtnTwo|mActionAddVertex|Add Vertex}} icon
 
on the toolbar.
 
on the toolbar.
  
<P>
 
 
Note, it doesn't make sense to add more vertices to a Point feature!
 
Note, it doesn't make sense to add more vertices to a Point feature!
  
<P>
+
In this version of QGIS, vertices can only be added to an ''existing'' line
In this version of QGIS, vertices can only be added to an <SPAN  CLASS="textit">existing</SPAN> line
+
 
segment of a line feature.  If you want to extend a line beyond its end,
 
segment of a line feature.  If you want to extend a line beyond its end,
 
you will need to move the terminating vertex first, then add a new vertex where
 
you will need to move the terminating vertex first, then add a new vertex where
 
the terminus used to be.
 
the terminus used to be.
  
<P>
+
===== Moving Vertices of a Feature =====
Moving Vertices of a Feature
+
<A NAME="729"></A>
+
  
<P>
+
 
You can move vertices using the mActionMoveVertexMove Vertex icon
+
You can move vertices using the {{Template:ToolBtnTwo|mActionMoveVertex|Move Vertex}} icon
 
on the toolbar.
 
on the toolbar.
  
<P>
+
===== Deleting Vertices of a Feature =====
Deleting Vertices of a Feature
+
 
<A NAME="733"></A>
+
  
<P>
+
You can delete vertices by using the {{Template:ToolBtnTwo|mActionDeleteVertex|Delete Vertex}} icon
You can delete vertices by using the mActionDeleteVertexDelete Vertex icon
+
 
on the toolbar.
 
on the toolbar.
  
<P>
 
 
Note, it doesn't make sense to delete the vertex of a Point feature!
 
Note, it doesn't make sense to delete the vertex of a Point feature!
 
Delete the whole feature instead.
 
Delete the whole feature instead.
  
<P>
 
 
Similarly, a one-vertex line or a two-vertex polygon is also
 
Similarly, a one-vertex line or a two-vertex polygon is also
 
fairly useless and will lead to unpredictable results elsewhere
 
fairly useless and will lead to unpredictable results elsewhere
 
in QGIS, so don't do that.
 
in QGIS, so don't do that.
  
<P>
+
'''Warning:''' A vertex is identified for deletion as
<SPAN  CLASS="textbf">Warning:</SPAN> A vertex is identified for deletion as
+
 
soon as you click the mouse near an eligible
 
soon as you click the mouse near an eligible
 
feature.  To undo, you will need to toggle
 
feature.  To undo, you will need to toggle
行462: 行333:
 
(Of course this will mean that other unsaved changes will be lost, too.)
 
(Of course this will mean that other unsaved changes will be lost, too.)
  
<P>
+
===== Add Ring =====
Add Ring
+
<A NAME="738"></A>
+
  
<P>
+
 
You can create ring polygons using the mActionAddRingAdd Ring
+
You can create ring polygons using the {{Template:ToolBtnTwo|mActionAddRing|Add Ring}}
 
icon in the toolbar. This means inside an existing area it is
 
icon in the toolbar. This means inside an existing area it is
 
possible to digitize further polygons, that will occur as a 'whole', so only  
 
possible to digitize further polygons, that will occur as a 'whole', so only  
行473: 行342:
 
a ring polygon.  
 
a ring polygon.  
  
<P>
+
===== Add Island =====
Add Island
+
<A NAME="742"></A>
+
  
<P>
+
 
You can mActionAddIslandadd island polygons to a selected multipolygon.  
+
You can {{Template:ToolBtnTwo|mActionAddIsland|add island}} polygons to a selected multipolygon.  
 
The new island polygon has to be digitized outside the selected multipolygon.  
 
The new island polygon has to be digitized outside the selected multipolygon.  
  
<P>
+
===== Cutting, Copying and Pasting Features =====
Cutting, Copying and Pasting Features
+
 
<A NAME="746"></A>
+
 
<A NAME="747"></A>
+
 
<A NAME="748"></A>
+
 
<A NAME="749"></A>
+
 
<A NAME="750"></A>
+
 
<A NAME="751"></A>
+
  
<P>
 
 
Selected features can be cut, copied and pasted between layers in the
 
Selected features can be cut, copied and pasted between layers in the
 
same QGIS project, as long as destination layers are set to  
 
same QGIS project, as long as destination layers are set to  
mActionToggleEditingToggle editing beforehand.
+
{{Template:ToolBtnTwo|mActionToggleEditing|Toggle editing}} beforehand.
  
<P>
 
 
Features can also be pasted to external applications as text:  That is,
 
Features can also be pasted to external applications as text:  That is,
 
the features are represented in CSV format with the geometry data appearing  
 
the features are represented in CSV format with the geometry data appearing  
 
in the OGC Well-Known Text (WKT) format.
 
in the OGC Well-Known Text (WKT) format.
  
<P>
+
 
 
However in this version of QGIS, text features from outside QGIS cannot  
 
However in this version of QGIS, text features from outside QGIS cannot  
 
be pasted to a layer within QGIS. When would the copy and paste function  
 
be pasted to a layer within QGIS. When would the copy and paste function  
行506: 行370:
 
at a time and copy/paste features between layers. Why would we want to do  
 
at a time and copy/paste features between layers. Why would we want to do  
 
this?  Say we need to do some work on a new layer but only need one or  
 
this?  Say we need to do some work on a new layer but only need one or  
two lakes, not the 5,000 on our big_lakes layer. We can create  
+
two lakes, not the 5,000 on our {{Template:FileName|big_lakes}} layer. We can create  
 
a new layer and use copy/paste to plop the needed lakes into it.  
 
a new layer and use copy/paste to plop the needed lakes into it.  
  
<P>
 
 
As an example we are copying some lakes to a new layer:
 
As an example we are copying some lakes to a new layer:
  
<P>
+
<ol>
 +
<li>Load the layer you want to copy from (source layer)
 +
<li>Load or create the layer you want to copy to (target layer)
 +
<li>Start editing for target layer
 +
<li>Make the source layer active by clicking on it in the legend
 +
<li>Use the {{Template:ToolBtnTwo|mActionSelect|Select}} tool to select the feature(s) on the source layer
 +
<li>Click on the {{Template:ToolBtnTwo|mActionEditCopy|Copy Features}} tool
 +
<li>Make the destination layer active by clicking on it in the legend
 +
<li>Click on the {{Template:ToolBtnTwo|mActionEditPaste|Paste Features}} tool
 +
<li>Stop editing and save the changes
 +
</ol>
  
<OL>
 
<LI>Load the layer you want to copy from (source layer)
 
</LI>
 
<LI>Load or create the layer you want to copy to (target layer)
 
</LI>
 
<LI>Start editing for target layer
 
</LI>
 
<LI>Make the source layer active by clicking on it in the legend
 
</LI>
 
<LI>Use the mActionSelectSelect tool to select the feature(s) on the source layer
 
</LI>
 
<LI>Click on the mActionEditCopyCopy Features tool
 
</LI>
 
<LI>Make the destination layer active by clicking on it in the legend
 
</LI>
 
<LI>Click on the mActionEditPastePaste Features tool
 
</LI>
 
<LI>Stop editing and save the changes
 
</LI>
 
</OL>
 
 
<P>
 
 
What happens if the source and target layers have
 
What happens if the source and target layers have
 
different schemas (field names and types are not the same)? QGIS populates
 
different schemas (field names and types are not the same)? QGIS populates
行543: 行394:
 
attributes - gets copied, make sure the schemas match.
 
attributes - gets copied, make sure the schemas match.
  
<P>
+
{{Template:Tip
<BR>
+
|num=xx
<IMG
+
|caption=Congruency of Pasted Features
WIDTH="188" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
+
|qgistip=If your source and destination layers use the
SRC="img16.png"
+
same projection, then the pasted features will have
ALT="\begin{Tip}
+
geometry identical to the source layer.
% latex2html id marker 763
+
However if the destination layer is a different projection
[ht]\caption{\textsc{Congruency of Pasted...
+
then QGIS cannot guarantee the geometry is identical.
...ll rounding-off errors
+
This is simply because there are small rounding-off errors
 
involved when converting between projections.
 
involved when converting between projections.
}
 
\end{Tip}">
 
<BR>
 
  
<P>
+
}}
Deleting Selected Features
+
 
<A NAME="768"></A>
+
===== Deleting Selected Features =====
 +
 
  
<P>
 
 
If we want to delete an entire polygon, we can do that by first selecting  
 
If we want to delete an entire polygon, we can do that by first selecting  
the polygon using the regular mActionSelectSelect Features tool. You can select  
+
the polygon using the regular {{Template:ToolBtnTwo|mActionSelect|Select Features}} tool. You can select  
 
multiple features for deletion. Once you have the selection set, use the  
 
multiple features for deletion. Once you have the selection set, use the  
mActionDeleteSelectedDelete Selected tool to delete the features. There is no undo function,  
+
{{Template:ToolBtnTwo|mActionDeleteSelected|Delete Selected}} tool to delete the features. There is no undo function,  
 
but remember your layer isn't really changed until you stop editing and choose  
 
but remember your layer isn't really changed until you stop editing and choose  
 
to save your changes. So if you make a mistake, you can always cancel the save.
 
to save your changes. So if you make a mistake, you can always cancel the save.
  
<P>
+
The {{Template:ToolBtnTwo|mActionEditCut|Cut Features}} tool on the digitizing toolbar can
The mActionEditCutCut Features tool on the digitizing toolbar can
+
 
also be used to delete features. This effectively deletes the feature but
 
also be used to delete features. This effectively deletes the feature but
 
also places it on a ``spatial clipboard". So we cut the feature to delete.  
 
also places it on a ``spatial clipboard". So we cut the feature to delete.  
We could then use the mActionEditPastepaste tool to put it back, giving us a one-level undo  
+
We could then use the {{Template:ToolBtnTwo|mActionEditPaste|paste tool}} to put it back, giving us a one-level undo  
 
capability. Cut, copy, and paste work on the currently selected features,  
 
capability. Cut, copy, and paste work on the currently selected features,  
 
meaning we can operate on more than one at a time.
 
meaning we can operate on more than one at a time.
  
<P>
+
{{Template:Tip
<BR>
+
|num=xx
<IMG
+
|caption=Feature Deletion Support
WIDTH="264" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
+
|qgistip=When editing ESRI shapefiles, the deletion
SRC="img17.png"
+
of features only works if QGIS is linked to a GDAL version 1.3.2 or greater.  
ALT="\begin{Tip}
+
The OS X and Windows versions of QGIS available from the download site are built  
% latex2html id marker 777
+
[ht]\caption{\textsc{Feature Deletion Sup...
+
...ilable from the download site are built
+
 
using GDAL 1.3.2 or higher.
 
using GDAL 1.3.2 or higher.
}
 
\end{Tip}">
 
<BR>
 
  
<P>
+
}}
Snap Mode
+
 
<A NAME="782"></A>
+
===== Snap Mode =====
 +
 
 
QGIS allows digitized vertices to be snapped to other vertices of the same layer. To  
 
QGIS allows digitized vertices to be snapped to other vertices of the same layer. To  
 
set the snapping tolerance, go to
 
set the snapping tolerance, go to
Settings&gt;mActionOptionsOptions-&gt;Digitizing.
+
{{Template:MainMenuOpt|Settings}}>{{Template:DropMenuOptTwo|mActionOptions|Options}}->{{Template:Tab|Digitizing}}.
(On Mac: go to  QGIS &gt; Preferences, on Linux: Edit &gt; mActionOptionsOptions.)
+
(On Mac: go to  {{Template:MainMenuOpt|QGIS}} > Preferences, on Linux: {{Template:MainMenuOpt|Edit}} > {{Template:DropMenuOptTwo|mActionOptions|Options}}.)
 
Note that the snapping tolerance is in map units or pixels.
 
Note that the snapping tolerance is in map units or pixels.
  
<P>
+
===== Saving Edited Layers =====
Saving Edited Layers
+
 
<A NAME="792"></A>
+
  
<P>
 
 
When a layer is in editing mode, any changes remain in the memory of QGIS.
 
When a layer is in editing mode, any changes remain in the memory of QGIS.
 
Therefore they are not committed/saved immediately to the data source or disk.
 
Therefore they are not committed/saved immediately to the data source or disk.
行611: 行451:
 
changes or discard them.
 
changes or discard them.
  
<P>
 
 
If the changes cannot be saved (e.g. disk full, or the attributes have
 
If the changes cannot be saved (e.g. disk full, or the attributes have
 
values that are out of range), the QGIS in-memory state is preserved.  This
 
values that are out of range), the QGIS in-memory state is preserved.  This
 
allows you to adjust your edits and try again.
 
allows you to adjust your edits and try again.
  
<P>
+
==== Creating a New Layer ====
 
+
<span id='sec:create shape'></span>
<H3>
+
To create a new layer for editing, choose {{Template:ToolBtnTwo|mActionNewVectorLayer|New Vector Layer}} from the
Creating a New Layer
+
{{Template:MainMenuOpt|Layer}} menu.  
</H3>
+
The {{Template:Dialog|New Vector Layer}} dialog will be displayed as
 
+
shown in Figure [[fig:newvectorlayer]]. Choose the type of layer (point,
<P>
+
To create a new layer for editing, choose mActionNewVectorLayerNew Vector Layer from the
+
Layer menu.  
+
The New Vector Layer dialog will be displayed as
+
shown in Figure <A HREF="#fig:newvectorlayer">17</A>. Choose the type of layer (point,
+
 
line or polygon).
 
line or polygon).
  
<P>
+
<table align='center'>
 +
<caption>'''Figure xx:''' Creating a New Vector Dialog {{Template:Nix</caption>
 +
<tr><td>}caption}<span id='fig:newvectorlayer'></span>
 +
  [[File:editNewVector.png|378px]]</td></tr></table>
  
<DIV ALIGN="CENTER"><A NAME="fig:newvectorlayer"></A><A NAME="803"></A>
 
<TABLE>
 
<CAPTION ALIGN="BOTTOM"><STRONG>Figure:</STRONG>
 
Creating a New Vector Dialog </CAPTION>
 
<TR><TD>
 
<DIV ALIGN="CENTER">
 
</DIV>
 
<P></P>
 
<DIV ALIGN="CENTER">  [clip=true, width=10cm]editNewVector
 
 
</DIV></TD></TR>
 
</TABLE>
 
</DIV>
 
 
<P>
 
 
Note that QGIS does not yet support creation of 2.5D
 
Note that QGIS does not yet support creation of 2.5D
 
features (i.e. features with X,Y,Z coordinates) or measure features. At this
 
features (i.e. features with X,Y,Z coordinates) or measure features. At this
行651: 行473:
 
any OGR or PostgreSQL layer type will be supported.  
 
any OGR or PostgreSQL layer type will be supported.  
  
<P>
 
 
Creation of GRASS-layers is supported within the GRASS-plugin. Please refer to section
 
Creation of GRASS-layers is supported within the GRASS-plugin. Please refer to section
<A HREF="#sec:creating_new_grass_vectors"><IMG  ALIGN="BOTTOM" BORDER="1" ALT="[*]"
+
[[sec:creating_new_grass_vectors]] for more information on creating GRASS vector  
SRC="/usr/share/latex2html/icons/crossref.png"></A> for more information on creating GRASS vector  
+
 
layers.
 
layers.
  
<P>
 
 
To complete the creation of the new layer, add the desired attributes by
 
To complete the creation of the new layer, add the desired attributes by
clicking on the Add button and specifying a name and type for the
+
clicking on the {{Template:Button|Add}} button and specifying a name and type for the
attribute. Only Typereal, Typeinteger, and Typestring attributes are supported. Once you
+
attribute. Only {{Template:SelectString|Type|real}}, {{Template:SelectString|Type|integer}}, and {{Template:SelectString|Type|string}} attributes are supported. Once you
are happy with the attributes, click OK and provide a name for the shapefile.
+
are happy with the attributes, click {{Template:Button|OK}} and provide a name for the shapefile.
QGIS will automatically add a .shp extension to the name you specify.  Once
+
QGIS will automatically add a {{Template:FileName|.shp}} extension to the name you specify.  Once
 
the layer has been created, it will be added to the map and you can edit it in
 
the layer has been created, it will be added to the map and you can edit it in
the same way as described in Section <A HREF="node26.html#sec:edit_existing_layer">5.5.3</A> above.
+
the same way as described in Section [[sec:edit_existing_layer]] above.  
  
<H3>
+
==== Working with the Attribute Table ====
Working with the Attribute Table
+
<span id='sec:attribute table'></span>
</H3>
+
 
+
<P>
+
 
To open the attribute table for a vector layer, make the layer active by clicking on it in the Map legend area.  
 
To open the attribute table for a vector layer, make the layer active by clicking on it in the Map legend area.  
Then use Layer Layer from the main menu and and choose mActionOpenTableOpen Attribute Table  
+
Then use {{Template:MainMenuOpt|Layer}} Layer from the main menu and and choose {{Template:DropMenuOptTwo|mActionOpenTable|Open Attribute Table}}
from the menu. It is also possible to rightlick on the layer and choose mActionOpenTableOpen Attribute Table  
+
from the menu. It is also possible to rightlick on the layer and choose {{Template:DropMenuOptTwo|mActionOpenTable|Open Attribute Table}}
 
from the dropdown menu. This will open a new window which displays the attributes for every feature in the layer  
 
from the dropdown menu. This will open a new window which displays the attributes for every feature in the layer  
(figure <A HREF="#fig:attributetable">18</A>).
+
(figure [[fig:attributetable]]).
 
+
<P>
+
 
+
<DIV ALIGN="CENTER"><A NAME="fig:attributetable"></A><A NAME="830"></A>
+
<TABLE>
+
<CAPTION ALIGN="BOTTOM"><STRONG>Figure:</STRONG>
+
Attribute Table for Alaska layer </CAPTION>
+
<TR><TD>
+
<DIV ALIGN="CENTER">
+
</DIV>
+
<P></P>
+
<DIV ALIGN="CENTER">  [clip=true, width=12cm]vectorAttributeTable
+
  
</DIV></TD></TR>
+
<table align='center'>
</TABLE>
+
<caption>'''Figure xx:''' Attribute Table for Alaska layer {{Template:Nix</caption>
</DIV>
+
<tr><td>}caption}<span id='fig:attributetable'></span>
 +
  [[File:vectorAttributeTable.png|454px]]</td></tr></table>
  
<P>
 
 
Each column can be sorted by clicking on its header. A small arrow indicates the sort  
 
Each column can be sorted by clicking on its header. A small arrow indicates the sort  
 
order (downward pointing means descending values from the top row down, upward pointing means  
 
order (downward pointing means descending values from the top row down, upward pointing means  
 
ascending values from the top rown down).  
 
ascending values from the top rown down).  
For a simple selection by attributes on only one column the Look for field  
+
For a simple selection by attributes on only one column the {{Template:Button|Look for}} field  
 
can be used. Select the field (column) from which the search should be performed from  
 
can be used. Select the field (column) from which the search should be performed from  
the dropdown menu and hit the Search button. For more complex searches use the
+
the dropdown menu and hit the {{Template:Button|Search}} button. For more complex searches use the
Advanced search ..., which will lauch the Search Query Builder described in  
+
Advanced search {{Template:Button|...}}, which will lauch the Search Query Builder described in  
Section <A HREF="node30.html#sec:select_by_query">5.7</A>.  
+
Section [[sec:select_by_query]].  
  
<P>
+
To show selected records only, use the checkbox {{Template:CheckBox|Show selected records only}}.
To show selected records only, use the checkbox Show selected records only.
+
 
Using the buttons at the bottom left of the window, selected fields can be removed,  
 
Using the buttons at the bottom left of the window, selected fields can be removed,  
 
moved to the top of the table, or the selection can be inverted. Selected features can  
 
moved to the top of the table, or the selection can be inverted. Selected features can  
also be copied to the clipboard, which can also be done with Ctrl-C. You can also zoom  
+
also be copied to the clipboard, which can also be done with {{Template:KeyStroke|Ctrl-C}}. You can also zoom  
 
into the selected features on the map. Toggle editing allows to edit single values of attributes.
 
into the selected features on the map. Toggle editing allows to edit single values of attributes.

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

Editing

QGIS supports basic capabilities for editing vector geometries. Before reading any further you should note that at this stage editing support is still preliminary. Before performing any edits, always make a backup of the dataset you are about to edit.

Note - the procedure for editing GRASS layers is different - see Section grass_digitising for details.

Setting the Snapping Tolerance and Search Radius

Before we can edit vertices, it is very important to set the snapping tolerance and search radius to a value that allows us an optimal editing of the vector layer geometries.

Snapping tolerance

Snapping tolerance is the distance QGIS uses to search for the closest vertex and/or segment you are trying to connect when you set a new vertex or move an existing vertex. If you aren't within the snap tolerance, QGIS will leave the vertex where you release the mouse button, instead of snapping it to an existing vertex and/or segment.

  1. A general, project wide snapping tolerance can be defined choosing Settings > MActionOptions.png Options. (On Mac: go to QGIS > Preferences, on Linux: Edit > MActionOptions.png Options.) In the Digitizing tab you can select between to vertex, to segment or to vertex and segment as default snap mode. You can also define a default snapping tolerance and a search radius for vertex edits. The tolerance an be set either in map units or in pixels. In our digitizing project (working with the Alaska dataset), the units are in feet. Your results may vary, but something on the order of 300ft should be fine at a scale of 1:10 000 should be a reasonable setting.
  2. A layer based snapping tolerance can be defined by choosing Settings (or File) > MActionOptions.png Project Properties.... In the General tab, section Digitize you can click on Snapping options... to enable and adjust snapping mode and tolerance on a layer basis (see Figure~fig:snappingoptions).
Figure xx: Edit snapping options on a layer basis {{Template:Nix
}caption} EditProjectSnapping.png
Search radius

Search radius is the distance QGIS uses to search for the closest vertex you are trying to move when you click on the map. If you aren't within the search radius, QGIS won't find and select any vertex for editing and it will pop up an annoying warning to that effect. Snap tolerance and search radius are set in map units or pixels, so you may find you need to experiment to get them set right. If you specify too big of a tolerance, QGIS may snap to the wrong vertex, especially if you are dealing with a large number of vertices in close proximity. Set search radius too small and it won't find anything to move.

The search radius for vertex edits in layer units can be defined in the Digitizing tab under Settings > MActionOptions.png Options. The same place where you define the general, project wide snapping tolerance.

Topological editing

Besides layer based snapping options the General tab in menu Settings -> MActionOptions.png Project Properties... also provides some topological functionalities. In the Digitizing option group you can CheckBox.pngEnable topological editing and/or activate CheckBox.pngAvoid intersections of new polygons.

Enable topological editing

The option CheckBox.pngEnable topological editing is for editing and maintaining common boundaries in polygon mosaics. QGIS "detects" a shared boundary in a polygon mosaic and you only have to move the vertex once and QGIS will take care about updating the other boundary.

Avoid intersections of new polygons

The second topological option called CheckBox.pngAvoid intersections of new polygons avoids overlaps in polygon mosaics. It is for quicker digitizing of adjacent polygons. If you already have one polygon, it is possible with this option to digitise the second one such that both intersect and qgis then cuts the second polygon to the common boundary. The advantage is that users don't have to digitize all vertices of the common boundary.

Editing an Existing Layer

By default, QGIS loads layers read-only: This is a safeguard to avoid accidentally editing a layer if there is a slip of the mouse. However, you can choose to edit any layer as long as the data provider supports it, and the underlying data source is writable (i.e. its files are not read-only).

Layer editing is most versatile when used on PostgreSQL/PostGIS data sources.


Tip xx Data Integrity


It is always a good idea to back up your data source before you start editing. While the authors of QGIS have made every effort to preserve the integrity of your data, we offer no warranty in this regard.




Tip xx Manipulating Attribute data


Currently only PostGIS layers are supported for adding or dropping attribute columns within this dialog. In future versions of QGIS, other datasources will be supported, because this feature was recently implemented in GDAL/OGR > 1.6.0




{{Template:Tip |num=xx |caption=Save Regularly |qgistip=Remember to toggle MActionToggleEditing.png Toggle editing} off regularly. This allows you to save your recent changes, and also confirms that your data source can accept all your changes. }


Tip xx Concurrent Edits


This version of QGIS does not track if somebody else is editing a feature at the same time as you. The last person to save their edits wins.




Tip xx Zoom in Before Editing


Before editing a layer, you should zoom in to your area of interest. This avoids waiting while all the vertex markers are rendered across the entire layer.



{{Template:Tip |num=xx |caption=Vertex Markers |qgistip= The current version of QGIS supports two kinds of vertex-markers - a semi-transparent circle or a cross. To change the marker style, choose MActionOptions.png Options} from the Settings menu and click on the Digitizing tab and select the appropriate entry. }

All editing sessions start by choosing the MActionToggleEditing.png Toggle editing option. This can be found in the context menu after right clicking on the legend entry for that layer. Alternately, you can use the MActionToggleEditing.png Toggle editing button from the toolbar to start or stop the editing mode. Once the layer is in edit mode, markers will appear at the vertices, and additional tool buttons on the editing toolbar will become available.

Zooming and panning with the mouse wheel

While digitizing you can press the mouse wheel to pan inside of the main window and you can roll the mouse wheel to zoom in and out on the map. For zooming place the mouse cursor inside the map area and roll it forward (away from you) to zoom in and backwards (towards you) to zoom out. The mouse cursor position will be the center of the zoomed area of interest. You can customize the behavior of the mouse wheel zoom using the Map tools tab under the Settings >Options menu.

Panning with the arrow keys

Panning the Map during digitizing is possible with the arrow keys. Place the mouse cursor inside the map area and click on the right arrow key to pan east, left arrow key to pan west, up arrow key to pan north and down arrow key to pan south.

You can also use the spacebar to temporarily cause mouse movements to pan then map. The PgUp and PgDown keys on your keyboard will cause the map display to zoom in or out without interrupting your digitising session.

You can perform the following editing functions:

  • Add Features: MActionCapturePoint.png Capture Point, MActionCaptureLine.png Capture Line and MActionCapturePolygon.png Capture Polygon
  • MActionAddRing.png Add Ring
  • MActionAddIsland.png Add Island
  • MActionSplitFeatures.png Split Features
  • MActionMoveFeature.png Move Features
  • MActionMoveVertex.png Move Vertex
  • MActionAddVertex.png Add Vertex
  • MActionDeleteVertex.png Delete Vertex
  • MActionDeleteSelected.png Delete Selected
  • MActionEditCut.png Cut Features
  • MActionEditCopy.png Copy Features
  • MActionEditPaste.png Paste Features
Adding Features

Before you start adding features, use the MActionPan.png pan and MActionZoomIn.png zoom-in/MActionZoomOut.png zoom-out tools to first navigate to the area of interest.

Then you can use the MActionCapturePoint.png Capture point, MActionCaptureLine.png Capture line or MActionCapturePolygon.png Capture polygon icons on the toolbar to put the QGIS cursor into digitizing mode.

For each feature, you first digitize the geometry, then enter its attributes.

To digitize the geometry, left-click on the map area to create the first point of your new feature.

For lines and polygons, keep on left-clicking for each additional point you wish to capture. When you have finished adding points, right-click anywhere on the map area to confirm you have finished entering the geometry of that feature.

The attribute window will appear, allowing you to enter the information for the new feature. Figure fig:vector_digitising shows setting attributes for a fictitious new river in Alaska.

Figure xx: Enter Attribute Values Dialog after digitizing a new vector feature {{Template:Nix
}caption} EditDigitizing.png

{{Template:Tip |num=xx |caption=Attribute Value Types |qgistip= At least for shapefile editing the attribue types are validated during the entry. Because of this, it is not possible to enter a number into the text-column in the dialog Enter Attribute Values} or vica versa. If you need to do so, you should edit the attributes in a second step within the <b>Attribute table</b> dialog. }

Move Feature

You can move features using the MActionMoveFeature.png Move Feature icon on the toolbar.

Split Feature

You can split features using the MActionSplitFeatures.png Split Features icon on the toolbar.

Editing Vertices of a Feature

For both PostgreSQL/PostGIS and shapefile-based layers, the vertices of features can be edited.

Vertices can be directly edited, that is, you don't have to choose which feature to edit before you can change its geometry. In some cases, several features may share the same vertex and so the following rules apply when the mouse is pressed down near map features:

  • Lines - The nearest line to the mouse position is used as the target feature. Then (for moving and deleting a vertex) the nearest vertex on that line is the editing target.
  • Polygons - If the mouse is inside a polygon, then it is the target feature; otherwise the nearest polygon is used. Then (for moving and deleting a vertex) the nearest vertex on that polygon is the editing target.

You will need to set the property Settings>MActionOptions.png Options>Digitizing>Search Radius10SelectNumber.png to a number greater than zero. Otherwise QGIS will not be able to tell which feature is being edited.


Adding Vertices of a Feature

You can add new vertices to a feature by using the MActionAddVertex.png Add Vertex icon on the toolbar.

Note, it doesn't make sense to add more vertices to a Point feature!

In this version of QGIS, vertices can only be added to an existing line segment of a line feature. If you want to extend a line beyond its end, you will need to move the terminating vertex first, then add a new vertex where the terminus used to be.

Moving Vertices of a Feature

You can move vertices using the MActionMoveVertex.png Move Vertex icon on the toolbar.

Deleting Vertices of a Feature

You can delete vertices by using the MActionDeleteVertex.png Delete Vertex icon on the toolbar.

Note, it doesn't make sense to delete the vertex of a Point feature! Delete the whole feature instead.

Similarly, a one-vertex line or a two-vertex polygon is also fairly useless and will lead to unpredictable results elsewhere in QGIS, so don't do that.

Warning: A vertex is identified for deletion as soon as you click the mouse near an eligible feature. To undo, you will need to toggle Editing off and then discard your changes. (Of course this will mean that other unsaved changes will be lost, too.)

Add Ring

You can create ring polygons using the MActionAddRing.png Add Ring icon in the toolbar. This means inside an existing area it is possible to digitize further polygons, that will occur as a 'whole', so only the area in between the boundaries of the outer and inner polygons remain as a ring polygon.

Add Island

You can MActionAddIsland.png add island polygons to a selected multipolygon. The new island polygon has to be digitized outside the selected multipolygon.

Cutting, Copying and Pasting Features

Selected features can be cut, copied and pasted between layers in the same QGIS project, as long as destination layers are set to MActionToggleEditing.png Toggle editing beforehand.

Features can also be pasted to external applications as text: That is, the features are represented in CSV format with the geometry data appearing in the OGC Well-Known Text (WKT) format.


However in this version of QGIS, text features from outside QGIS cannot be pasted to a layer within QGIS. When would the copy and paste function come in handy? Well, it turns out that you can edit more than one layer at a time and copy/paste features between layers. Why would we want to do this? Say we need to do some work on a new layer but only need one or two lakes, not the 5,000 on our big_lakes layer. We can create a new layer and use copy/paste to plop the needed lakes into it.

As an example we are copying some lakes to a new layer:

  1. Load the layer you want to copy from (source layer)
  2. Load or create the layer you want to copy to (target layer)
  3. Start editing for target layer
  4. Make the source layer active by clicking on it in the legend
  5. Use the MActionSelect.png Select tool to select the feature(s) on the source layer
  6. Click on the MActionEditCopy.png Copy Features tool
  7. Make the destination layer active by clicking on it in the legend
  8. Click on the MActionEditPaste.png Paste Features tool
  9. Stop editing and save the changes

What happens if the source and target layers have different schemas (field names and types are not the same)? QGIS populates what matches and ignores the rest. If you don't care about the attributes being copied to the target layer, it doesn't matter how you design the fields and data types. If you want to make sure everything - feature and its attributes - gets copied, make sure the schemas match.


Tip xx Congruency of Pasted Features


If your source and destination layers use the same projection, then the pasted features will have geometry identical to the source layer. However if the destination layer is a different projection then QGIS cannot guarantee the geometry is identical. This is simply because there are small rounding-off errors involved when converting between projections.



Deleting Selected Features

If we want to delete an entire polygon, we can do that by first selecting the polygon using the regular MActionSelect.png Select Features tool. You can select multiple features for deletion. Once you have the selection set, use the MActionDeleteSelected.png Delete Selected tool to delete the features. There is no undo function, but remember your layer isn't really changed until you stop editing and choose to save your changes. So if you make a mistake, you can always cancel the save.

The MActionEditCut.png Cut Features tool on the digitizing toolbar can also be used to delete features. This effectively deletes the feature but also places it on a ``spatial clipboard". So we cut the feature to delete. We could then use the MActionEditPaste.png paste tool to put it back, giving us a one-level undo capability. Cut, copy, and paste work on the currently selected features, meaning we can operate on more than one at a time.


Tip xx Feature Deletion Support


When editing ESRI shapefiles, the deletion of features only works if QGIS is linked to a GDAL version 1.3.2 or greater. The OS X and Windows versions of QGIS available from the download site are built using GDAL 1.3.2 or higher.



Snap Mode

QGIS allows digitized vertices to be snapped to other vertices of the same layer. To set the snapping tolerance, go to Settings>MActionOptions.png Options->Digitizing. (On Mac: go to QGIS > Preferences, on Linux: Edit > MActionOptions.png Options.) Note that the snapping tolerance is in map units or pixels.

Saving Edited Layers

When a layer is in editing mode, any changes remain in the memory of QGIS. Therefore they are not committed/saved immediately to the data source or disk. When you turn editing mode off (or quit QGIS for that matter), you are then asked if you want to save your changes or discard them.

If the changes cannot be saved (e.g. disk full, or the attributes have values that are out of range), the QGIS in-memory state is preserved. This allows you to adjust your edits and try again.

Creating a New Layer

To create a new layer for editing, choose MActionNewVectorLayer.png New Vector Layer from the Layer menu. The New Vector Layer dialog will be displayed as shown in Figure fig:newvectorlayer. Choose the type of layer (point, line or polygon).

Figure xx: Creating a New Vector Dialog {{Template:Nix
}caption} EditNewVector.png

Note that QGIS does not yet support creation of 2.5D features (i.e. features with X,Y,Z coordinates) or measure features. At this time, only shapefiles can be created. In a future version of QGIS, creation of any OGR or PostgreSQL layer type will be supported.

Creation of GRASS-layers is supported within the GRASS-plugin. Please refer to section sec:creating_new_grass_vectors for more information on creating GRASS vector layers.

To complete the creation of the new layer, add the desired attributes by clicking on the Add button and specifying a name and type for the attribute. Only Type real SelectString.png, Type integer SelectString.png, and Type string SelectString.png attributes are supported. Once you are happy with the attributes, click OK and provide a name for the shapefile. QGIS will automatically add a .shp extension to the name you specify. Once the layer has been created, it will be added to the map and you can edit it in the same way as described in Section sec:edit_existing_layer above.

Working with the Attribute Table

To open the attribute table for a vector layer, make the layer active by clicking on it in the Map legend area. Then use Layer Layer from the main menu and and choose MActionOpenTable.png Open Attribute Table from the menu. It is also possible to rightlick on the layer and choose MActionOpenTable.png Open Attribute Table from the dropdown menu. This will open a new window which displays the attributes for every feature in the layer (figure fig:attributetable).

Figure xx: Attribute Table for Alaska layer {{Template:Nix
}caption} VectorAttributeTable.png

Each column can be sorted by clicking on its header. A small arrow indicates the sort order (downward pointing means descending values from the top row down, upward pointing means ascending values from the top rown down). For a simple selection by attributes on only one column the Look for field can be used. Select the field (column) from which the search should be performed from the dropdown menu and hit the Search button. For more complex searches use the Advanced search ..., which will lauch the Search Query Builder described in Section sec:select_by_query.

To show selected records only, use the checkbox CheckBox.pngShow selected records only. Using the buttons at the bottom left of the window, selected fields can be removed, moved to the top of the table, or the selection can be inverted. Selected features can also be copied to the clipboard, which can also be done with Ctrl-C. You can also zoom into the selected features on the map. Toggle editing allows to edit single values of attributes.