~ubuntu-branches/ubuntu/karmic/grass/karmic

« back to all changes in this revision

Viewing changes to swig/python/README

  • Committer: Bazaar Package Importer
  • Author(s): Francesco Paolo Lovergine
  • Date: 2009-07-13 13:34:03 UTC
  • mfrom: (3.1.15 karmic)
  • Revision ID: james.westby@ubuntu.com-20090713133403-0x81m7hb1q06zu13
Tags: 6.4.0~rc5-2
* Added a grass menu item (Hamish).
* Added a grass.menu.in template with related icon.
* Added a simple x-grass wrapper to allow running grass without a pre-running
  controlling terminal. At least it works within ordinary WMs launchers.
  (closes: #503371)
* Added newlocation.dpatch patch to manage correctly new locations.
  (closes: #533738)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
What is this?
2
2
-------------
3
3
         This is SWIG based python wrapping for GRASS API
4
 
which allows to call GRASS functions from python programs.
5
 
Currently only a limited set of functions (those needed for
6
 
me) are wrapped.
 
4
which allows to call GRASS library functions from Python programs.
7
5
 
8
6
 
9
7
How to INSTALL?
11
9
1. Install SWIG, the Simplified Wrapper and Interface Generator
12
10
     http://www.swig.org
13
11
 
14
 
2. Be sure you configured GRASS with support for Python:
 
12
2. Be sure you configured GRASS with support for Python (example):
15
13
     ./configure --with-python=/usr/bin/python2.5-config
16
14
 
17
15
3. Run make in the swig/python/ directory
18
16
 
19
 
It will create two files, python_grass6.py and _python_grass6.so.
 
17
   It will create a series of .py Python files and of .so library files
20
18
 
21
 
4. From within GRASS (or a fake grass session) run "python test.py" to
 
19
4. TODO: STILL VALID??:
 
20
   From within GRASS (or a fake grass session) run "python test.py" to
22
21
   test and to automatically create a byte-compiled version of the module
23
22
   (python_grass6.pyc). The .pyc file is platform independent and may be
24
23
   safely shared among systems. Even so, it doesn't hurt to rebuild it
31
30
How to use it?
32
31
--------------
33
32
 
34
 
import python_grass6
 
33
import grass
35
34
GRASS functions will be available in this module.
36
35
Eg: 
37
 
        import python_grass6
38
 
        mapset=python_grass6.G_mapset()
 
36
        import grass
 
37
        mapset=grass.G_mapset()
39
38
        print mapset
40
39
 
41
 
See examples/m.distance for an example of a working SWIG-Python module.
 
40
See examples/m.distance.py for an example of a working SWIG-Python module.
42
41
 
43
42
More examples can be found on the GRASS Wiki site's Python page:
44
 
  http://grass.gdf-hannover.de/wiki/GRASS_and_Python#Python-SWIG-GRASS_interface
 
43
  http://grass.osgeo.org/wiki/GRASS_and_Python#Python-SWIG-GRASS_interface
45
44
 
46
45
 
47
46
DEBUGGING
58
57
See TODO in this directory.
59
58
 
60
59
 
61
 
AUTHOR
 
60
AUTHORS
62
61
-----
63
62
 
64
 
Sajith VK  sajithvk at gmail.com
65
 
Thu, 9 Mar 2006 16:02:50 +0530
66
 
http://grass.itc.it/pipermail/grass-dev/2006-March/021651.html
67
 
http://freegis.gnu.org.in/temporary/python_grass6.tar.bz2
 
63
Initial version:
 
64
  Sajith VK  sajithvk at gmail.com
 
65
  Thu, 9 Mar 2006 16:02:50 +0530
 
66
  http://lists.osgeo.org/pipermail/grass-dev/2006-March/021800.html
 
67
  http://freegis.gnu.org.in/temporary/python_grass6.tar.bz2
 
68
 
 
69
Further work:
 
70
  Markus Landa
 
71
  Glynn Clements
 
72
  ...
 
73