Duplicate Exports

NeilNeil Global Mapper UserPosts: 29Trusted User
edited June 2015 in GM Script Language
Hello
I am trying to write a script to take a single shape file (DAB_APPL.shp, pre-loaded), copy features from original shape file, to 2 newly created layers, then export each new layer to individual shape files. The problem i am having is global mapper doesn't seem to be accepting my filters for the layers to export, so i end up with the exported shape file containing all loaded data.

This is my script file:
GLOBAL_MAPPER_SCRIPT VERSION="1.00"
//Edit Appl shape layer, move feature to new layer


//Copying Features to Dids_Access Layer
//Copy DLO
EDIT_VECTOR FILENAME="DAB_APPL.shp" \
COPY_TO_NEW_LAYER=YES \
NEW_LAYER_NAME="Dids_Access.shp" \
COMPARE_STR="DISP_TYPE=DLO"


//Copy DML
EDIT_VECTOR FILENAME="DAB_APPL.shp" \
COPY_TO_NEW_LAYER=YES \
NEW_LAYER_NAME="Dids_Access.shp" \
COMPARE_STR="DISP_TYPE=DML"


//Copy FRD
EDIT_VECTOR FILENAME="DAB_APPL.shp" \
COPY_TO_NEW_LAYER=YES \
NEW_LAYER_NAME="Dids_RW.shp" \
COMPARE_STR="DISP_TYPE=FRD"


//Copy PLA
EDIT_VECTOR FILENAME="DAB_APPL.shp" \
COPY_TO_NEW_LAYER=YES \
NEW_LAYER_NAME="Dids_RW.shp" \
COMPARE_STR="DISP_TYPE=PLA"


SET_LAYER_OPTIONS FILENAME="DAB_APPL.shp" \
HIDDEN=YES


SET_LAYER_OPTIONS FILENAME="Dids_Access.shp" \
HIDDEN=YES


SET_LAYER_OPTIONS FILENAME="Dids_RW.shp" \
HIDDEN=YES


SET_LAYER_OPTIONS FILENAME="Dids_Access.shp" \
HIDDEN=NO


EXPORT_VECTOR FILENAME="O:\Shapes\Dids\Current Data\Dids_Access.shp" \
EXPORT_LAYER FILENAME="Dids_Access.shp" \
TYPE=SHAPEFILE \
SAVE_GRID_LINES=NO \
GEN_PRJ_FILE=YES \
OVERWRITE_EXISTING=YES
SHAPE_TYPE=AREAS

The reported errors are:
Duplicate Parameter <FILENAME> ignored
Vector Data must be loaded for EXPORT_VECTOR command

I sometime also get an this error just before the duplicate parameter:
Unknown Parameter <EXPORT_LAYER> ignored

I am fairly new to scripting, so a very sorry if i am asking a stupid question, but would anyone know why GM wouldn't accept my layer selection/filter

Comments

  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,233
    edited May 2015
    Hello Neil,

    In your EXPORT_VECTOR command, try this for the EXPORT_LAYER:
    EXPORT_VECTOR FILENAME="O:\Shapes\Dids\Current Data\Dids_Access.shp"\
    [I][B]EXPORT_LAYER="Dids_Access.shp" \[/B][/I]
    TYPE=SHAPEFILE \
    SAVE_GRID_LINES=NO \
    GEN_PRJ_FILE=YES \
    OVERWRITE_EXISTING=YES
    SHAPE_TYPE=AREAS
    

    You don't need the extra FILENAME parameter.

    Cheers,

    Bob
  • NeilNeil Global Mapper User Posts: 29Trusted User
    edited June 2015
    Bob
    I tried removing the script line referring to the layer name (the line you suggested). Unfortunately global mapper is still exporting all data layers loaded in global mapper to the new shape file, instead of just a single newly created layer "Dids_Acccess".
    I would like to just export a single layer from GM as i am starting with a single shape loaded, copying various features to new layers (4) then exporting those new layers to their own shape file. Do you have any suggestions on how i should accomplish this?
    I have tried, through scripting: specifying the specific layer (the script line you suggested to remove) and tried turning off all layers except the one i would like exported, but cant seem to get the script to run as desired.
    Neil
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,233
    edited June 2015
    Hi Neil,

    Please post the EXPORT_VECTOR command from your script so I can see exactly what you are doing? Thanks.

    Cheers,

    Bob
  • NeilNeil Global Mapper User Posts: 29Trusted User
    edited June 2015
    Bob
    the export vector component is the chunk you suggested i remove a line from, re-posted here:


    EXPORT_VECTOR FILENAME="O:\Shapes\Dids\Current Data\Dids_Access.shp" \
    *EXPORT_LAYER="Dids_Access.shp" \*
    TYPE=SHAPEFILE \
    SAVE_GRID_LINES=NO \
    GEN_PRJ_FILE=YES \
    OVERWRITE_EXISTING=YES \
    SHAPE_TYPE=AREAS

    When i tried turning the layers off before exporting, this is what i used:
    SET_LAYER_OPTIONS FILENAME="DAB_APPL.shp" \
    HIDDEN=YES


    SET_LAYER_OPTIONS FILENAME="Dids_Access.shp" \
    HIDDEN=YES


    SET_LAYER_OPTIONS FILENAME="Dids_RW.shp" \
    HIDDEN=YES


    SET_LAYER_OPTIONS FILENAME="Dids_Access.shp" \
    HIDDEN=NO


    EXPORT_VECTOR FILENAME="O:\Shapes\Dids\Current Data\Dids_Access.shp" \
    *EXPORT_LAYER="Dids_Access.shp" \*
    TYPE=SHAPEFILE \
    SAVE_GRID_LINES=NO \
    GEN_PRJ_FILE=YES \
    OVERWRITE_EXISTING=YES \
    SHAPE_TYPE=AREAS


    The first layer i am turning off is the original shape, the next layers are the newly created layers.
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,233
    edited June 2015
    Hello Neil,

    What version of Global Mapper are you using?

    In your post, I see asterisks before and after the EXPORT_LAYER line. Are those in your script, or is that an artifact of posting it on the forum? If they are in your script, you should remove them.

    Otherwise, I don't see anything that is obviously wrong. Would it be possible to send a zip archive containing your script file and the input data to geohelp@bluemarblegeo.com? Please include the version of Global Mapper that you are using. The support team can test your script to see if we get the same result and determine the solution. I will be out of the office until the middle of next week.

    Cheers,

    Bob
  • NeilNeil Global Mapper User Posts: 29Trusted User
    edited June 2015
    Bob
    I'm using 16.2, May 18 2015 build.
    When i fully removed the *EXPORT_LAYER="Dids_Access.shp" \*, and turned off all layers except just the data layer i want exported, i got my expected/desired result. Thanks.
Sign In or Register to comment.