「編集」の版間の差分

提供: OSGeo.JP Wiki
移動: 案内検索
(タグ・画像調整前に一旦配下を統合)
行13: 行13:
 
Section <A HREF="#grass_digitising"><IMG  ALIGN="BOTTOM" BORDER="1" ALT="[*]"
 
Section <A HREF="#grass_digitising"><IMG  ALIGN="BOTTOM" BORDER="1" ALT="[*]"
 
  SRC="/usr/share/latex2html/icons/crossref.png"></A> for details.
 
  SRC="/usr/share/latex2html/icons/crossref.png"></A> for details.
 +
 +
<H3>
 +
Setting the Snapping Tolerance and Search Radius
 +
</H3>
  
 
<P>
 
<P>
<BR><HR>
+
Before we can edit vertices, it is very important to set the snapping
<!--Table of Child-Links-->
+
tolerance and search radius to a value that allows us an optimal editing of
<STRONG>Subsections</STRONG>
+
the vector layer geometries.
  
<UL CLASS="ChildLinks">
+
<P>
<LI>[[Setting the Snapping Tolerance and Search Radius]]
+
Snapping tolerance
<LI>[[Topological editing]]
+
 
<LI>[[Editing an Existing Layer]]
+
<P>
<LI>[[Creating a New Layer]]
+
Snapping tolerance is the distance QGIS uses to search for the
<LI>[[Working with the Attribute Table]]
+
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.
 +
 
 +
<P>
 +
 
 +
<OL>
 +
<LI>A general, project wide snapping tolerance can be defined choosing
 +
Settings &gt; mActionOptionsOptions.
 +
(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
 +
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.
 +
</LI>
 +
<LI>A layer based snapping tolerance can be defined by choosing
 +
Settings (or File) &gt; mActionOptionsProject
 +
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&nbsp;<A HREF="#fig:snappingoptions">15</A>).
 +
</LI>
 +
</OL>
 +
 
 +
<P>
 +
 
 +
<DIV ALIGN="CENTER"><A NAME="fig:snappingoptions"></A><A NAME="580"></A>
 +
<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>
 +
</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
 +
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.
 +
 
 +
<P>
 +
The search radius for vertex edits in layer units can be defined in the
 +
Digitizing tab under Settings &gt;
 +
mActionOptionsOptions. The same place where you define the
 +
general, project wide snapping tolerance.
 +
 
 +
<H3>
 +
Topological editing
 +
</H3>
 +
 
 +
<P>
 +
Besides layer based snapping options the General tab in menu
 +
Settings -&gt; mActionOptionsProject Properties...
 +
also provides some topological functionalities.
 +
In the Digitizing option group you can Enable topological editing and/or activate
 +
Avoid intersections of new polygons.
 +
 
 +
 
 +
<h4>Enable topological editing</h4>
 +
 
 +
<P>
 +
The option Enable 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.
 +
 
 +
<P>
 +
<h4>Avoid intersections of new polygons</h4>
 +
 
 +
<P>
 +
The second topological option called Avoid 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.
 +
 
 +
<P>
 +
 
 +
<H3>
 +
Editing an Existing Layer
 +
</H3>
 +
 
 +
<P>
 +
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).
 +
 
 +
<P>
 +
Layer editing is most versatile when used on PostgreSQL/PostGIS data sources.
 +
 
 +
<P>
 +
<BR>
 +
<IMG
 +
WIDTH="514" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
 +
SRC="img9.png"
 +
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.
 +
}
 +
\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>
 +
<BR>
 +
<IMG
 +
WIDTH="239" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
 +
SRC="img11.png"
 +
ALT="\begin{Tip}
 +
% latex2html id marker 614
 +
[ht]\caption{\textsc{Save Regularly}}
 +
\qg...
 +
...and also confirms that your data source can accept all
 +
your changes.
 +
}
 +
\end{Tip}">
 +
<BR>
 +
 
 +
<P>
 +
<BR>
 +
<IMG
 +
WIDTH="128" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
 +
SRC="img12.png"
 +
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
 +
WIDTH="146" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
 +
SRC="img13.png"
 +
ALT="\begin{Tip}
 +
