Global Mapper Pro

How best to split layer into groups based on search vector data queries?

kbellis
kbellis Global Mapper UserTrusted User
Objective
Thousands of assessors parcels with many land use CAMA codes (MSLANDUSEC), but which can be broken into 9 basic groups. I've been doing this manually, but am now a volunteer on the Ellsworth Broadband Committee and receiving updated parcel files more frequently from the assessor, and would like to automate this process. I would also like to automate the styling of the new layers at the same time.

Manual approach
The manual approach that I've taken was to perform a Search Vector Data query, select all of the results, copy those results, place them on their own new layer, and then style. This would be done all all 9 major land use groups. For example, below is for the first group, 1000 - Residential, using the following query:

 %MSLANDUSEC%  >= 1000  and  %MSLANDUSEC%  < 2000


First failures
Before reaching out here on the forum for guidance, I tried and failed:


Thank you in advance for how best to split layer into groups based on search vector data queries.

Kind regards,

Kelly


Answers

  • bmg_bob
    bmg_bob Global Mapper Programmer
    edited July 13
    Hi Kelly,

    You can use a command like this for each of your groups, repeating the statement with the desired minimum and maximum values, and output layer name.
    EDIT_VECTOR FILENAME="%LAYER% "COPY_TO_NEW_LAYER=YES NEW_LAYER_NAME="CAMA - 1000" \
     COMPARE_STR="MSLANDUSEC>=1000" COMPARE_STR="MSLANDUSEC<2000" COMPARE_OP="ALL" COMPARE_NUM=YES 
    A more advanced approach would be to use the DEFINE_VAR_TABLE command to create a table of minimum and maximum values, and loop through the table using VAR_LOOP_START and VAR_LOOP_END.

    Cheers,
    Bob
  • kbellis
    kbellis Global Mapper User Trusted User
    Thank you so much Bob, I very much appreciate your help. I will study what you've outlined and the links that you have kindly provided.

    Kind regards,

    Kelly

  • kbellis
    kbellis Global Mapper User Trusted User
    Apparently, there can't be any gaps between these:
    <attr_name><operator><attr_value>
    Because the new layer only resulted after I removed the gaps:

  • bmg_bob
    bmg_bob Global Mapper Programmer
    Hi Kelly,

    Oops. I forgot that detail. I have edited the example. Thanks.

    Cheers,
    Bob
  • kbellis
    kbellis Global Mapper User Trusted User
    Seems like the anomalies are always a snag. In trying to deal with non-conforming CAMA coding, in the manual operation using Search Vector Data, I used
     %MSLANDUSEC%  < 1000  and  %MSTYPE%   <>  'WATER'
    Which resulted in 592 features

    But when trying to approximate this operation through scripting, there are only 408 features

    Note that I've commented out the COMPARE_NUM=YES. This is because 1) we've got values like 999V, and 2) we've got (null) values. When the COMPARE_NUM=YES is included in the script and allowed to run, the results dropped to 291 features.

  • kbellis
    kbellis Global Mapper User Trusted User
    PS. I tested using <> in the script. It seemed to work, even though it wasn't listed as a legal operator in Global Mapper Scripting Reference, Section 10:Edit Vector Data.
  • kbellis
    kbellis Global Mapper User Trusted User
    EDIT_VECTOR FILENAME="%LAYER%" COPY_TO_NEW_LAYER=YES NEW_LAYER_NAME="CAMA Non-conforming" COMPARE_STR="MSLANDUSEC=999V" COMPARE_STR="MSLANDUSEC<1000" COMPARE_STR="MSTYPE<>WATER" COMPARE_OP="ALL" AREA_TYPE="CAMA Non-conforming"
    This results in zero features.

    But using only:
    EDIT_VECTOR FILENAME="%LAYER%" COPY_TO_NEW_LAYER=YES NEW_LAYER_NAME="CAMA Non-conforming" COMPARE_STR="MSLANDUSEC=999V" COMPARE_STR="MSTYPE<>WATER" COMPARE_OP="ALL" AREA_TYPE="CAMA Non-conforming"
    results in 201 features; i.e., all with MSLANDUSEC=999V

    It seems that both COMPARE_STR comparisons; i.e., COMPARE_STR="MSLANDUSEC=999V" and COMPARE_STR="MSLANDUSEC<1000", don't play nice together. 



  • kbellis
    kbellis Global Mapper User Trusted User

    Crying uncle, unable to script for the non-conforming (shown in red above) and putting a pin in it, I moved on this afternoon and tried the DEFINE_VAR_TABLE approach.

    I obviously have no clue what I'm doing. And please don't take this the wrong way, but who ever wrote the Global Mapper Scripting Reference clearly knows what they're talking about; however, it's written as if they are writing for somebody who already knows what they're talking about.


Sign In or Register to comment.