MapInfo Pro

Expand all | Collapse all

Group a series of fields in a theme

  • 1.  Group a series of fields in a theme

    Posted 09-10-2019 21:57
    Edited by George Corea 09-10-2019 22:01
    I have a theme like

    set shade window 3008 3 values "Borehole" Symbol (76,255,15,"MapInfo Water",0,0) ,"End Cap" Symbol (50,255,13,"MapInfo Water",1,0) ,"Ferrule Cock" Symbol (77,255,15,"MapInfo Water",257,168.1) ,"Intake" Symbol (120,255,14,"MapInfo Water",1,0) ,"Pump" Symbol (60,255,15,"MapInfo Water",257,0) ,"Reducer" Symbol (38,255,12,"MapInfo Symbols",1,0) ,"Stop Cock" Symbol (38,255,15,"MapInfo Water",1,0) ,"Tower" Symbol (58,255,13,"MapInfo Symbols",1,0) ,"Unknown" Symbol (36,255,1,"MapInfo Symbols",1,75.4) ,"WTP" Symbol (52,255,13,"MapInfo Symbols",1,0) default # color 1 #

    It also has values like Stop Valve, Sluice Valve etc.

    Is it possible to group these so something like "%Valve%" Symbol (76,255,15,"MapInfo Water",0,0)

    I can't define each Valve with the same symbology as then Spectrum shows all of them in the legend (Mapinfo thankfully allows us to choose to display a value or not).

    I can create a new column with a case statement to have all the Valves called Valve in a Type_Symbology column for example but this really shouldn't be required. The solution needs to work once uploaded into Spectrum Spatial so we can not just do a series of selects without having to save the data for spectrum to use.

    ------------------------------
    George Corea
    Mangoesmapping
    ------------------------------


  • 2.  RE: Group a series of fields in a theme

    Posted 09-18-2019 02:24
    Hi George
    The tricky thing is bringing the thematic to Spectrum Spatial.
    You can create an expression in MapInfo Pro that would consider all "valve" types as one item in the thematic and the rest as separate.
    But you would have to use some MapBasic functions that I know Spectrum Spatial doesn't support yet.

    I would use the IIf() MapBasic function for an expression like this:
    IIf(TYPE LIke "%Valve%", "Valve", TYPE)

    The expression will return "Valve" if the TYPE column contains the word "Valve". Otherwise, it will return the value in the TYPE column.

    You could try out some other methods too. You could use some string functions to extract part of the string in the TYPE column.
    Try an expression like this:
    Print "." + Mid$(TYPE, Maximum(1, InStr(1, UCase$(TYPE), "VALVE")), Len(TYPE)) + "."

    The functions used here are more "basic" mand might get transferred to Spectrum Spatial. I haven't tested it, however.

    Let us know how this goes

    ------------------------------
    Peter Horsbøll Møller
    Pitney Bowes
    ------------------------------



  • 3.  RE: Group a series of fields in a theme

    Posted 09-21-2019 05:23
    Thanks Peter,

    Hopefully the IIF will work in Spectrum soon.

    How do I use the second function to create a theme in v16? I get a syntax error when I try it in the Create Theme dialog

    image.png

    Regards,






  • 4.  RE: Group a series of fields in a theme

    Posted 09-22-2019 07:25
    Sorry, my mistake. I was testing the expression and used the Print statement to print the result of the expression to the Message window.

    Use this expression instead:
    Mid$(TYPE, Maximum(1, InStr(1, UCase$(TYPE), "VALVE")), Len(TYPE))

    ------------------------------
    Peter Horsbøll Møller
    Pitney Bowes
    ------------------------------