Sorry, had to resend. Didn't know hotmail was going to send it html and it was going to be scrubbed....


Hi all, I want to create .tab files of just the DISPLAYED data layers that are contained within a clipped region ... I've got it to work the way I want with the drawing of the polygon/region ...but I've having a problem getting it to only select the tables that are displayed in the layer... it's selecting EVERYTHING that's open (like raster tabs that it can't process) even though they aren't displayed ..... anyone see an problems with my layerinfo() code? or is there some other command I should be using?

Thanks,
Tony

here's my code:

INCLUDE "mapbasic.def"
INCLUDE "icons.def"
INCLUDE "menu.def"

Declare Sub Main
        Dim tabname(100), newtabname(100) As String
        Dim i, j, numtabs as integer
        Dim map_id as Integer 'Map Window ID aka FrontWindow()
        Dim numlayers as SmallInt

'   Dim ClipRegion as Object

'----------------------------------------------------------------------------------------
'               CREATES MAPINFO .TAB FILES OF JUST THE DISPLAYED DATA (LAYERS)
'                                       THAT ARE CONTAINED WITHIN THE CLIPPED 
REGION
'----------------------------------------------------------------------------------------

Sub Main

        If NumTables() < 1  Then
                Note "You must open a table before continuing."
        End If

        note numtables() + " tables opened to be processed"

        i=1
        j=0

        numtabs = numtables()
        map_id = FrontWindow()
numLayers = MapperInfo(map_id, MAPPER_INFO_LAYERS) 'Get the total number of layers

        For i = 1 to NumLayers

IF LayerInfo(map_id, i, LAYER_INFO_DISPLAY) <> 0 ' LAYER_INFO_DISPLAY_OFF ' only want layers that are displayed and LayerInfo(map_id, i, LAYER_INFO_TYPE) = LAYER_INFO_TYPE_NORMAL ' only want "normal" layers
                        and TableInfo(i, TAB_INFO_TYPE) = TAB_TYPE_BASE
                        and Tableinfo(i, TAB_INFO_TYPE) <> TAB_TYPE_IMAGE
                THEN
                        j=j+1
                        tabname(j) = tableinfo(i,TAB_INFO_NAME)
                        newtabname(j) = "C:\temp\clipped_" +  tabname(j)
                ELSE
                END IF
        next

        for i = 1 to j

        Select * From tabname(i)
                Where obj within (Select obj From ClipRegion)
                        into temp
        Commit table temp as newtabname(i)

        next

Close Table temp
Drop Table ClipRegion

End Sub


_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to