MapInfo Pro

 View Only

MapInfo Monday: Time Series and Layer Visibility Expression in MapInfo Pro v2021.1

  • 1.  MapInfo Monday: Time Series and Layer Visibility Expression in MapInfo Pro v2021.1

    Posted 04-04-2022 03:26

    Happy #MapInfoMonday,

    As you may have seen, we released MapInfo Pro v2021.1 late last week. I'll use the next couple of #MapInfoMonday articles to dive into some of the improvements that this new release of MapInfo Pro brings to you as a user.​

    In the article today, I'll look at a new feature called Layer Visibility Expression and how this can be used in conjunction with Time Series.

    Below, you can see an example of property development around a Danish city in the form of a dynamic GIFF where the Time Series not only controls the display of features from the vector layer but only changes the base map to match this to the time. Notice how the base map changes around 1905, 1950, 1980, and 2005.

    Layer Visibility Expression

    With MapInfo Pro v2021, we added a new Filter tab to the Layer Properties dialog. On this Filter tab, you will find the Layer Filter option that we added with v2021 and now also the Visibility Expression option that is new to v2021.1.

    The visibility expression is a Boolean (Logical) MapBasic expression that determines if a Layer will be visible or not when the Map is being drawn. It is similar to zoom layering, but the expression is more flexible. The expression can be based on Map, Layer, or Table properties by using the CurContext() function along with MapperInfo(), LayerInfo(), or TableInfo() functions in the expression.

    One example of usage could be to show a layer only within a certain scale range. MapInfo Pro currently only supports layer visibility based on Zoom Width of the map. 

    Another example could be to show the layer only during certain time periods in a time series. Visibility expression is used by the Time Series feature to do this. This means that you don't have to set these expressions through the Visibility Expression on the Layer Properties dialog. You can set them through the Layer Time Options dialog. 

    Using Visibility Expression in combination with Time Series

    The first thing you need to do is to add a Time Series to your map. In my example, I have used a cadastre map containing dates for when a property was registered. You can also use a base map to initialize your Time Series. We have earlier covered this feature in this article: MapInfo Monday: Creating Time Series in MapInfo Pro v2021.

    Now you can specify time intervals for your base maps to include these in your Time Series.

    Right-click on the base map and select Layer Time Options... from the Layer Context menu.

    There are multiple ways to set the Layer Time Options for a base layer. I'll show you the very basic way where you manually specify the extents for the layer.

    In the Layer Time Options dialog, you first have to select the Visibility Expression option. Then you need to select the Configuration from the dropdown list. As you can see below, I have selected Start and end date/time columns because I want to specify a date interval.

    The next step is to select Expression from the Start Column dropdown which will open up the Expression dialog.

    As I said above, I will show you the very basic way to set a date simply by entering the date into the Expression field. To make MapInfo Pro understand that you are entering a date, you need to convert the value entered to date. Below I have used the simple NumberToDate() function to do this. This function takes a numeric value in the form of a date as YYYYMMDD:


    This equals January 1st, 1800.

    Hit OK to accept this and do the same for the end date.

    Now your Layer Time Options dialog looks like this. Make sure the dates you have entered are correct. You can validate these by looking at the Extents which will show the date that MapInfo Pro has picked up from the expression you entered. A typical mistake is to switch the order of the month and date in the expression, or only enter the year as a two-digit value.

    If all looks fine, hit OK to set the Layer Time Option and continue doing this for the next base map layer.

    As you run through your Time Series, you should now see how the base maps are turned on.

    Up until 1900, the map will use the oldest base map.

    When you go into 1905, another base map will get turned on.

    Notice that my Time Series is set up to only use the End Time to limit the features. This also means that my base maps will stay turned on. I have ordered the base map layers in the Layer List so that the older layers are under the newer layers. In this way, the newer layers will hide the older layers as they get turned on.

    If your Time Series is using Start and End Time, the layers will get turned on and off by the Time Series.

    We hope you like this improvement to the Time Series feature. The improvement came in as a user request during one of our MapInfo Pro v2021 webinars late last year.

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