5.2. Lesson: Topologie des données

La topologie est un aspect utile des couches de données vectorielles, car il minimise les erreurs telles que les chevauchements ou les lacunes.

Par exemple : si deux entités partagent une bordure, et que vous modifiez la bordure avec la topologie, alors vous n’aurez pas besoin de modifier d’abord une entité, puis l’autre, et soigneusement aligner les bordures afin qu’elles correspondent l’une avec l’autre. Vous pouvez plutôt modifier leur bordure commune et les deux entités changeront en même temps.

Objectif de cette leçon: Comprendre la topologie par les exemples.

5.2.1. moderate Follow Along: Accrochage

Snapping makes topological editing easier. This will allow your mouse cursor to snap to other objects while you digitize. To set snapping options:

  1. Rendez-vous dans le menu Projet ‣ Options d’accrochage….

  2. Set up your Snapping options dialog to activate the landuse layer with Type vertex and tolerance 12 pixels:

  3. Make sure that the box in the Avoid overlap column is checked.

  4. Leave the dialog.

  5. Select the landuse layer and enter edit mode (toggleEditing)

  6. Check (under View ‣ Toolbars) that the Advanced Digitizing toolbar is enabled.

  7. Zoomez jusqu’à cette zone (activez des couches et des étiquettes si nécessaire) :

  8. Digitize this new (fictional) area:

  9. When prompted, give it an OGC_FID of 999, but feel free to leave the other values unchanged.

    If you are careful while digitizing, and allow the cursor to snap to the vertices of adjoining areas, you’ll notice that there won’t be any gaps between your new area and the existing adjacent areas.

  10. Note the undo undo and redo redo tools in the Advanced Digitizing toolbar.

5.2.2. moderate Follow Along: Corriger les caractéristiques topologiques

Topology features can sometimes need to be updated. In our study area, an area has been turned into forest, so the landuse layer need an update. We will therefore expand and join some forest features in this area:


Instead of creating new polygons to join the forest areas, we are going to use the Vertex Tool to edit and join existing polygons.

  1. Enter edit mode (if it is not active already)

  2. Select the vertexToolActiveLayer Vertex Tool tool.

  3. Choose an area of forest, select a vertex, and move it to an adjoining vertex so that the two forest features meet:

  4. Click on the other vertices and snap them into place.

    Les bordures topologiquement correctes ressemblent à cela :


    Go ahead and join a few more areas using the Vertex Tool.

    You can also use the capturePolygon Add Polygon Feature tool to fill the gap between the two forest polygons. If you have enabled Avoid overlap, you don’t have to add every single vertex - they will be added automatically if your new polygon overlaps the existing ones.

    If you are using our example data, you should have a forest area looking something like this:


Ne vous inquiétez pas si vous avez regroupé plus, moins ou différentes zones de forêt.

5.2.3. moderate Follow Along: Outil: Simplifier l’Entité

Continuing on the same layer, we will test the simplifyFeatures Simplify Feature tool:

  1. Cliquez dessus pour l’activer.

  2. Click on one of the areas which you joined using either the Vertex Tool or Add Feature tool. You will see this dialog:

  3. Modify the Tolerance and watch what happens:


    This allows you to reduce the number of vertices.

  4. Cliquez sur OK

The advantage of this tool is that it provides you with a simple and intuitive interface for generalization. But notice what the tool ruins topology. The simplified polygon no longer shares boundaries with its adjacent polygons, as it should. So this tool is better suited for stand-alone features.

Avant de continuer, remettez le polygone dans son état d’origine en annulant le dernier changement.

5.2.4. moderate Try Yourself Outil: Ajouter un anneau

The addRing Add Ring tool allows you to add an interior ring to a polygon feature (cut a hole in the polygon), as long as the hole is completely contained within the polygon (touching the boundary is OK). For example, if you have digitized the outer boundaries of South Africa and you need to add a hole for Lesotho, you would use this tool.

If you experiment with the tool, you may notice that the snapping options can prevent you from creating a ring inside a polygon. So you are advised to turn off snapping before cutting a hole.

  1. Disable snapping for the landuse layer using the snapping Enable Snapping button (or use the shortcut s).

  2. Use the addRing Add Ring tool to create a hole in the middle of a polygon geometry.

  3. Draw a polygon over the target feature, as if you were using the addPolygon Add polygon tool.

  4. When you right-click, the hole will be visible.

  5. Remove the hole you just created using the deleteRing Delete Ring tool.


    Click inside the hole to delete it.

Vérifiez vos résultats

5.2.5. moderate Try Yourself Outil: Ajouter une partie

The addPart Add Part tool allows you to add a new part to a feature, that is not directly connected to the main feature. For example, if you have digitized the boundaries of mainland South Africa, but you haven’t yet added the Prince Edward Islands, you would use this tool to create them.

  1. Select the polygon to which you wish to add the part by using the selectRectangle Select Features by area or single click tool.

  2. Use the Add Part tool to add an outlying area.

  3. Delete the part you just created using the deletePart Delete Part tool.


    Click inside the part to delete it.

Vérifiez vos résultats

5.2.6. moderate Follow Along: Outil: Remodeler les Entités

The reshape Reshape Features tool is used to extend a polygon feature or cut away a part of it (along the boundary).


  1. Select the polygon using the selectRectangle Select Features by area or single click tool.

  2. Left-click inside the polygon to start drawing.

  3. Draw a shape outside the polygon. The last vertex should be back inside the polygon.

  4. Right-click to finish the shape:


    Cela doit donner un résultat similaire à ça :


Cut away a part:

  1. Select the polygon using the selectRectangle Select Features by area or single click tool.

  2. Cliquez à l’extérieur du polygone.

  3. Draw a shape inside the polygon. The last vertex must be back outside the polygon.

  4. Right-click outside the polygon:


    Le résultat de ce qui précède :


5.2.7. moderate Try Yourself Outil: Séparer les entités

The splitFeatures Split Features tool is similar to the reshape Reshape Features tool, except that it does not delete either of the two parts. Instead, it keeps them both.

We will use the tool to split a corner from a polygon.

  1. First, select the landuse layer and re-enable snapping for it.

  2. Select the splitFeatures Split Features tool and click on a vertex to begin drawing a line.

  3. Draw the bounding line.

  4. Click a vertex on the « opposite » side of the polygon you wish to split and right-click to complete the line:

  5. At this point, it may seem as if nothing has happened. But remember that the landuse layer is rendered without border lines, so the new division line will not be shown.

  6. Use the selectRectangle Select Features by area or single click tool to select the part you just split out; the new feature will now be highlighted:


5.2.8. hard Try Yourself Outil: Fusionner les Entités

Now we will re-join the feature you just split out to the remaining part of the polygon:

  1. Experiment with the mergeFeaturesMerge Selected Features and mergeFeatAttributes Merge Attributes of Selected Features tools.

  2. Remarquez les différences.

Vérifiez vos résultats

5.2.9. In Conclusion

L’édition topologique est un outil puissant qui vous permet de créer et de modifier des objets rapidement et facilement, tout en veillant à ce qu’ils restent topologiquement corrects.

5.2.10. What’s Next?

Now you know how to digitize the shape of the objects easily, but adding attributes is still a bit of a headache! Next we will show you how to use forms, making attribute editing simpler and more effective.