MapInfo Pro

 View Only

MapInfo Monday: Population Circles

  • 1.  MapInfo Monday: Population Circles

    Employee
    Posted 3 days ago

    Last week, I had an email discussion with @John Ievers from our partner CDR Group.

    For a customer, John was looking for a way to calculate Population Circles. These are circles - or in this case buffers - around sites where the population within the circle reaches a specific size.

    Even though they are created as buffers in my example, I'll refer to them as circles in this article.

    The map below shows Population Circles for some sites around Boston. The population in each circle is around 50,000 people.

    image
    As you can see the size of the circle depends on the density of the people living in that area. The denser the population, the smaller the circles.
    How would you create these without writing a small application that generates progressively larger circles and stops once the Population Circle reaches your target population?
    Happy #MapInfoMonday!

    Our Approach

    It turned out that John and I had a similar approach in mind:
    1. Create several buffers around each site.
    2. Calculate the population in each of these circles.
    3. Finally, select the circles that comes closest to the population you are looking to reflect.

    That sounds simple, right? What could go wrong with this? Well, we will see when we start working through this.

    Creating Circles for Sites

    I have several sitea in the area around Boston in the US.

    image
    I'll create buffers around these using the Buffer Table control from the Buffer dropdown on the Spatial tab.
    Before I go through this process, I make sure that the MapBasic window is open. In this way, the statements used will be captured and I can rerun some of these to create buffers of different sizes easily.
    I select my Sites table in the Table Buffer dialog, and leave the Store results in table as <New>.
    The process of creating a new table starts by showing the New Table dialog. Here I set it to open the table into my existing map, and to base the new table structure on my Sites table.
    image
    In the New Table Structure dialog, I add two columns to the new table: one to hold the distance of the buffers and one that can be updated with the population count.
    image
    I name my new table Site Buffers, and save it into the folder where I already have the Sites table saved.
    I have now reached the process for creating the buffers.
    I'll start by creating buffers of 0.5 miles around the sites. I use a smoothness of 36 points to represent a full circle, and I choose One buffer or each object.
    image
    For the data, I set the existing columns to inherit the values from the sites table. The distance column, I set to, in this case, 0.5 to reflect the size of the buffer.
    image
    When I click on the OK button on this final dialog, the first of many buffers are created.
    Now, I could repeat this process again for 1 mile, for 1.5 mile, for 2 miles, and so on up to around 10 miles. That's how large I estimate the circles need to be to hold around 100,000 people in rural areas.
    That is however a bit cumbersome, so I will use the MapBasic window instead. The statement that I need has already been captured:
    Create Object As Buffer From Sites Width 0.5 Units "mi" Type Spherical Resolution 36 Into Table Site_Buffers Group by Rowid Concurrency Moderate Data ID=ID, Name=Name, Zip=Zip, DistanceMi=0.5
    
    All I need to do is to adjust the Width parameter from 0.5 to 1.5, and the value inserted into the column DistanceMI similarly. Each time, I change the value, I need to place my cursor in the line, and hit the Enter key to execute the statement. This will create a new set of buffers.
    I first create all the half-mile values from 1.5 to 9.5. After this I do the whole-mile values from 1 to 10. In this way, I will end up with 20 buffers around each site spanning from 0.5 miles to 10 miles.
    In a map, all these Population Circles will look like this:
    image
    Make sure to save the changes to the Site Buffers table before you continue.

    Calculating Population Within Circles

    Next step is to update all these Population Circles with the proportionate population in each.

    Of course, you need to have a dataset with population data to do this. I have the Precisely PSTYE™ US dataset that holds geodemographic segmentation data - and a population count based on block groups.

    image
    As most datasets with population information is based on polygons, we'll have to calculate the proportionate overlap between the Population Circle and the, in this case, block group. This allows us to estimate how many people live within that overlap and assign that count to the Population Circle.
    Luckily, this is what MapInfo Pro is designed to do so it's quite straightforward.
    From the Table tab, I click on the Update Column control.
    I select to update the Site Buffers table and the Population column. I select to get the value from my PSYTE table called psyte us block.
    From the Calculate list, I select Proportion Sum so that I get all the proportionate values summarized for each Population Circle. Remember that one Population Circle can overlap several block groups. Finally, I select to calculate the sum of the column population from the PSYTE dataset.
    And before you run this, check the Join condition via the Join... button. You want to make sure that it states that the block groups from the PSYTE dataset should intersect the objects from Site Buffers, the Population Circles.
    image

    Filtering Population Circles

    The final step is to show only the Population Circles that has the population count that you are looking for.

    This can be done in multiple ways in MapInfo Pro. For this example, I'll use the Layer Filter option.

    I'm looking for Population Circles for approximately 50,000 people around my sites. As I don't expect the population in the circles to be very precise, I'll filter by 45000 to 55000 in the column population.

    image
    Let us check how the map now looks.
    image
    Unfortunately, this filter didn't work for all sites. You can see that two sites don't show any Population Circles.
    As the population is spread so unevenly, the population count in the circles are also distributed unevenly. So this becomes a bit of a trial and error to find a population internval that works.
    Let's try to change the interval to 40,000 to 60,000.
    And now we got hits for all sites.
    image
    Changing the style for the Population Circles to a full colored pattern, no border line, and a 25% translucency helps.
    image
    There is more you can do here to improve the result:
    • You could save the Population Circles within the end range out to a separate dataset, merge the circles per site, and keep the maximum values. In this way, you would be able to show the distance and the population for the Population Circles. You can do that with this result as some of the sites have 2 or 3 circles within in the range.
    • You could create a small MapBasic tool that loops over the sites and increases the distance until it finds a circle that holds a population within your desired range. This would also allow you to use smaller steps that 0.5 miles.
    • You could create a small Python script doing the same as the MapBasic application.

      Do you have other suggestions on how to create these Population Circles?



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