Global Mapper v24.0

Edit Vector - Delete Features types or Export Features of Interest

Hi,

I am importing several DXF layers consisiting of point and line data. I am trying to remove the line before i use GENERATE_LAYER_BOUNDS. The line data is generating too much noise.

I have looked at SPLIT_LAYER but cant delete the lines, only seperate them from the point data. So this is not useful to me.

The closest i got was using EDIT_VECTOR to try and select the feature of interest and move them to a new layer. This is what i used, but it wont find the features of interest.

EDIT_VECTOR ATTR_EXISTS="<Feature Type>=Unknown Point Feature" MOVE_TO_NEW_LAYER="YES"

Any ideas how to either prevent importing the lines (only points in the DXFs), deleting the line features, or post process to move the point data to new layers deleting the original imports?

Seems simple this and doing my head in.

Answers

  • Mike must be on holiday.....

  • Anybody????

  • JeffH@BMG
    JeffH@BMG Global Mapper Developer Trusted User

    Hi Burt,

    Interesting. Deleting features from a layer seems like a good feature to have, but doesn't seem to be there. I'll see what the folks here think about adding it to EDIT_VECTOR, which seems like a natural place to put it.

    In the meantime, you can do something of the sort using spatial scripting, or at least copy the features that you want into a new layer. For example, if your layer was named "MyLayer", you can create a new layer of the lines in "MyLayer" using the following spatial script command:

    layer "NewLayer" = "MyLayer"[lines]

    You can even do filtering of the lines using the attribute query language, if, say, you had an attribute named "type" that had various road classifications:

    layer "NewRoads" = "MyLayer"[lines] where type = "highway"

    These can be run in the Scripting tab of the Spatial Operations dialog. In more recent versions of Global Mapper (I think from 23.1 on), you can create spatial operations script files that have extension ".gmss" that can be run from the Script Editor, See https://www.bluemarblegeo.com/knowledgebase/global-mapper-23-1/Spatial_Operations_Scripting.htm

    If you wanted instead to operate on features that are selected, that's something that you can do with spatial scripting as well, e.g.:

    select "MyLayer"[lines] where type = "highway"

    Note: adding the ability to delete features from a layer would be nice in spatial scripting as well as to EDIT_VECTOR.

    Spatial script commands can also be embedded in a standard Global Mapper script, using the BEGIN_SPATIAL_OPERATION / END_SPATIAL_OPERATION script commands. For example, assuming that "MyLayer" was already loaded:

    BEGIN_SPATIAL_OPERATION

    layer "NewRoads" = "MyLayer"[lines] where type = "highway"

    END_SPATIAL_OPERATION

    See https://www.bluemarblegeo.com/knowledgebase/global-mapper-23-1/cmd/DEFINE_SPATIAL_OPERATION.htm.

    Not exactly what you asked for, but I hope that it helps.

    Best,

    ~Jeff

  • Hi Jeff,

    Thanks for this information. This would be a good workaround if my layer name was the same. The issue is i have to loop through all loaded layers and the names change each time so i cant hard code names. Can this we done?

    I am very suprised this is not a standar EDIT feature and would highly recommend its added in a future version. Hopefully V23.

    Thanks again

  • JeffH@BMG
    JeffH@BMG Global Mapper Developer Trusted User

    Yeah, there's no way currently to parameterize spatial scripts in that way, either in the scripting spatial itself, or in spatial scripts embedded in GM scripts. I definitely see the utility for both; I've had them on my mental radar for awhile, but haven't acted on them yet. I'll make tickets for your suggestions, including the EDIT VECTOR change, and get that ball officially rolling.

    Cheers,

    ~Jeff

  • JeffH@BMG
    JeffH@BMG Global Mapper Developer Trusted User

    OK, talked to Mike, who pointed out that EDIT_VECTOR has a 'DELETE_FEATURES' option. For example:

    EDIT_VECTOR FILENAME="MyFile.shp" DELETE_FEATURES SHAPE_TYPE="LINES"

    or

    EDIT_VECTOR FILENAME="MyFile.shp" DELETE_FEATURES=YES SHAPE_TYPE="LINES"

    These will delete the line features in the layer.

    Sorry for having led you down a different path -- I missed it both in the code and the documentation (EDIT_VECTOR is a pretty complicated script command). There's a reason that it seemed like a good option to have...

    Hope that this helps (better).

    ~Jeff

  • Thanks Jeff,

    Yes, Mike is correct and your second line worked using DELETE_FEATURES. Note that the script reference is not that clear how to use this. It would be recommendable to add some more text or an example similar to what you have above.

    I find most of the questions in this forum could be resolved by adding in examples in the script manual

    Thansk again for your help with this.

    Kind regards,

    Burt

Sign In or Register to comment.