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: 289
    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: 81
    Thanks Jeff. I'll give a whirl!
  • JeffH@BMGJeffH@BMG Global Mapper Developer Posts: 289Trusted 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
Sign In or Register to comment.