MapInfo Pro

 View Only

MapInfo Monday: Coloring a Graduated Theme based on a Second Attribute

  • 1.  MapInfo Monday: Coloring a Graduated Theme based on a Second Attribute

    Posted 03-21-2022 10:00
    Happy #MapInfoMonday,

    I got a question from a longstanding MapInfo Pro customer during a call we had with them.

    He basically wanted to combine a graduated thematic map with a ranged thematic map so that the size depended on one attribute and the color depended on another attribute. You can see an example of it here below.

    I took it on myself to figure out a way to do this.

    Now there is the known method of bi-variate thematic also described in this article: How to create a bi-variate thematic map in MapInfo Pro. This does allow you to create two ranged thematic maps where one of them controls the size and the other controls the color.

    But I wanted to see if you could do it in a different way too - using SQL by calculating a derived spatial object, in our example a buffer.

    OK, imagine you have a number of stores where you know the number of employees and you also know the revenue. It could look like this basic dummy data below for four stores across the United Kingdom.

    And here is the attributes assigned to each of my four stores.

    Graduated Thematic Map

    I can use a graduated thematic map to show the revenue as circles: The higher the revenue, the bigger the circles

    The resulting map would look like this.

    But a graduated thematic map can not be used to show multiple variables like revenue and number of employees.

    Using derived spatial objects

    My idea was to use the new capability we added to MapInfo Pro v2021 to create a derived spatial object and use this as the actual spatial object in a query.

    In this example, I will create buffers around the original stores and let the revenue control the size of these buffers. We will keep it simple and divide the revenue with a fixed value, here 25, when calculating the buffer size. This results in buffers of s decent size when looking at a map of the United Kingdom. You can change this fixed value to create bigger or smaller buffers depending on the revenue and the coverage of your map.

    Here is the query I ended up using. I include all the columns from my Stores table and add the expression that creates my new buffers. The object keyword after the Buffer expression tells MapInfo Pro to use this derived object as the mappable object for my query result.

    Select s.*, Buffer(s.Obj, 36, Int(s.REVENUE) / 25, "m") object
    From Stores As "s"
    Into Store_Buffers

    In MapInfo Pro, I use the SQL Window to create my query as you can see below. You can also see the resulting buffers around my stores.

    These buffers are my graduated symbols. The next step is to add a thematic map to these buffers that illustrate the number of employees. For this, I will create a Ranges thematic map and base it on the number of employees.

    The result looks like this where the darker colors match a higher number of employees.

    I can also use my buffer to control the placement of my labels. As we discussed in a previous article, this gives you more control over the label placement. In my example, I can use labels that point back to the stores they belong to if the buffer is too small to hold the label.

    There are, as you saw, other ways now to illustrate multiple variables on your map besides creating the bi-variate thematic. One thing that this method doesn't allow you is to create a legend showing how the size of the buffers relates to the revenue size.

    How do you normally illustrate multiple variables for one layer on your map?

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