Search and Replace Layer Description

Hi.

When using Layer > Split by <Feature Description> to break a DXF/DWG into its original layers, I am sometimes left with really long layer names. This is because GM prefixes the original Layer Description to the newly created layer names.

Example:

Layer Description  = LICENSE BOUNDARIES IN PROJECT AREA.dxf (Original file name)
<Feature Description> = 
Proposed Footprint (An example of a layer in dxf)

Becomes:

LICENSE BOUNDARIES IN PROJECT AREA.dxf  - Proposed Footprint 

I can of course rename the Layer Description first but I have to use at least one character e.g. '-'. If I do this and then split I have '- - ' prefixed to my split layers.

Example:

- -  Proposed Footprint 

I believe that GM prefixes a '-' before the Layer Description and the Feature Description thus creating two hyphens.

Is there any way I can run a search and replace to remove the '- - '? Currently the only Attributes available to search and replace are <Feature Name> or ELEVATION.

Any ideas welcome. 

Thanks 
Steve
Tagged:

Best Answer

  • JeffH@BMGJeffH@BMG Global Mapper Developer Posts: 305
    edited July 30 Answer ✓
    Hi Steve,

    You should be able to use the Attribute Calculator to do more complex search and replace operations. Load your data, and open up the Attribute Calculator (Layer / Calculate/Copy Attribute Values). Select <Layer Description> in the "Select Existing of Create New Attribute to Assign Calculated Values To:" dropdown. Then in the Box labeled "Enter Formula:", you can type in a formula that can be used to change the layer description. Something like the following should suffice:
    replace( <Layer Description>, "--", "" )
    When using the replace() function, be aware that the second argument to replace() is a regular expression, so you might want to read up on those if you need more advances replace options. But the sample above works to remove the double hyphens.

    Cheers,

    ~Jeff

Answers

  • sphillipssphillips Posts: 93
    Thanks Jeff. I'll give a whirl!
  • JeffH@BMGJeffH@BMG Global Mapper Developer Posts: 305Trusted User
    You're welcome. Feel free to follow up with questions. Oh, and do be a little bit careful; there's no undo when you make changes to your attributes table using the attribute calculator. You do have a sample of what you'll see in the dialog, bit if you're in doubt, you can always test it out using a new attribute as a target.

    ~Jeff
  • sphillipssphillips Posts: 93
    I am currently using GM 20.0 (b102518) and have tried to follow your instructions but keep running into an error (see below). The status appears to be as I want it, but it just doesn't work when I run it. Can you see any obvious errors on my part as I know little to nothing about the Attribute Calculator?

    Cheers,
    Steve

     


    ---------------------------
    Global Mapper v20.0.1 (b102518) [64-bit]
    ---------------------------
    Exception processing dialog <Attribute Calculation Setup> command message 1 with code 0.
    feature.cpp - 3267
    Version: v20.0.1 (67) (64-bit)
    Build Time: Oct 25 2018 02:22:18
    Thread: Main UI Thread




    Stack Trace:

    0000000140733C03 (global_mapper)

    00000001407354E1 (global_mapper)

    0000000140B15C9E (global_mapper)

    0000000140B16DA2 (global_mapper)

    00000001403D8C83 (global_mapper)

    000000014073C767 (global_mapper)

    000000014073C7F2 (global_mapper)

    000000014108D4D5 (global_mapper)

    0000000140791142 (global_mapper)

    00007FFF97A68F38 (mfc140)

    00007FFF97A69245 (mfc140)

    00007FFF97A96A71 (mfc140)

    00000001404B0E8B (global_mapper)

    00007FFF97B298AE (mfc140)

    00007FFF978A615D (mfc140)

    ... (44 Additional Stack Items Hidden)



    Windows 10 Enterprise (64-bit) Memory: 58,853,199,872 of 68,380,442,624 available, GDI Usage: 421 GDI (Peak 451), 179 User (Peak 186)



    Use Ctrl+V to Paste Error
    ---------------------------
    OK   
    ---------------------------

Sign In or Register to comment.