% latex2html id marker 623
 +
[ht]\caption{\textsc{Zoom in Before Editi...
 +
...g while all the vertex markers are rendered across the entire layer.
 +
}
 +
\end{Tip}">
 +
<BR>
 +
 
 +
<P>
 +
<BR>
 +
<IMG
 +
WIDTH="193" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
 +
SRC="img14.png"
 +
ALT="\begin{Tip}
 +
% latex2html id marker 627
 +
[ht]\caption{\textsc{Vertex Markers}}
 +
\qg...
 +
... click on the \tab{Digitizing} tab and select
 +
the appropriate entry.
 +
}
 +
\end{Tip}">
 +
<BR>
 +
 
 +
<P>
 +
All editing sessions start by choosing the mActionToggleEditingToggle editing option.
 +
This can be found in the context menu after right clicking on the legend
 +
entry for that layer.<A NAME="636"></A>
 +
Alternately, you can use the <A NAME="637"></A>
 +
mActionToggleEditingToggle editing button from the toolbar to start
 +
or stop the editing mode.<A NAME="640"></A> Once the layer is in edit mode,
 +
markers will appear at the vertices, and additional tool buttons on the editing
 +
toolbar will become available.
 +
 
 +
<P>
 +
Zooming and panning with the mouse wheel
 +
 
 +
<P>
 +
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 &gt;Options menu. 
 +
 
 +
<P>
 +
Panning with the arrow keys
 +
 
 +
<P>
 +
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.
 +
 
 +
<P>
 +
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.
 +
 
 +
<P>
 +
You can perform the following editing functions:
 +
 
 +
<P>
 +
 
 +
<UL>
 +
<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>
 
</UL>
<!--End of Table of Child-Links-->
+
 
<BR><HR>
+
<P>
 +
Adding Features
 +
<A NAME="677"></A>
 +
 
 +
<P>
 +
Before you start adding features, use the mActionPanpan
 +
and mActionZoomInzoom-in/mActionZoomOutzoom-out
 +
tools to first navigate to the area of interest.
 +
 
 +
<P>
 +
Then you can use the mActionCapturePointCapture point,
 +
mActionCaptureLineCapture line or
 +
mActionCapturePolygonCapture polygon icons on the toolbar to put the QGIS cursor
 +
into digitizing mode.
 +
 
 +
<P>
 +
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
 +
first point of your new feature.
 +
 
 +
<P>
 +
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.
 +
 
 +
<P>
 +
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
 +
new river in Alaska.
 +
 
 +
<P>
 +
 
 +
<DIV ALIGN="CENTER"><A NAME="fig:vector_digitising"></A><A NAME="693"></A>
 +
<TABLE>
 +
<CAPTION ALIGN="BOTTOM"><STRONG>Figure:</STRONG>
 +
Enter Attribute Values Dialog after digitizing a new vector
 +
  feature </CAPTION>
 +
<TR><TD>
 +
<DIV ALIGN="CENTER">
 +
</DIV>
 +
<P></P>
 +
<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
 +
<A NAME="704"></A>
 +
 
 +
<P>
 +
You can move features using the mActionMoveFeatureMove Feature icon
 +
on the toolbar.
 +
 
 +
<P>
 +
Split Feature
 +
<A NAME="708"></A>
 +
 
 +
<P>
 +
You can split features using the mActionSplitFeaturesSplit Features icon
 +
on the toolbar.
 +
 
 +
<P>
 +
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.
 +
 
 +
<P>
 +
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:
 +
 
 +
<P>
 +
 
 +
<UL>
 +
<LI><SPAN  CLASS="textbf">Lines</SPAN>    - 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.
 +
 
 +
<P>
 +
</LI>
 +
<LI><SPAN  CLASS="textbf">Polygons</SPAN> - 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.
 +
</LI>
 +
</UL>
 +
 
 +
<P>
 +
You will need to set the property
 +
Settings&gt;mActionOptionsOptions&gt;Digitizing&gt;Search Radius10
 +
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>
 +
You can add new vertices to a feature by using the
 +
mActionAddVertexAdd Vertex icon
 +
on the toolbar.
 +
 
 +
