MapInfo Pro Developers User Group

 View Only
  • 1.  thematic map v15 a 2021

    Posted 10 days ago
      |   view attached
    I have thematic map with version15 and now in 2021 it gives me an error when reading the layers, it does not recognize them.

    attached files
    '##### OBTENIENDO TITULOS DE VENTANAS DE LEYENDA Y PRINCIPAL ###############
    'str_tit_leyenda = "Theme Legend of " + WindowInfo(num_win_principal, WIN_INFO_NAME)
    str_tit_leyenda = ptituloleyenda + WindowInfo(num_win_principal, WIN_INFO_NAME)
    ............................
    '##### CREACION DE PRESENTACION (LAYOUT) ###############
    Layout Position (0,0) Units "cm" Width pWidth Units "cm" Height pHeight Units "cm"
    Set CoordSys Layout Units "cm"
    i_layout_id = IDWINDOWLYT()
    i_cartlgnd_id = IDWINDOWCRTLGD()
    Create Frame into Window i_layout_id (ppalx1,ppaly1) (ppalx2,ppaly2) From Window i_cartlgnd_id Pen (2,2,0) Brush (2,16777215,16777215) Title str_tit_principal FillFrame On
    Create Frame into Window i_layout_id (pleyx1,pleyy1) (pleyx2,pleyy2) From Window i_cartlgnd_id Pen (2,2,0) Brush (2,16777215,16777215) Title str_tit_leyenda FillFrame Off
    Create Frame into Window i_layout_id (plogx1,plogy1) (plogx2,plogy2) From Window i_cartlgnd_id Pen (2,2,0) Brush (2,16777215,16777215) Title str_tit_logo FillFrame On
    Create Frame into Window i_layout_id (plocx1,plocy1) (plocx2,plocy2) From Window i_cartlgnd_id Pen (2,2,0) Brush (2,16777215,16777215) Title str_tit_localizacion FillFrame On
    'Create Frame into Window i_layout_id (pntex1,pntey1) (pntex2,pntey2) From Window i_cartlgnd_id Pen (1,1,0) Brush (1,16764992) Title str_tit_norte FillFrame On
    Create Frame into Window i_layout_id (pntex1,pntey1) (pntex2,pntey2) From Window i_cartlgnd_id Pen (2,2,0) Brush (2,16777215,16777215) Title str_tit_norte FillFrame On
    .............


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

    Attachment(s)

    zip
    TEMATICOS.zip   12 KB 1 version


  • 2.  RE: thematic map v15 a 2021

    Employee
    Posted 8 days ago
      |   view attached

    Hi Mayca

    It works a bit differently with the new layout designer window.

    Here's an example where I have a map with a single layer with a thematic. I'm creating a layout with a copy of this map, and I then add legends for the layers; the thematic and the base layer.

    Include "MapBasic.def"
    
    Dim nLayoutWID, nMapID, nLegendWID, nMapFrameID, nLayer As Integer
    Dim fFrameX, fFrameY, fFrameWidth, fFrameHeight, fFramePositionY As Float
    
    nMapID = FrontWindow()
    
    Layout Designer
    nLayoutWID = FrontWindow()
    
    Set CoordSys Layout Units "cm"
    Set Paper Units "cm"
    
    Create Frame
    	Into Window nLayoutWID
    	(1, 1) (16, 16)
    	From Window nMapID
    	Pen (3, 2, 0)
    	Brush (2, 16777215, 16777215)
    
    nMapFrameID	= 1
    nMapID 		= LayoutItemInfo( nLayoutWID, nMapFrameID, LAYOUT_ITEM_INFO_WIN)
    
    fFrameX		= LayoutItemInfo( nLayoutWID, nMapFrameID, LAYOUT_ITEM_INFO_POS_X)
    fFrameY		= LayoutItemInfo( nLayoutWID, nMapFrameID, LAYOUT_ITEM_INFO_POS_Y)
    fFrameWidth	= LayoutItemInfo( nLayoutWID, nMapFrameID, LAYOUT_ITEM_INFO_WIDTH)
    fFrameHeight	= LayoutItemInfo( nLayoutWID, nMapFrameID, LAYOUT_ITEM_INFO_HEIGHT)
    
    fFramePositionY	= fFramePositionY + LayoutItemInfo(nLayoutWID, LayoutInfo(nLayoutWID, LAYOUT_INFO_NUM_ITEMS), LAYOUT_ITEM_INFO_HEIGHT)
    
    nLayer	= 1
    Create Designer Legend
    	Custom
    	Frame From Layer nLayer
    		Position (fFrameX, fFramePositionY) Units "cm"
    		'Using Label LayerInfo(nMapID, nLayer, LAYER_INFO_ALIAS)
    
    fFramePositionY	= fFramePositionY + LayoutItemInfo(nLayoutWID, LayoutInfo(nLayoutWID, LAYOUT_INFO_NUM_ITEMS), LAYOUT_ITEM_INFO_HEIGHT)
    nLegendWID 		= LayoutItemInfo(nLayoutWID, LayoutInfo(nLayoutWID, LAYOUT_INFO_NUM_ITEMS), LAYOUT_ITEM_INFO_LEGEND_DESIGNER_WINDOW)
    
    nLayer	= 2
    Add Designer Frame
    	Window nLegendWID
    	Custom
    	Frame From Layer nLayer
    		Position (fFrameX, fFramePositionY) Units "cm"
    		Using Label LayerInfo(nMapID, nLayer, LAYER_INFO_ALIAS)
    

    I have attached the table and the source code in a zip file.

    Open the table in a new map. It will automatically add a theme.

    Now run the example tool by first compiling it.

    The legends are added under the map that gets added to the layout. I need to tweak that position a bit though

    I hope this helps


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

    Attachment(s)



  • 3.  RE: thematic map v15 a 2021

    Posted 4 days ago
    Edited by Peter Møller 4 days ago

    Hi.

    Two points.
    1-How do I indicate that the layer is viewed with a zoom? or to show the entire layer? it looks small

    2-How do I put other layers on top? for example I have to introduce this layer  

    Set Map Layer RED_ALUMBRADO Display Graphic
    Set Map Layer RED_ALUMBRADO Display Global Global Line (1,2,16711680)
    Set Map Layer RED_ALUMBRADO Editable On
    Label Font ("Arial",257,8,16711680,16777215) Offset 3 Position Above
    With TIPO+"_"+MATERIAL+"_"+SECCION+" mm2"  
    Visibility Zoom(0,2) Units "km" Auto On Overlap Off PartialSegments On Duplicates On

    Thanks

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



  • 4.  RE: thematic map v15 a 2021

    Employee
    Posted 4 days ago

    Hi

    1. Zoom Layering

    The Set Map statement can set this:

    Set Map 
    	[ Window window_id ] 
    	[ Layer layer_id 
    		[ Zoom ( min_zoom, max_zoom )  [ Units dist_unit ] [ { On | Off } ] ] 

    Using your layer this could look like:

    Set Map Layer RED_ALUMBRADO Zoom (0, 5) Units "km" On

    2. Add another layer

    You can use the Add Map statement to add additional layers to your map.

    Add Map 
    	[ Window window_id ] [ Auto ]  
    	Layer table [ , table  [ Animate ] ...  ]

    If you are looking to add another table on top of the existing layers, this should do the trick:

    Add Map Window nMapWID Layer RED_ALUMBRADO

    In many cases, you can get help from MapInfo Pro itself. Open the MapBasic window and then perform the action in MapInfo Pro, such as adding a new layer and styling. The MapBasic window will now hold the statements used. Have a look at this MapBasic Monday: Introduction to MapBasic article.

    I use this quite often.



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