MapInfo Pro

 View Only

MapInfo Monday: Mapping Data with a Zip Code II

  • 1.  MapInfo Monday: Mapping Data with a Zip Code II

    Employee
    Posted 3 days ago

    A few weeks ago, I showed how you could load sales data containing ZIP code information and map it against ZIP code polygons. You can find the article here.

    That solution works marvelously if you want to look at data for a single period, say a single year or month. But often you want to compare one period to another to detect change over time.

    Today, I will show you how you can add the 2025 sales numbers to a table where you already have the sales numbers for 2024.

    Happy #MapInfoMonday!

    Updating an Existing Zip Code Table with Additional Data

    I already have a table with zip codes and the sales numbers for 2024. This table is called Sales_Numbers in my example.

    image
    Now I want to add the sales numbers for 2025 to this existing table.
    This can be done in two steps:
    1. Add a new column for the additional sales number. Make sure to give it a meaningful name
    2. Update this new column with the sales numbers from your spreadsheet/CSV file.

    To add a new column to my table, I access the Table Structure dialog. You can quickly get to this dialog by double-clicking on the table in the Table List.

    Note: When you modify the structure of a table, the content of the table is saved into a new table and reopened. This also means that the table gets closed from all the windows that contain the table. I would strongly advise you to create a workspace with your current session before modifying the table structure, and after having changed the structure, close all and open this workspace again.

    image
    Now the Table Structure dialog opens for this table.
    image
    Now select an existing column that is of the same type as the new column you are looking to add. In this example, I'm selecting a column of type Integer. Then click on the Add Field button.
    image
    The text in the Name field is selected so you can immediately start typing the new name of the column.
    Once done, click on the OK button to recreate the table using the new defined structure. Now you are ready for the second step.
    Before the second step, you need to open the table with the sales data, in this example, the sales data for 2025. You can read more about this step in the earlier article.
    Now, you are ready to update your table Sales_Numbers with sales amounts for the year 2025. From the Table tab, click on the Update Column control. This control can also be found in all the SQL dropdowns.
    image
    In the Update Column dialog, select the table Sales_Numbers in the Table to Update list, and select the column SALES_2025 in the Column to Update list. Select the table Sales_Amount_2025 with the sales numbers from 2025 in the Get Value from Table list.
    From the Calculate list, select Value, and from the Of list select the column SALES_2025 that holds the sales amount for the year 2025.
    Now click on the Join... button and make sure the Join condition is correctly specified in the Specify Join dialog. In this example, the column Postsect should be set to match the other column Postsect.
    image
    Before you click on the OK button in the Update Column dialog, consider unchecking the Browse Results checkbox unless you want to see the results in a browser window.
    After running the update, you can modify your Theme Expression in the Field list to show the sales amounts for 2025 from the Theme tab.
    image
    This approach assumes that both tables share a common ZIP column and that unmatched records will remain 0. You may want to find records where the ZIP code doesn't match between the two tables.
    You can also add an additional theme to the map that shows the change in sales amount between the two years. If you have data for more than two years, you can include more years, too.
    From the Map tab, click on the Add Theme control.
    In the Create Thematic Map - Step 1 of 3 dialog, select the Bar Charts from the Type list and select one of the templates from the Template list.
    image
    Click the Next > button to continue.
    In the Create Thematic Map - Step 2 of 3 dialog, move the columns to include in your bar chart to the Fields for Pie/Bar Chart list. You can move a column by double-clicking on it or by selecting it and using the Add >> button.
    image
    Click the Next > button to continue
    Finally, you can use the Styles... button and the Legend... button to modify the styles and the legend for the theme.
    image
    Click on the OK button to add the new theme to the map.
    The resulting map shows the sales amount per ZIP code for the years 2024 and 2025. This allows you to quickly see the changes across the ZIP codes.
    image
    You can also query the actual values. This allows you to quickly identify growth, decline, and regional trends without restructuring your data model.
    Hopefully, you have found this valuable. Do let me know what topic you would like to see covered in one of the upcoming #MapInfoMonday articles.


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