MapInfo Pro

 View Only
  • 1.  MapInfo Monday: Statistics using a Catchment Area I

    Employee
    Posted 09-04-2023 05:38

    Happy #MapInfoMonday,

    This post is a follow-up post to last week's post on calculating statistics from selected records.

    In this week's post, we will elaborate on how you can select those statistical areas when have another polygon illustrating your catchment area. So we will inspect a couple of ways to convert a catchment area, that is any polygon, to the statistical polygons for that catchment area.

    I'll show you 3 ways to select polygons from a layer using a polygon in another layer:

    1. Use the Boundary Selection tool
    2. Use the Select by Location dialog
    3. Use the SQL Window to consider the amount of overlap

    They all have some good and bad sides as they all result in either too little or too much. You will see what I mean in a moment.

     In a later post, I will show how you can calculate the actual overlapping area and get the proportional values.

    Use the Boundary Selection Tool

    This first method is quite easy to use.

    Below you can see my setup. I have a table with Purchasing Power information for my area, and I have created a 5 km buffer zone around my potential new site. The catchment area could of course also have been a drivetime polygon to show how far people can come within a given distance or time.

    From the Select dropdown on the Map tab, I now select the Boundary Selection tool.
    I have already ensured that the boundary I want to search within is in the topmost selectable layer, ie. the cosmetic layer in this case, and that the second topmost selectable layer is the layer I want to select from.
    I can now click on the map inside my catchment area, and the tool will now select all the Purchasing Power boundaries that have their centroid inside my catchment area. The result looks like this.
    You will quickly notice that the buffer goes through a number of polygons that haven't been selected. This is down to the way the Boundary Selection tool works. Boundary Selection compares the centroid of the polygons to the polygon you clicked inside. This means that only the polygons with their centroid inside the catchment area will be selected.
    Maybe this method works for you. If not, let's inspect a couple of other methods.

    Use the Select by Location dialog

    Another way is to use the Select by Location dialog. This does however require that you compare two native tables so you will have to make sure your catchment area is stored in a table. It can't be drawn in the cosmetic layer.
    From the SQL dropdown on the Map tab, I select Select by Location.
    In the Select by Location dialog, I select the Purchasing Power table from the first list and the Catchment table from the second list. This will select the Purchasing Power polygons when they relate to the Catchment polygon.
    For the Relation, I specify ntersect. This means the two polygons only have to intersect at a single node to MapInfo Pro to detect a relation.
    When I click OK, I can see the result in my map.
    As the relation now has been set to Intersect, you will get far more polygons selected. Especially the one polygon in the north doesn't seem to have much in common with my catchment area.
    Where the Boundary Selection tool might select too few records, this seems to select almost too much.
    Of course, it all depends on your requirements and your use case.

    Use the SQL Window to consider the amount of overlap

    In this final and third way, I'll show you how you can consider the amount of overlap in the query.
    From the SQL dropdown, I select SQL which will open the SQL Window.
    Once open, I use the Scripts list to select the most recent query I ran. This is the query that was created from the Select by Location dialog. We will use this as our starting point and just modify it slightly.
    When you hold the cursor on a name in the list, the actual statement from the script or query will be shown in a popup.
    When the statement has been loaded, I right-click in the field where you edit your query and select Format from the context menu. This will format the statements more nicely.
    I now add another condition to my Select statement:
    And ProportionOverlap(GfK_Purchasing_Power_Czech_Rep.Obj, Catchment.Obj) > 0.1
    This condition is used to only select those Purchasing Power polygons that overlap the Catchment Area with more than 10%
    Here's the full Select statement:
    Select * 
    From GfK_Purchasing_Power_Czech_Rep, Catchment 
    Where GfK_Purchasing_Power_Czech_Rep.obj Intersects Catchment.obj 
    And ProportionOverlap(GfK_Purchasing_Power_Czech_Rep.Obj, Catchment.Obj) > 0.1
    Into Selection
    I have turned off the options to show the result in a browser or as a layer. Click Run to see the result.
    In the map below, you can see how the result now has been narrowed down around the actual catchment area. At least 3 Purchasing Power boundaries that do intersect the catchment area have been left out as they don't overlap with 10% or more of their area.
    The query can of course be modified with regards to the percentage. Maybe 5% works better for you. Maybe 20% is better.
    Now you have selected the polygons that you want to run some statistics on, you can use the query from the earlier post to calculate statistics from the selected records.
    As I said at the start of the article, I will be back later with another article in this series to go over how you can use the Proportional Overlap to calculate statistics from the overlapping part of the polygons. Stay tuned!


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


  • 2.  RE: MapInfo Monday: Statistics using a Catchment Area I

    Posted 09-05-2023 01:02

    Nice work.

    Is there option for identical polygons between 2 layers?



    ------------------------------
    Ayman Hamzeh
    Cassowary Coast Regional Council
    INNISFAIL QLD
    ------------------------------



  • 3.  RE: MapInfo Monday: Statistics using a Catchment Area I

    Employee
    Posted 09-05-2023 01:43

    There are some options for finding identical polygons/objects. I just added a suggestion to your post.



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