WxPython-based GUI for GRASS

From GRASS-Wiki
Revision as of 11:30, 16 February 2012 by ⚠️HamishBowman (talk | contribs) (→‎GUI for ps.map: cmd link)
Jump to navigation Jump to search

Browse also wxGUI related articles or screenshots.

See also GRASS GUI, and GRASS and Python.

For developer-related issues see Trac wxGUI page.

Overview

Requirements

Development

Do you want to help with the development?

  • basic Python programming ability required
  • GUI programming experience welcomed (especially wxPython)
  • GRASS user (or better developer) experience

How to get write access to the GRASS SVN repository.

See example of wxGUI module in trunk: doc/gui/wxpython/example/

Screenshots

GNU/Linux

Start-up screen
Vector digitizer
Attribute Table Manager
Querying vector map layers (attribute data)
wxGUI: Displaying raster (surface), 2D vector and 3D raster (volume) in the 3D space
wxGUI: Spatial query

Mac OS

MS Windows

Start-up screen
GUI dialog d.vect
Attribute Table Manager
Running command (r.buffer)
Querying vector map layer (editable mode)

 

Video tutorials

Import vector data

Importing single shapefile
Importing multiple shapefiles
Importing SpatiaLite layers
Importing PostGIS layers into GRASS

Import raster data

Importing multiple GeoTIFF files:

Bulk import of GeoTIFF via menu
Bulk import of GeoTIFF via menu (files are auto-selected)

Link vector data (GRASS 7)

Link PostGIS layers as GRASS vector maps

Map display

Define legend and export to image

Georectifier

Graphical modeler

Note: GRASS 6.4.2+ required.

See wxGUI Modeler page.

Layer Manager: Searching GRASS module

Search for GRASS module (GRASS 6.4.2 required)

Map Calculator

Calculating NDVI

wxGUI 3D view mode (wxNviz)

See wxNviz page.

Components

Core components

Layer Manager

Status: prototype implemented.

The GRASS GIS Layer Manager provides an interactive graphical interface to GRASS commands. The Layer Manager includes a set of pull-down menus for all GRASS GIS functions (analysis, file I/O, GIS configuration and management), toolbar that manage display map layers in map display windows, layer tree in which map layers to display are organized, command output window and integrated command line prompt.

Map display window

Status: prototype implemented.

Each Map display window has a unique set of layers to display and region setting (zoom). The map display window includes main toolbar with basic tools including zooming, panning, data querying, simple analyse functions (measure, profile, histogram, etc.), overlay management, etc. From main toolbar are accessible additional toolbars, currently only Digitization tool is available. Under development is Georectification tool.

GUI dialogs

Status: prototype implemented.

Generated from XML using --interface-description.

E.g. d.rgb --help

Description:
 Displays three user-specified raster map layers as red, green, and blue overlays in the active graphics frame.

Keywords:
 display

Usage:
 d.rgb [-ox] red=name green=name blue=name [--verbose] [--quiet]

Flags:
  -o   Overlay (non-null values only)
  -x   Don't add to list of commands in monitor
 --v   Verbose module output
 --q   Quiet module output

Parameters:
    red   Name of raster map to be used for <red>
  green   Name of raster map to be used for <green>
   blue   Name of raster map to be used for <blue>

becomes with d.rgb --interface-description

  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE task SYSTEM "[http://trac.osgeo.org/grass/browser/grass/trunk/gui/xml/grass-interface.dtd grass-interface.dtd]">
  <task name="d.rgb">
        <description>
                Displays three user-specified raster map layers as red, green, and blue overlays in the active graphics frame.
        </description>
        <keywords>
                display
        </keywords>
        <parameter name="red" type="string" required="yes" multiple="no">
                <description>
                        Name of raster map to be used for &lt;red&gt;
                </description>
                <keydesc>
                        <item order="1">name</item>
                </keydesc>
                <gisprompt age="old" element="cell" prompt="raster" />
        </parameter>
        <parameter name="green" type="string" required="yes" multiple="no">
                <description>
                        Name of raster map to be used for &lt;green&gt;
                </description>
                <keydesc>
                        <item order="1">name</item>
                </keydesc>
                <gisprompt age="old" element="cell" prompt="raster" />
        </parameter>
        <parameter name="blue" type="string" required="yes" multiple="no">
                <description>
                        Name of raster map to be used for &lt;blue&gt;
                </description>
                <keydesc>
                        <item order="1">name</item>
                </keydesc>
                <gisprompt age="old" element="cell" prompt="raster" />
        </parameter>
        <flag name="o">
                <description>
                        Overlay (non-null values only)
                </description>
        </flag>
        <flag name="x">
                <description>
                        Don't add to list of commands in monitor
                </description>
        </flag>
        <flag name="verbose">
                <description>
                        Verbose module output
                </description>
        </flag>
        <flag name="quiet">
                <description>
                        Quiet module output
                </description>
        </flag>
  </task>

