MapInfo Pro

 View Only
  • 1.  Relaunch loading MAPINFO layers 2021

    Posted 12-13-2023 12:14
    Edited by Peter Møller 12-14-2023 01:53
    Hi

    I have a code in mapbasic, which creates a map based on data from an Oracle database and the layers are generated (also with Oracle data) I have the code with mapbasic 15 (MAPINFO 15) but now when moving to mapbasic 2021 (MAPINFO 2021) this loading of layers has been slowed down. Because? Is there any way to optimize that load? Thanks

    Dim strTabla As String
    
    '------------- CARGAMOS EL MAPA
    If gblORACLE=False Then
      'Open Table gblRUTA+"\"+gblNOMBRE_MUNICIPIO+"\MAPA.TAB" as MAPA
      Open Table gblRUTA+"\"+gblMUN + " - " + gblNOMBRE_MUNICIPIO+"\MAPA.TAB" as MAPA
    Else
      strTabla = gblEsquema + ".MAPA"
      Server gblConnect 
        Link Table "SELECT * FROM "+strTabla
        Toolkit "ORAINET"
        Into MAPA
        File gblTEMP+"\MAPA.TAB"
    End If
    If blnBackup=True Then
      Call Recover("MAPA")
    End If
    
    If gblSystem64=True then
      Map From MAPA
    Else
      Map From MAPA Max
    End If
    
    'Add Map Layer MAPA
    
    Set Map Redraw On
    Set Map Layer MAPA Display Graphic Label Font ("Arial",1,7,255) With NOMBRE Auto On
    Set Map Layer MAPA Editable Off
    Set Map Layer MAPA Selectable Off Zoom(0,100.000)
    Set Map Layer MAPA Display Off
    Set Map Redraw Off
    Set Table MAPA UserMap Off
    Set Table MAPA UserClose Off
    Set Table MAPA UserRemoveMap Off
    Call RestringirAccesoEdicion("MAPA") 'Restringimos el acceso a los municipios
    
    If gblORACLE=False Then
      Open Table gblRUTA+"\"+gblMUN + " - " + gblNOMBRE_MUNICIPIO+"\EQUIPAMIENTOS.TAB" as EQUIPAMIENTOS
    Else
      strTabla=gblEsquema+".EQUIPAMIENTOS"
      Server gblConnect
        Link Table "SELECT * FROM "+strTabla
        Toolkit "ORAINET"
        Into EQUIPAMIENTOS
        File gblTEMP+"\EQUIPAMIENTOS.TAB"
    End If
    If blnBackup=True Then
      Call Recover("EQUIPAMIENTOS")
    End If
    
    If gblMAS50K = True Then
      '---------- COLECTOR_ENC_M50
      If gblORACLE=False Then
        Open Table gblRUTA+"\"+gblMUN + " - " + gblNOMBRE_MUNICIPIO+"\COLECTOR_ENC_M50.TAB" as COLECTOR_ENC_M50
      Else
        strTabla=gblEsquema+".COLECTOR_ENC_M50 WHERE mun = '" + gblMUN + "' and fase='"+gblFASE+"'"
        Server gblConnect
          Link Table "SELECT * FROM "+strTabla
          Toolkit "ORAINET"
          Into COLECTOR_ENC_M50
          File gblTEMP+"\COLECTOR_ENC_M50.TAB"
      End If
      If blnBackup=True Then
        Call Recover("COLECTOR_ENC_M50")
      End If
    
      Set Table COLECTOR_ENC_M50 UserMap Off
      Set Table COLECTOR_ENC_M50 UserClose Off
      Set Table COLECTOR_ENC_M50 UserRemoveMap Off
      Call RestringirAccesoEdicion("COLECTOR_ENC_M50") 'Restringimos el acceso a los municipios
    Else
      '---------- COLECTOR_ENC
      If gblORACLE=False Then
        Open Table gblRUTA+"\"+gblMUN + " - " + gblNOMBRE_MUNICIPIO+"\COLECTOR_ENC.TAB" as COLECTOR_ENC
      Else
        strTabla=gblEsquema+".COLECTOR_ENC WHERE mun = '" + gblMUN + "' and fase='"+gblFASE+"'"
        Server gblConnect
          Link Table "SELECT * FROM "+strTabla
          Toolkit "ORAINET"
          Into COLECTOR_ENC
          File gblTEMP+"\COLECTOR_ENC.TAB"
      End If
      If blnBackup=True Then
        Call Recover("COLECTOR_ENC")
      End If
    
      Set Table COLECTOR_ENC UserMap Off
      Set Table COLECTOR_ENC UserClose Off
      Set Table COLECTOR_ENC UserRemoveMap Off
      Call RestringirAccesoEdicion("COLECTOR_ENC") 'Restringimos el acceso a los municipios
    End If
    
    '------- COLECTOR
    If gblORACLE=False Then
      Open Table gblRUTA+"\"+gblMUN + " - " + gblNOMBRE_MUNICIPIO+"\COLECTOR.TAB" as COLECTOR
    Else
      strTabla=gblEsquema+".COLECTOR WHERE mun = '" + gblMUN + "' and fase='"+gblFASE+"'"
      Server gblConnect
        Link Table "SELECT * FROM "+strTabla
        Toolkit "ORAINET"
        Into COLECTOR
        File gblTEMP+"\COLECTOR.TAB"
    End If
    If blnBackup=True Then
      Call Recover("COLECTOR")
    End If



    ------------------------------
    Mayca González Pérez
    COMUNIDAD. AUT. REG MURCIA
    ------------------------------



  • 2.  RE: Relaunch loading MAPINFO layers 2021

    Employee
    Posted 12-14-2023 01:57

    Hi Mayca

    Have you been able to pinpoint what part of the code is slow?

    Can you try adding some timer statements like this in a handful of places:

    Print Time(24) + " Opening Table 'Collector' via Server Link Table..."

    The Time(24) function returns a time expression like "07:56:12".



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



  • 3.  RE: Relaunch loading MAPINFO layers 2021

    Posted 12-15-2023 00:58

    In all parts, loading takes longer in version 2021 compared to version 15. The total charging process used to be 2 min and now it is 3 min. Thanks



    ------------------------------
    Mayca González Pérez
    COMUNIDAD. AUT. REG MURCIA
    ------------------------------



  • 4.  RE: Relaunch loading MAPINFO layers 2021

    Employee
    Posted 03-12-2024 06:01

    Hi

    I dropped this one, sorry.

    One thing we have seen is that sometimes the Explorer window does slow down things a bit. But that's typically when opening and closing tables hundreds of times.

    Do you the Explorer Window open when running the tool in v2021? Can you try without having the Explorer window open?

    What version of v2021 are you on?

    Thanks



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



  • 5.  RE: Relaunch loading MAPINFO layers 2021

    Posted 03-14-2024 06:15
    Indeed, if I have the browser closed, the loading goes faster.
    Is there a way to close the explorer when loading starts and when it finishes open it with some function in MAPBASIC?

    Thanks


    ------------------------------
    Mayca González Pérez
    COMUNIDAD. AUT. REG MURCIA
    ------------------------------



  • 6.  RE: Relaunch loading MAPINFO layers 2021

    Employee
    Posted 03-14-2024 06:32

    Great! I would not have expected the Explorer window to slow your process that much though.

    You can try this:

    Close Window WIN_WORKSPACE_EXPLORER  'or 2004

    ...

    Open Window WIN_WORKSPACE_EXPLORER  'or 2004

    Thanks

    Peter



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



  • 7.  RE: Relaunch loading MAPINFO layers 2021

    Posted 03-15-2024 03:40

    Hi!!!

    It does not work.
    I have tried both ways. It doesn't give an error but it doesn't close the explorer



    ------------------------------
    Mayca González Pérez
    COMUNIDAD. AUT. REG MURCIA
    ------------------------------



  • 8.  RE: Relaunch loading MAPINFO layers 2021

    Employee
    Posted 03-15-2024 03:53

    Hi

    That's weird. I did a quick test and ran this statement in the MapBasic window:

    Close Window 2004

    That did close the Explorer Window in my MapInfo Pro.

    Let me try in a sample application too



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



  • 9.  RE: Relaunch loading MAPINFO layers 2021

    Employee
    Posted 03-15-2024 05:21

    Hi

    I wrote this small sample application to test it and for me, it does work.in v2019 and v2021.1

    Include "MapBasic.def"
    
    Dim nTime As Integer
    
    Close Window 2004
    
    nTime = Timer()
    Do Until Timer() > (nTime + 2)
    	'**Waiting
    Loop
    
    Open Table ProgramDirectory$() & "TileServer\OSM_Roads.TAB"
    Map From OSM_Roads
    
    Set Coordsys Table OSM_Roads
    Set Map Window FrontWindow() Zoom 20000 Units "m"
    Set Map Window FrontWindow() Center (1816000, 4981000)
    
    nTime = Timer()
    Do Until Timer() > (nTime + 2)
    	'**Waiting
    Loop
    
    Open Window 2004

    The two loops are just to allow me to see that the Explorer Window gets closed and reopened.

    Does this work for you?



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



  • 10.  RE: Relaunch loading MAPINFO layers 2021

    Posted 03-18-2024 03:22
    Okay. Now it works fine.


    ------------------------------
    Mayca González Pérez
    COMUNIDAD. AUT. REG MURCIA
    ------------------------------