MapInfo Pro

 View Only
  • 1.  Number of Grids in a Workspace? A Quick way rather than Counting

    Posted 28 days ago

    Hello,

    I'm trying to find the number of Grids there are in a workspace. So far i've been counting this manually. But i need to do it for alot of different workspaces.

    I've tried table lists, but that just lists what grids are open, and doesnt provide a number of grids.

    Any help is appreciated



    ------------------------------
    Alexis Ha
    LYALL & ASSOCIATES PTY LTD & SCOTT BUTTON & ASSOCIATES PTY LIMITED
    Burlington MA
    ------------------------------


  • 2.  RE: Number of Grids in a Workspace? A Quick way rather than Counting

    Employee
    Posted 27 days ago

    You can try this:

    Open the SQL window, switch to Python via the New dropdownand paste this Python code:

    nTables = 0
    nTables = int(eval('NumTables()'))
    print('Tables in total: {0}'.format(nTables))
    
    nImageTables = 0
    nTab = 0
    
    while nTab < nTables:
        if (int(eval('TableInfo({0}, 3)'.format(nTab))) == 4):
            print('Table {0} is image/raster'.format(eval('TableInfo({0}, 1)'.format(nTab))))
            nImageTables = nImageTables + 1
        nTab = nTab + 1
    
    do('Note "{0} tables are raster/image"'.format(nImageTables))

    With your tables open, run the code.

    If the results looks fine, you can give it a name via the Scripts dropdown and make it a favorite.

    Now you can run the code via the SQL dropdown.



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