Tuesday, August 12, 2008

Batch Geometry Snapping

During a GIS project some time ago, I had to snap the vertices of geometry features to reference or anchor geometry features. As the name suggests, the anchor geometries are geometries which could not be moved. For example, see the figure below: it shows an overlay of two geometry features. The blue line work is the candidate geometry (land use polygon) that is to be snapped to the anchor (reference) geometry in grey (land parcels).


As there were hundreds of thousands of geometries to be processed, doing it interactively was out of the question and the job had to be done in batch mode. I did some research and learnt about the Anchored Snapper factory in SAFE FME Professional. Here I describe how to perform snapping of geometries using the Anchored Snapper.
  1. Open up the FME Workbench and define the source dataset for the candidate geometries for snapping (e.g. land use) and the anchor geometries (e.g. land parcels).
  2. Add in the Anchored Snapper factory and define the following parameters.



    Note: Enter a suitable snapping tolerance for your dataset.

  3. Define the destination datasets.

    I defined destination datasets for the snapped geometries, the untouched geometries, and the combined snapped and untouched geometries.

  4. Connect up all the datasets and the factory as shown in the figure below.



  5. Run the conversion.

    The results of the snapping are shown below. The red linework is the new snapped geometry while the light blue linework is the unsnapped geometry.

The SAFE FME algorithm was pretty efficient and the snapping process for a couple of hundred thousand polygon geometries took a short time (as in less than half an hour) to process. So I had the luxury of doing multiple runs with different tolerance values.

No comments: