Monday, May 23, 2011

Validate polygons for self-intersections using gvSIG

gvSIG has a rich set of topology tools that can be used to validate vector layers. Illustrated here is a simple validation test that can be done to check a polygon layer for self-intersecting polygons, i.e. polygons that intersect with themselves. The steps can be summarized as (1) build a topology with rules, (2) validate the topology. Once the errors have been flagged, the geometries can be edited and revalidated again.

Build a topology
  1. Start up gvSIG OADE 2010. Load and display a polygon layer, e.g. aoi.shp in a Map View.

  2. Select Tools | Topology | Create Topology.

    The Create topology wizard appears.
  3. Click Next.

  4. In the Topology name field, type in an appropriate name, e.g. SelfIntersection.
  5. In the Cluster tolerance field, type in a value, e.g. 1.
  6. In the Maximum number of errors field, type in a value, e.g. 20.

    Note: this number is the maximum number of flag errors that can be generated. Errors exceeding the value will not be generated.
  7. Toggle on the polygon layer to include in topology, e.g. aoi.shp. Click Next.

    The Topology rules page appears.
  8. Click Add.

    The Topology rules dialog box appears.
  9. In the Topology rule drop down list, choose No polygon of A may contain a self-intersection. Click Ok.

  10. Click Finish.

    In the legend, the polygon layer is now grouped under the SelfIntersection topology.
Validating the Topology
  1. In the legend, select the topology SelfIntersection to make it the active layer.
  2. Select Tools | Topology | Validate topology.

    Processing messages appear and the validation results appear. A new error layer SelfIntersection_error is created and displayed in the SelfIntersection topology group and also in the map window.

    Note: the SelfIntersection topology group icon has a red cross as shown above indicating the validation failed.
  3. Mouse right click on the SelfIntersection_error layer in the legend.

    A pop up menu appears.
  4. Choose Attribute table.

    The table: Attribute table:SelfIntersection_error appears.
  5. Scroll through the list of errors. Selecting one error record will highlight the corresponding error in the map window.

No comments:

Post a Comment