MapInfo Pro Developers User Group

Expand all | Collapse all

Loading Raster Images is slow

  • 1.  Loading Raster Images is slow

    Posted 01-22-2020 11:48
    Edited by Michel Li 01-22-2020 14:56
    I am trying to add 61 raster images in the map window and it is very fast in mapinfo 12.5 (18 seconds) but very slow in 2019 (1 minute 7 seconds). Does anyone know the reason? Here my codes.

    Sub Imagery_Render(ByVal tableName as String, ByVal zoomMin as Float, ByVal zoomMax as Float)
           Dim windowId as String
           Select TabFile from tableName Into tblTifFiles
           Set Event Processing Off
           Fetch First from tblTifFiles
               windowId = UI_GetMapWindowID()
               Do While NOT EOT(tblTifFiles)
                    Dim tabFile, name as String
                    tabFile = tblTifFiles.TabFile
                    Open Table tabFile Interactive
                    name = TableInfo(NumTables(), TAB_INFO_NAME)
                    Add Map Layer name Position 5
                    Set Map Window windowId  Layer 5 Zoom (zoomMin, zoomMax) Units "mi" On Display Off
                   Fetch Next from tblTifFiles
              Loop
         Set Event Processing On

    Close Table tblTifFiles
    End Sub

    ------------------------------
    Michel Li
    Programmer
    GEOSEARCH LLP
    Austin TX
    ------------------------------

    ------------------------------
    Michel Li
    Programmer
    GEOSEARCH LLP
    Austin TX
    ------------------------------


  • 2.  RE: Loading Raster Images is slow

    Pitney Bowes
    Posted 01-24-2020 00:14
    If Pro 2019, when you load a TIFF file for the first time, it will probably create an overview cache which is stored in a PPRC file with the TIFF. This takes a little time and so the first time you load the TIFF, it will be slower. The next time you open the TIFF the PPRC file will already be present and so it will be faster as it does not need to make it again.

    If your TIFF files are in a read-only directory (for example if they are on a DVD) then the PPRC file cannot be stored. It will be kept as a temporary file that will be deleted when you close the TIFF. This will cause it to be slow each time you open the TIFF because the PPRC is created every time.

    There are other settings which have an impact on this behaviour. In the backstage area under Options and MapInfo Pro Raster Preferences, there is a setting under "Display" called "Generate Raster Overview Cache" that can modify this behaviour.

    If you really want it to behave like 12.5, then in the same preferences dialog, in the "Raster Formats" page, you can disable the TIFF driver (both Native and GDAL) and this will return you to the TIFF driver used in Pro 12.5.

    ------------------------------
    Sam Roberts
    Engineer, MapInfo Pro Advanced (Raster)
    Australia
    ------------------------------



  • 3.  RE: Loading Raster Images is slow

    Posted 01-24-2020 11:08
    Edited by Michel Li 01-24-2020 11:31
    Sam,

    I changed the options you told me and unfortunately it did not help. It takes the a long time to load the 61 images. Did I miss any steps?
    See screen below.






    ------------------------------
    Michel Li
    Programmer
    GEOSEARCH LLP
    Austin TX
    ------------------------------



  • 4.  RE: Loading Raster Images is slow

    Pitney Bowes
    Posted 01-27-2020 23:35
    By removing support for TIFF files by both the native driver and the GDAL driver, you ought to ensure that the TIFF files are loaded by the old Pro drivers.

    Another possibility is that the system is being forced to compute some statistics for each of the TIFF files when you open them. Statistics are cached in the GHX file but only if they are computed in full for the base resolution level. This does not happen automatically so when you open a raster it may compute some approximate statistics in order to render the data. This takes a little time and may slow down the loading of many rasters.

    If you want this investigated further I suggest you contact support, provide them with your data and workspaces etc and they can investigate.

    ------------------------------
    Sam Roberts
    Engineer, MapInfo Pro Advanced (Raster)
    Australia
    ------------------------------