which is then used to generate:

Startup GUI (welcome screen)

Status: prototype implemented.

Start new GRASS session with

grass -wxpython

Location wizard

Status: prototype implemented.

Wizard for creating new GRASS project location based on:

  • Coordinate system
  • EPSG code
  • Georeferenced file
  • PROJ.4 string
  • XY

See also GRASS Location Wizard.

Location wizard

Digitizer

Vector digitizer

Status: prototype implemented.

Manual page - wxGUI.Vector_Digitizer

See also GRASS Digitizing tool and wxGUI Vector Digitizer.

Replacement of v.digit module integrated into Map display window (Screenshots).

Raster digitizer

Status: development not started yet.

  • r.digit (merge with v.digit?)
Probably write a front end for r.in.poly, that's all the old r.digit is.
  • d.rast.edit
Idea: get cell center coords and new values from GUI interaction, then pass those through r.in.xyz, and r.patch the new values over the top of the old map.
  • merge with Georectifier? (i.points, i.vpoints)
Category Labels
  • Write with new r.category import tool
    • Back-end component complete: r.category module is now updated to handle a rules= file and other goodies like dynamic labels
  • Read with one of r.category, r.describe, r.report, r.stats, ???
    • probably need to add a new flag to one of those to print flat "%d %s", cat, label
or read the cats/ file directly, it's already flat ascii.
  • how to deal with FP maps & cats?

Cartography tools

GUI for ps.map

Status: under development (Anna Kratochvilova).

Cartographic Composer: draft mode
Cartographic Composer: preview
More info at WxGUI Cartographic Composer.

Direct printing

Status: development not started yet.

Implement direct printing of map canvas content using GRASS PS driver or Cairo driver.

Georectifier

Status: prototype implemented.

See also Georeferencing.

Tutorials

Profile Analysis Tool

Status: prototype implemented.

Attribute table manager

Status: prototype implemented.

Manual page.

Attributes queries in wxGUI
Attribute Table Manager
Allows
  • To browse attribute data, perform SQL select statements
  • Modify attribute data, insert new records to attribute table, delete existing records
  • Highlight selected items in Map Display Window
  • Extract selected items into new vector map layer
  • Modify attribute table - add, drop, rename columns
  • Modify vector map layer DB connestion settings - add, remove or modify layers

3D view mode

Status: under development (Google Summer of Code 2008/2010).

See detailed information at wxNVIZ page and original TCL/TK nviz manual page.

Displaying raster (surface), 2D vector and 3D raster (volume) in the 3D space.

Imagery tools

Status: (re)development not started in earnest yet. Some behind-the-scenes code has been prepared, but not much.

Volunteers welcome!

Ortho photos

Status: development not started yet.

wx.iclass

Status: Under development.

First prototype (AddOns)
wx.class
wx.class
wx.class

Current Features:

  • Does not require xterm
  • works on windows which is not currently available

To be implemented:

  • Proper view of histogram using python-matplotlib
  • To work on other datset (currently works for nc_spm_08)
  • Needs a code cleanup
Second prototype (trunk)

Graphical Modeller

Status: under development.

See wxGUI Modeler page for more information.

Extension Manager

Status: under development

wxGUI Extension Manager

Map Calculator

Status: prototype implemented

wxGUI Map Calculator

Data Catalog

Status: Under development.
Data Catalog
Data Catalog
Current Features
  • copy, delete, rename map layers (raster & vector) in current mapset.
  • view raster & vector map layers from any location and any mapset.
  • Provides a GUI wrapper for r.info & v.info grass commands while viewing map layers in mapwindow.
  • Can connect with OssimPlanet using PlanetSasha
  • Add and Remove maps from GRASS GIS to OssimPlanet(Send to OssimPlanet/Remove from OssimPlanet)