<P>
 +
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 <SPAN  CLASS="textit">existing</SPAN> 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.
 +
 
 +
<P>
 +
Moving Vertices of a Feature
 +
<A NAME="729"></A>
 +
 
 +
<P>
 +
You can move vertices using the mActionMoveVertexMove Vertex icon
 +
on the toolbar.
 +
 
 +
<P>
 +
Deleting Vertices of a Feature
 +
<A NAME="733"></A>
 +
 
 +
<P>
 +
You can delete vertices by using the mActionDeleteVertexDelete Vertex icon
 +
on the toolbar.
 +
 
 +
<P>
 +
Note, it doesn't make sense to delete the vertex of a Point feature!
 +
Delete the whole feature instead.
 +
 
 +
<P>
 +
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.
 +
 
 +
<P>
 +
<SPAN  CLASS="textbf">Warning:</SPAN> 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.)
 +
 
 +
<P>
 +
Add Ring
 +
<A NAME="738"></A>
 +
 
 +
<P>
 +
You can create ring polygons using the mActionAddRingAdd 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.
 +
 
 +
<P>
 +
Add Island
 +
<A NAME="742"></A>
 +
 
 +
<P>
 +
You can mActionAddIslandadd island polygons to a selected multipolygon.
 +
The new island polygon has to be digitized outside the selected multipolygon.
 +
 
 +
<P>
 +
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
 +
same QGIS project, as long as destination layers are set to
 +
mActionToggleEditingToggle editing beforehand.
 +
 
 +
<P>
 +
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.
 +
 
 +
<P>
 +
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.
 +
 
 +
<P>
 +
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>
 +
<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
 +
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.
 +
 
 +
<P>
 +
<BR>
 +
<IMG
 +
WIDTH="188" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
 +
SRC="img16.png"
 +
ALT="\begin{Tip}
 +
% latex2html id marker 763
 +
[ht]\caption{\textsc{Congruency of Pasted...
 +
...ll rounding-off errors
 +
involved when converting between projections.
 +
}
 +
\end{Tip}">
 +
<BR>
 +
 
 +
<P>
 +
Deleting Selected Features
 +
<A NAME="768"></A>
 +
 
 +
<P>
 +
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
 +
multiple features for deletion. Once you have the selection set, use the
 +
mActionDeleteSelectedDelete 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.
 +
 
 +
<P>
 +
The mActionEditCutCut 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 mActionEditPastepaste 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.
 +
 
 +
<P>
 +
<BR>
 +
<IMG
 +
WIDTH="264" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
 +
SRC="img17.png"
 +
ALT="\begin{Tip}
 +
% latex2html id marker 777
 +
[ht]\caption{\textsc{Feature Deletion Sup...
 +
...ilable from the download site are built
 +
using GDAL 1.3.2 or higher.
 +
}
 +
\end{Tip}">
 +
<BR>
 +
 
 +
<P>
 +
Snap Mode
 +
<A NAME="782"></A>
 +
QGIS allows digitized vertices to be snapped to other vertices of the same layer. To
 +
set the snapping tolerance, go to
 +
Settings&gt;mActionOptionsOptions-&gt;Digitizing.
 +
(On Mac: go to  QGIS &gt; Preferences, on Linux: Edit &gt; mActionOptionsOptions.)
 +
Note that the snapping tolerance is in map units or pixels.
 +
 
 +
<P>
 +
Saving Edited Layers
 +
<A NAME="792"></A>
 +
 
 +
<P>
 +
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.
 +
 
 +
<P>
 +
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.
 +
 
 +
<P>
 +
 
 +
<H3>
 +
Creating a New Layer
 +
</H3>
 +
 
 +
<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).
 +
 
 +
<P>
 +
 
 +
<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
 +
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.
 +
 
 +
<P>
 +
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="[*]"
 +
SRC="/usr/share/latex2html/icons/crossref.png"></A> for more information on creating GRASS vector
 +
layers.
 +
 
 +
<P>
 +
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 Typereal, Typeinteger, and Typestring 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 <A HREF="node26.html#sec:edit_existing_layer">5.5.3</A> above.
 +
 
 +
<H3>
 +
Working with the Attribute Table
 +
</H3>
 +
 
 +
<P>
 +
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
 +
from the menu. It is also possible to rightlick on the layer and choose mActionOpenTableOpen Attribute Table
 +
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>).
 +
 
 +
