Add multiple raster or vector map layers to current map display in GRASS GIS

If your mapset contains many raster or vector layers GRASS offers a very handy feature to quickly select the layers you want to add to your current map display. In the layer manager, click Ctrl+Shift+L to open the ‘add selected map layers into layer tree’ window.

 

Add selected map layers into layer tree_001

Next, select the map type and mapset where from where you want to select you layers. Now, in the field ‘Pattern’ you can start typing the name of the name of the layer(s). It will shows the results as you type. For example, below I am selecting all layers which name start with ‘trans’.
Add selected map layers into layer tree_003

What makes this option so powerful is that you can use regular expressions to select your layer. For example, I have a number of probability distribution layers based on various model techniques. The name of these layers all start with ‘transzone_model‘ followed by a number (1,2,3 or 4, which refers to the sets of input data used to create the model), than the code for the type of model. All probability layers were also converted to presence/absence layers, which have the same name as the probability layer they are based on, but with the suffice ‘_presence‘.

OK, if that doesn’t sound like a terribly smart naming scheme, you are probably right. But anyway, what if I want to select all probability distribution layers based on data set 2 and created using the Bioclim model? Well, I can simply use a regular expression to get required layer, as in the example below.

 

Add selected map layers into layer tree_004

An additional handy, but somewhat hidden, option is to select or deselect all layers at once. You can do this using the right click context menu; i.e., right click on any of the layers and you are presented with the context menu shown below.
Add selected map layers into layer tree_008

Other great regular expression tricks are the positive and negative look ahead or look behind. For example, (?<![0-9])BIOCLIM will find all layers with BIOCLIM in the name, which are not directly preceded by a number. See here for more regular expression rules.

If you want to learn more about the Graphical User Interface(GUI) for GRASS GIS, you can go here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s