January 27, 2009

Create a GRASS Mapset in QGIS

I have had the question asked a few times lately of how to create a GRASS mapset with a fixed region in Quantum GIS. I would like to take this oportunity to address this here.

For these instructions I am refering to QGIS 1.0 (Kore).

Creating a mapset in QGIS
  1. Open QGIS and navigate to the menu Plugins -> GRASS -> New Mapset (you must attache the GRASS plugin with the Plugin Manager first)
  2. In the resulting dialog, navigate to an existing directory for the GRASS database or name a new one and select Next >
  3. Select an existing location or check "Create new location" and name a new location and select Next >
  4. In the next dialog you should see in the Existing mapsets at least one mapset called PERMANENT (default GRASS mapset). Now you can name a new Mapset in the box provided. When you select NEXT the new mapset will be created.
  5. Select Finish

You will now need to set the region extents which can be done using an existing GRASS vector or raster layer.

  1. Navigate to menu Plugins -> GRASS -> Open Mapset and open the mapset you just created
  2. Now go to menu Plugins -> GRASS -> Open GRASS Tools
  3. Scroll down to the tree item File - Import vector - v.in.ogr (using vector layer import for this example)
  4. Select the OGR file (shapefile, MapInfo etc.), select a name for the output GRASS vector layer and select Run (note: do not select the check box for "Limit import to current region")
  5. Close the import tool and go back to the Modules Tree to select Config - Region - Region Settings - g.region.multiple.vector
  6. Use enter or select the name of the newly importe vector layer and select Run (note: you can select multiple vector layers and the region will be set to the extents of all)
  7. When you open this mapset you should see a red boundary around the region

You should now have a new GRASS vector mapset with the region set to one or more vector layers. You can now begin adding new data, creating maps and analysing the data with the other GRASS and QGIS tools.

1 comment:

Anonymous said...

Nice post you got here. It would be great to read something more concerning this topic. Thank you for sharing this info.
Joan Stepsen
Gadgets and gifts