MapInfo Pro

 View Only

MapInfo Monday: Putting a Rubber Band around your Points

  • 1.  MapInfo Monday: Putting a Rubber Band around your Points

    Employee
    Posted 12-03-2023 23:01

    Happy #MapInfoMonday!

    Today, we will look at another process of converting your point data to polygons: Convex Hull.

    Convex Hulls are the smallest convex polygons containing an input dataset. The convex part refers to that none of the segments are inbound. This means that no interior angles are greater than 180 degrees. Imagine that you put a rubber band around the points. You can read more about Convex Hull on Wikipedia.

    Some use cases for Convex Hull are Facility Location and Resource Allocation where the Convex Hull illustrates the area that needs to be served. It can also be used to estimate the habitat of animals based on the sightings.

    In MapInfo Pro, you can quickly create a convex hull polygon around a selected number of objects. Make sure you also have an editable layer as the convex hull polygon will get inserted into the editable layer.

    From the Buffer dropdown on the Spatial tab, click on Convex Hull. If the option is disabled, you either haven't selected any records or you don't have an editable layer in the active map window.

    If the selected objects are polylines or polygons, you can create a Convex Hull object for each input. If you have chosen points, you can only create one output object for all the selected points. In the Create Convex Hull dialog you can see the second option is disabled as I had selected points only.
    In the cosmetic layer, you can now see the result of the Convex Hull operation. Notice how there are places on the sides where there are no points inside the Convex Hull polygon. This is where the convex effect is seen.
    With MapInfo Pro v2019, we also introduced a spatial aggregate for creating Convex Hull polygons: AggregateConvexHull().
    This makes it possible for you to create Convex Hull polygons using SQL Select queries.
    Below, you can see how I have used the SQL WIndow to create a Select statement that creates Convex Hull polygons around my addresses. I am grouping my addressing by a District. This will result in as many Convex Hull polygons as I have unique distrait names in my data. Just keep in mind that there must be at least 3 points for the Convex Hull operation to work.
    Here's the query:
    Select t.districtname
       , AggregateConvexHull(obj)
    From Addresses As "t"
    Group By t.districtname
    Into _district_Rubberband NoSelect
    And below you can see the final result as polygons around each district.
    I have selected one of the polygons to highlight that they do overlap each other in various places.
    And if I add an individual theme to my address points based on the district name, you can also see why the Convex Hull polygons are drawn as they are.
    Convex Hull polygons are a quick and easy way to get a representation of coverage from an input point (or polyline/polygon) dataset.
    But also keep in mind, that these polygons don't follow the points closely. Alternatives to Convex Hull are buffers and Voronoi polygons. We have discussed both these options earlier.


    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------