To be implemented
  • copy, move map layers in different mapsets.
  • View DBF files as tables.
  • Copy, delete, rename DBF files.
  • Modify attribute tables.
  • Create a properties window to display Coordinate system & projection for each map
  • ...

Alternative: http://code.google.com/p/wxgis/

r.li.setup GUI

Status: Under development.

Porting of r.li.setup in wxPython. Some screenshots of developing version

Help browser

Status: development not started yet.

For browsing manual pages is currently used web browser, the goal is to design integrated help system.

HB: We used to have one of these for viewing the help pages of Tcl/Tk NVIZ. We dropped it because it was a pain to maintain and generally outside our core mission so a distraction.

Known issues

Platform specific

For the GUI to know what platform it's on, and therefore apply platform specific commands (e.g. append '.exe' to programs) it has to test what platform it is running on. Here we take the experimental approach to learning what's best to use. Please add or generalize this list as you can.

Platform information - start Python from the command line then issue

 import sys
 sys.platform
 
 import os
 os.name
 os.environ['OS']
 
 import platform
 platform.system()
  • Results:
Platform sys.platform os.name os.environ['OS'] platform.system()
32bit GNU/Linux linux2 posix n/a Linux
64bit GNU/Linux linux2 posix n/a Linux
32bit Mac OSX (PowerPC G4) darwin posix n/a Darwin
64bit Mac OSX (Intel) [1] see note ? ? ?
32bit MS Windows XP win32 nt Windows_NT Windows
64bit MS Windows Vista win32 nt Windows_NT Windows
32bit MS Windows XP (Cygwin) win32 ? ? ?

[1] On Fri, May 29, 2009 at 10:49 PM, William Kyngesburye wrote:

Right now the GUI only runs 32bit, even if the rest of GRASS is 64bit, because it's not yet possible for wxPython to be 64bit. It comes out the same as PPC 32bit - no distinction between ppc/intel or 32/64 bit, it's all darwin. (yes, I checked, and I have a custom 64bit python executable to verify)

General GUI Design

Layout

For some users, the current approach of separate windows (SDI) leads to a windows flooding. Especially on large monitors or dual screen systems catching the wxGUI windows can be tedious when they appear on separate monitors (depends on windows manager, the much used KDE scatters typically the wxGUI windows all over the screen real estate). Almost each task generates a new wxGUI window which is freely floating around on the screen: example 1 and example 2. On a dual-screen this may sum up to 50cm of distance!

Proposed solutions:

  • implement optional layout similar to QGIS (with a legend attached to each display) or GSDView etc) (see figure below)
  • implement optional magnetic docking of the layer manager and display windows to keep the windows closer
  • do not allow module windows to stay open. That is, get rid of the apply button and force each window to close when OK is pressed (QGIS/ArcGIS approach). This leaves only the display(s) and single legend/layer manager on desktop.
  • If you otherwise wish to continue using your current WM, file a bug report with them asking for better multi-head support and get the problem fixed at the source. (there probably already is a bug filed with tips in it)
Current wxGUI layout with detached window components
Proposal for wxGUI layout modification (Recomposition of existing toolbars, mapview and menus)

New solution: see WxGUI#Data_Catalog above.


What others do

SDI: (each document opened in application occupies a window on the desktop)

  • GRASS: display window for each document (i.e., set of maps displayed) opened on desktop; one legend/layer manager window for all display windows; ; each module/function opens a separate window on the desktop
  • QGIS: display window for each document (i.e., set of maps displayed) opened on the desktop; legend/layer manager window attached to each display window; each module/function opens a separate window on the desktop (e.g. http://grass.osgeo.org/grass61/screenshots/images/qgis08_grass6_toolbox.png)
  • ArcGIS: similar to QGIS with combined legend/display for each document (set of maps displayed); each module/function opens a separate window on the desktop (e.g. http://upload.wikimedia.org/wikipedia/en/9/92/ArcMap.jpg)
  • MapInfo (pre Pitney Bowes): each document opens a map display window on the desktop; single legend/toolbox opened on the desktop controls all visible documents (i.e., map displays); each module/function opens a separate window on the desktop (similar to current GRASS layout)

MDI: (a single frame is opened for the application on the desktop; all documents opened inside the application frame)

See also

Useful links

References