COMBINE_LINES
The COMBINE_LINES command allows you to combine connected lines features based on one or more attribute or label values. You can choose to combines in just a single loaded layer or in all loaded vector layers. You can either create new line features from the connected lines, or using the CREATE_AREAS_FROM_LINES parameter instead create new area features by connecting the lines into closed shapes. The newly created features will be placed in a new layer and have the current projection. If creating lines, any lines that are connected to another line will be marked as deleted. You can also supply multiple COMPARE_STR parameters to apply multiple criteria, all of which must be true, in order for the lines to be considering for combining.
The following parameters are supported by the command:
- CREATE_AREAS_FROM_LINES - controls whether or not area features will be created from connected lines or just new line features. The default is CREATE_AREAS_FROM_LINES=NO. Use CREATE_AREAS_FROM_LINES=YES to create new areas rather than lines.
- FILENAME - filename of the layer to assign types to. If an empty value is passed in, all loaded vector layers will be updated. This parameter can be listed more than once to specify multiple input files, like FILENAME="FILENAME_1" FILENAME="FILENAME_2". When running the script in the context of the main map view (including loading a workspace) you can also pass in the value 'USER CREATED FEATURES' to have the 'User Created Features' layer updated or 'SELECTED LAYERS' to have any layers selected in the Control Center.
- COMPARE_STR - specifies a comparison operation to perform to see if a line feature is one that needs to be considered. The format is attr_name=attr_value or attr_name!=attr_value (for equals and not equals comparisons respectively). For example if you have an attribute named CFCC and you want to match when the value of that attribute starts with an 'A', you can use COMPARE_STR="CFCC=A*" as your parameter. You can add multiple COMPARE_STR parameters to a single command to combine multiple criteria for your search. If you would like to compare against a feature label rather than an attribute, use <Feature Name> for your attribute name. To compare against a feature type name rather than an attribute, use <Feature Type> for your attribute name. To compare against the feature description, use <Feature Desc> for your attribute name. If you just want all lines features from the specified layer(s), just don't specify a COMPARE_STR value. You can also use <Feature Layer Name> to specify a match against a layer name that will support wildcards.
- CASE_SENSITIVE - specifies whether or not text comparisons are case sensitive or not. Use CASE_SENSITIVE=YES to enable, by default comparisons are not case sensitive.
- LAYER_DESC - specifies the name to assign to the newly generated layer containing the connected line features. If no layer description is provided, the default name of "Combined Lines" will be used.
- COMPATIBLE_ONLY - specifies whether or not any connecting lines should be combined (the default) or just those which have compatible types and attributes. Use COMPATIBLE_ONLY=YES to enable combining only compatible lines.
- CLOSED_LINES_ONLY - specifies whether or not any connected lines have to form a closed shape in order to create an area when generating area features. Use CLOSED_LINES_ONLY=YES to enable requiring closed paths.
- CREATE_MULTIPLE_AREAS - specifies whether multiple area features can be created if the lines don't all connect to each other. This is enabled by default, use CREATE_MULTIPLE_AREAS=NO to disable this and require all matching lines to connect in a single path before creating an area.
- MAX_DIST - specifies the maximum distance in meters that the end points of lines can be apart and still count as connected when combining them.