<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>
 +
</DIV>
 +
 
 +
<P>
 +
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 <A HREF="node30.html#sec:select_by_query">5.7</A>.
 +
 
 +
<P>
 +
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,
 +
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.

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

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. <P> Note - the procedure for editing GRASS layers is different - see Section <A HREF="#grass_digitising"><IMG ALIGN="BOTTOM" BORDER="1" ALT="[*]" SRC="/usr/share/latex2html/icons/crossref.png"></A> for details.

Setting the Snapping Tolerance and Search Radius

<P> 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.

<P> Snapping tolerance

<P> 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.

<P>

  1. A general, project wide snapping tolerance can be defined choosing Settings > mActionOptionsOptions. (On Mac: go to QGIS > Preferences, on Linux: Edit > 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 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) > mActionOptionsProject 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 <A HREF="#fig:snappingoptions">15</A>).

<P>

<A NAME="fig:snappingoptions"></A><A NAME="580"></A>
Figure: Edit snapping options on a layer basis

[clip=true, width=14cm]editProjectSnapping

<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 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.

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

Topological editing

<P> Besides layer based snapping options the General tab in menu Settings -> mActionOptionsProject Properties... also provides some topological functionalities. In the Digitizing option group you can Enable topological editing and/or activate Avoid intersections of new polygons.


Enable topological editing

<P> The option Enable 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.

<P>

Avoid intersections of new polygons

<P> The second topological option called Avoid 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.

<P>

Editing an Existing Layer

<P> 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).

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

<P>
<IMG

WIDTH="514" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img9.png"
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. } \end{Tip}">

<P>
<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 > 1.6.0 } \end{Tip}">

<P>
<IMG

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

% latex2html id marker 614 [ht]\caption{\textsc{Save Regularly}} \qg... ...and also confirms that your data source can accept all your changes. } \end{Tip}">

<P>
<IMG

WIDTH="128" HEIGHT="11" ALIGN="BOTTOM" BORDER="0"
SRC="img12.png"
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}">

<P>
<IMG

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

% latex2html id marker 623 [ht]\caption{\textsc{Zoom in Before Editi... ...g while all the vertex markers are rendered across the entire layer. } \end{Tip}">

<P>
<IMG

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

% latex2html id marker 627 [ht]\caption{\textsc{Vertex Markers}} \qg... ... click on the \tab{Digitizing} tab and select the appropriate entry. } \end{Tip}">

<P> All editing sessions start by choosing the mActionToggleEditingToggle editing option. This can be found in the context menu after right clicking on the legend entry for that layer.<A NAME="636"></A> Alternately, you can use the <A NAME="637"></A> mActionToggleEditingToggle editing button from the toolbar to start or stop the editing mode.<A NAME="640"></A> Once the layer is in edit mode, markers will appear at the vertices, and additional tool buttons on the editing toolbar will become available.

<P> Zooming and panning with the mouse wheel

<P> 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.

<P> Panning with the arrow keys

<P> 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.

<P> 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.

<P> You can perform the following editing functions:

<P>

  • Add Features: mActionCapturePointCapture Point, mActionCaptureLineCapture Line and mActionCapturePolygonCapture Polygon
  • mActionAddRingAdd Ring
  • mActionAddIslandAdd Island
  • mActionSplitFeaturesSplit Features
  • mActionMoveFeatureMove Features
  • mActionMoveVertexMove Vertex
  • mActionAddVertexAdd Vertex
  • mActionDeleteVertexDelete Vertex
  • mActionDeleteSelectedDelete Selected
  • mActionEditCutCut Features
  • mActionEditCopyCopy Features
  • mActionEditPastePaste Features

<P> Adding Features <A NAME="677"></A>

<P> Before you start adding features, use the mActionPanpan and mActionZoomInzoom-in/mActionZoomOutzoom-out tools to first navigate to the area of interest.

<P> Then you can use the mActionCapturePointCapture point, mActionCaptureLineCapture line or mActionCapturePolygonCapture polygon icons on the toolbar to put the QGIS cursor into digitizing mode.

