Transform - Geometry: Enclose

The Enclose template appears in the template list when a geometry field, of type geom, geommfd, or geomwkb, has been picked in the Transform pane.   It creates enclosing objects.

 

Enclose

Compute the minimum enclosing area shape desired for objects and save into the specified Result destination using the specified geometry type.  Options in the Enclose in box for enclosing shapes are:

 

  • circle - Compute the minimum enclosing circle area.
  • convex hull - Compute the convex hull area.
  • rectangle, - Compute the minimum enclosing rectangular area aligned north-south.
  • rectangle with rotation - Compute the enclosing rectangular area freely rotated to whatever bearing alignment allows the smallest enclosing rectangle.

 

Launch the template by choosing a geometry field and then double-clicking the Enclose template.  When the template launches we can specify options.

 

 

Enclose : circle

For each line and area object in the source field, the Enclose template using the circle option creates the smallest size, circular area that encloses the object and saves that into the specified Result destination.  Points are ignored.

 

 

With the focus on the drawing, in the Transform pane we choose the Geom field and then we choose the Enclose template.

 

 

In the Enclose template we choose the circle option.  We choose New Field and specify enclosing circle for the new geometry field.  We specify the name Enclosing circles for the drawing that will display that field.  Press Transform.

 

A new Enclosing circles drawing appears in the Project pane.  We drag and drop the new Enclosing circles drawing as a layer into the Objects Drawing window.  

 

 

We Style the areas in the Enclosing circles drawing to use bright magenta border lines with transparent fill color, so the objects in the layer below can be clearly seen.  That shows how the minimum enclosing circles have been constructed to be the smallest circles that will enclose the various objects.   Points are dimensionless, so the template places NULL values into the new geometry field for the point records.

 

Enclose : convex hull

For each line or area in the source field create the polygonal area with least boundary length that encloses the object and put into the target field. Ignore points.  The mathematical definition of convex hull is usually explained by the more intuitive notion of the shape a rubber band would take when stretched around the outside of pins placed at all the coordinates that define the object.

 

 

With the focus on the Objects Drawing, in the Transform pane we choose the Geom field and then the Enclose template.

 

 

We choose convex hull for the Enclose in option.  We choose the Tgeom field (a geometry field we have in the table to use for temporary results) as the Result destination.    Press Transform.

 

 

Our Temp Objects Drawing shows the contents of the Tgeom geometry field.     Convex hull areas that are created from point objects are dimensionless area objects that begin and end at the same coordinate.  To avoid such dimensionless area objects, apply the Enclose template using the convex hull option only to line and area objects, but not to points.

 

The convex hull area with an apparently curved upper right corner in the center of the drawing above is the result of computing a convex hull for the line in the middle of the original drawing, which has a curved segment.  

 

Enclose : rectangle

For each line and area object in the source field, the Enclose template using the rectangle option creates the smallest size, vertically oriented rectangular area that encloses the object and saves that into the specified Result destination.  For points, create a pseudo-rectangle that has all coordinates at the same location.

 

 

With the focus on the drawing, in the Transform pane we choose the Geom field and then we choose the Enclose template.

 

 

In the Enclose template we choose the rectangle option.  We choose New Field and specify enclosing rects for the new geometry field.  We specify the name Enclosing rectangles for the drawing that will display that field.  Press Transform

 

A new Enclosing rectangles drawing appears in the Project pane.  We drag and drop the new Enclosing rectangles drawing as a layer into the Objects Drawing window.  

 

 

We Style the areas in the Enclosing rectangles drawing to use bright magenta border lines with transparent fill color, so the objects in the layer below can be clearly seen. That shows how the minimum enclosing rectangles have been constructed to be the smallest vertically oriented rectangles that will enclose the various objects.  Small square symbols at the locations of the pseudo-rectangles created for points.  The small square symbols indicate an area object that consists of coordinates that are all at the same location.

 

Note: Previews will not show pseudo-rectangles created for points.

 

Enclose : rectangle with rotation

For each line and area object in the source field, the Enclose template using the rectangle with rotation option creates the smallest size rectangular area of any orientation that encloses the object and saves that into the specified Result destination. Points are ignored.

 

The Enclose : rectangle with rotation operation is the same as the Enclose : rectangle operation except that points are ignored, and the rectangular areas that are created can cover their respective objects can be rotated to any orientation and need not be constrained to vertical orientation.

 

 

Starting with the example drawing above, we get the result shown below.

 

 

When enclosing rectangles are free to rotate, the minimum enclosing rectangle often will be smaller in total area than an enclosing rectangle which is constrained to vertical orientation.

 

 

Notes

Curvilinear segments - As a practical matter, most people doing GIS will use straight line segments for lines and areas.   Few GIS systems do a good job of supporting curved segments, so there is much less data published using curved segments.   Manifold's ability to work with curved segments allows us to use that data within Manifold in a limited way, at least for display and interactive editing.  

 

However, most processing tools in Manifold, such as Transform templates and various Geom SQL functions, do their work by first converting a curvilinear segment into a straight line segment between the same two start and finish coordinates.  That will often lead to weird or otherwise unexpected results.  To avoid such problems, first convert curvilinear segments into equivalent constellations of straight line segments at whatever resolution is desired, using the Clean transform template with the convert curves to lines operation option and the number of linear segments desired to approximate the curve in the Curve limit parameter.   See the Curved Segments discussion in the Drawings topic.

 

 

See Also

Transform Pane

 

Transform Reference

 

Transform - Expression

 

Transform - Geometry