MapInfo Pro

 View Only
  • 1.  MapInfo Monday: Creating Cluster Polygons from Points

    Employee
    Posted 11-29-2021 08:15

    Happy #MapInfoMonday!

    Last week I was asked by @Johan Frössling how you can create cluster regions from a point dataset with known cluster IDs or names. I decided this was a good topic for this week's #MapInfoMonday post.

    You start with a given number of points each assigned a name or ID of the cluster it belongs to. From this, you want to create a coverage map showing what area each cluster covers. This means you want to go from a point dataset to a region dataset.

    I have earlier covered how you can "convert" points to regions using either buffers, Voronoi polygons or a combination of these two. Take a look at the article MapInfo Monday: Coming Buffers and Voronoi Polygons if you need to revisit this discussion.

    This would also be the approach I would suggest here but you will need to add the use of Combine Using Column to the mix. My final map of cluster polygons looks like this where I had added a theme based on the cluster names.


    For this demo, I used an address dataset for Denmark and I used the village names as the cluster names. Below you can see the input addresses labelled with the village names (no duplicates). I have removed the addresses that had no village name associated.

    Let's see how I got to this result.

    Creating Voronoi Polygons

    The first step is to convert the address points to Voronoi polygons. But before I do that, I create a single buffer object around the input dataset so that I can use that as my "Area of Interest". You can use any polygon for this purpose, an administrative boundary or a hand-drawn polygon.

    I created a 2-km buffer around the addresses to make sure there would be no holes inside the polygon. You are however allowed to have holes in your Area of Interest if you want. Just make sure your Area of Interest is a single polygon.


    When you have created the polygon, make the layer editable, select the polygon and set it as the Target Object using Set Target on the Spatial tab. In this way, the Voronoi process will ensure the Voronoi polygons created will cover the entire polygon.

    Below you can see the resulting Voronoi polygons created for the address points. Note that currently there is one Voronoi polygon for each address point. Not quite what we are looking for. We need to combine the Voronoi polygons that have the same cluster name. 


    You can read more about creating Voronoi polygons in this article: MapInfo Monday: Creating Voronoi Polygons from Points.

    Creating Combined Clusters

    As I wrote above, we still need to combine the polygons that belong to the same cluster, or in our specific case the same village.

    To do so, we will use the Combine Using Column function in MapInfo Pro. You can find this in the Combine dropdown on the Spatial tab.

    When you select this tool, you are helped through the process of a small wizard. First, you need to select the input and output table and the column you want to group the result by in the dialog Combine Objects using Column. I use the ClusterName column from the table with Voronoi Polygons. As output table, I select <New> to get a new table created.


    Next, you will be helped through the process of creating the new output table. You can specify how to open the new table and decide what the table structure of the new table should look like, and finally, you will be asked where the save the new table. I used the Table Structure from my input table even though in most cases, the resulting table will have fewer columns than the input table.


    Now it's time to configure the Data Aggregation. Do make sure that the cluster name or ID from the Voronoi polygons is moved into new combined regions. Below, you can see I'm moving all values from the Voronoi polygons into the resulting combined polygons. For most of these columns, this doesn't make sense as the values will differ across the polygons we are merging. Especially address information such as street name and house number hardly will be the same across multiple addresses.


    When you hit the OK button, MapInfo Pro will combine the polygons where the value in the ClusterName column are identical.

    Below you can see the resulting combined polygons shown with a thicker line.


    You can also turn off the visibility of the Voronoi polygons and focus on the cluster polygons.


    Johan, I hope you find this useful.

    With the new SQL syntax, we added in MapInfo Pro v2019 you can also do this last step using a SQL Select statement to group by the ClusterName and use the spatial aggregate AggregateCombine to merge the polygons.

    Now this shows how to create clusters from already defined input data. Another problem you might run into is to be able to create clusters where you don't know how to group these. That's a story for another article.



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


  • 2.  RE: MapInfo Monday: Creating Cluster Polygons from Points

    Posted 11-30-2021 12:24
    Many thanks Peter !! This is great, it definetly solved my problem. i was playing around with some of these combinations (combining, buffers, creating Voronoi) etc but never in this sequence. Excellent.

    ------------------------------
    /Johan Frössling
    Team Leader - Geodata SME
    Ericsson AB
    ------------------------------