<P> 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 first point of your new feature.

<P> 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.

<P> 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 new river in Alaska.

<P>

<A NAME="fig:vector_digitising"></A><A NAME="693"></A>
Figure: Enter Attribute Values Dialog after digitizing a new vector feature

[clip=true, width=8cm]editDigitizing

<P>
<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}">

<P> Move Feature <A NAME="704"></A>

<P> You can move features using the mActionMoveFeatureMove Feature icon on the toolbar.

<P> Split Feature <A NAME="708"></A>

<P> You can split features using the mActionSplitFeaturesSplit Features icon on the toolbar.

<P> 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.

<P> 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:

<P>

  • 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. <P>
  • 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.

<P> You will need to set the property Settings>mActionOptionsOptions>Digitizing>Search Radius10 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> You can add new vertices to a feature by using the mActionAddVertexAdd Vertex icon on the toolbar.

<P> 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 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.

<P> Moving Vertices of a Feature <A NAME="729"></A>

<P> You can move vertices using the mActionMoveVertexMove Vertex icon on the toolbar.

<P> Deleting Vertices of a Feature <A NAME="733"></A>

<P> You can delete vertices by using the mActionDeleteVertexDelete Vertex icon on the toolbar.

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

<P> 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.

<P> 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.)

<P> Add Ring <A NAME="738"></A>

<P> You can create ring polygons using the mActionAddRingAdd 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.

<P> Add Island <A NAME="742"></A>

<P> You can mActionAddIslandadd island polygons to a selected multipolygon. The new island polygon has to be digitized outside the selected multipolygon.

<P> 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 same QGIS project, as long as destination layers are set to mActionToggleEditingToggle editing beforehand.

<P> 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.

<P> 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.

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

<P>

  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 mActionSelectSelect tool to select the feature(s) on the source layer
  6. Click on the mActionEditCopyCopy Features tool
  7. Make the destination layer active by clicking on it in the legend
  8. Click on the mActionEditPastePaste Features tool
  9. Stop editing and save the changes

<P> 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.

<P>
<IMG

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

% latex2html id marker 763 [ht]\caption{\textsc{Congruency of Pasted... ...ll rounding-off errors involved when converting between projections. } \end{Tip}">

<P> Deleting Selected Features <A NAME="768"></A>

<P> 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 multiple features for deletion. Once you have the selection set, use the mActionDeleteSelectedDelete 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.

<P> The mActionEditCutCut 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 mActionEditPastepaste 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.

<P>
<IMG

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

% latex2html id marker 777 [ht]\caption{\textsc{Feature Deletion Sup... ...ilable from the download site are built using GDAL 1.3.2 or higher. } \end{Tip}">

<P> Snap Mode <A NAME="782"></A> QGIS allows digitized vertices to be snapped to other vertices of the same layer. To set the snapping tolerance, go to Settings>mActionOptionsOptions->Digitizing. (On Mac: go to QGIS > Preferences, on Linux: Edit > mActionOptionsOptions.) Note that the snapping tolerance is in map units or pixels.

<P> Saving Edited Layers <A NAME="792"></A>

<P> 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.

<P> 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.

<P>

Creating a New Layer

<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).

<P>

<A NAME="fig:newvectorlayer"></A><A NAME="803"></A>
Figure: Creating a New Vector Dialog

[clip=true, width=10cm]editNewVector

<P> 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.

<P> 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="[*]"

SRC="/usr/share/latex2html/icons/crossref.png"></A> for more information on creating GRASS vector 

layers.

<P> 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 Typereal, Typeinteger, and Typestring 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 <A HREF="node26.html#sec:edit_existing_layer">5.5.3</A> above.

Working with the Attribute Table

<P> 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 from the menu. It is also possible to rightlick on the layer and choose mActionOpenTableOpen Attribute Table 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>).

<P>

<A NAME="fig:attributetable"></A><A NAME="830"></A>
Figure: Attribute Table for Alaska layer

[clip=true, width=12cm]vectorAttributeTable

<P> 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 <A HREF="node30.html#sec:select_by_query">5.7</A>.

<P> 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, 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.