|
|
行1: |
行1: |
− | <H3>
| + | --[[利用者:Sanak|Sanak]] 2009年10月4日 (日) 09:56 (UTC)このページは削除予定です。 |
− | 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 > 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 >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>
| + | |
− | | + | |
− | <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>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 <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>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>
| + | |