For the second one, it gives an error message saying "No module named grass.lib"
Then using the second method, i tried to connect to GRASS with GDAL/OGR grass support. For this i needed to have gdal_grass plugin installed with GRASS. So i compiled GRASS and gdal_grass with OSGEO4W. The stable release of
GRASS 6 in OSGEO4W uses gdal 1.9 and the gdal_grass plugin for latest version is not available in OSGEO4W. The only available plugins are for gdal 1.5 and 1.6 versions under OBSOLETE category of OSGEO4W. I installed both of these and checked GDAL/OGR GRASS support is available within GRASS by typing at GRASS command shell the following:
But i cannot find gdal_grass support over there. Had it been there i could have read GRASS data as explained by the following code provided my Python has OGR python bindings:
from osgeo import ogr
ds = ogr.Open('D:/UEL/GrassGISDB/SLD99/LBS/vector/CluterCleaned/head')
layer = ds.GetLayer(0)
However when i execute above this is the error i get because of the non-availability of gdal_grass plug-in
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
layer = ds.GetLayer(0)
AttributeError: 'NoneType' object has no attribute 'GetLayer'
The PyGRASS module you have mentioned is a good candidate for working with/ accessing GRASS. However, to
me i need to access GRASS with external Python and not in the Python shell given in GRASS itself. Is it possible
to install PyGRASS module for Python 2.7 in windows like installing numpy or matplotlib modules separate? I hope
On Mon, Dec 31, 2012 at 7:14 PM, Brian Sanjeewa Rupasinghe <[hidden email]> wrote:
Actually my requirement is to run Python script outside GRASS Python shell. For this i tried connecting to GRASS outside with Python following the GRASS-wiki instructions, but failed. Then i tried to connect to GRASS with OGR Python bindings, it too failed because gdal_grass plugin provided in OSGEO4W does not install in GRASS (they are considered obsolete in OSGEO4W). However i installed gdal1.6_grass with stable release of GRASS 6.4.3 (run with gdal latest version 1.9.x) in OSGEO4W. However, when checked for the installed packages, gdal_grass support is not provided. It is highly appreciated if it is included in the current OSGEO4W setup or any suggestion.
When replying, please edit your Subject line so it is more specific
than "Re: Contents of grass-dev digest..."
1. Re: GRASS Vector Support (J?rgen E. Fischer)
2. Re: Grass7 GUI compilation failed (Rashad M)
---------- Forwarded message ---------- From: "Jürgen E." Fischer <[hidden email]> To: [hidden email]
Cc: Date: Sat, 29 Dec 2012 17:42:00 +0100 Subject: Re: [GRASS-dev] GRASS Vector Support Hi Brian,
On Sat, 29. Dec 2012 at 10:58:19 +0530, Brian Sanjeewa Rupasinghe wrote:
> I need to automate some GRASS functions in my research work. If there is a
> possibility to build gdal_grass plugin for Windows it is highly
> appreciated. Even the Python scripts that call GRASS functions from
> outside for MS_Windows do not connect with GRASS even though the
> instructions provided in the GRASS wiki is followed. I have posted this
> problem in grass-windows forum and finally advised me to bring the problem
> down to grass-dev list.
And you are positive that the GDAL plugin would help? The above description
sounds like a more general problem and I don't see any connection to the
missing plugin at all.
Does GRASS itself need the GDAL GRASS plugin at all?
Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31
Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50
Software Engineer D-26506 Norden http://www.norbit.de
committ(ed|ing) to Quantum GIS IRC: jef on FreeNode
norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502
---------- Forwarded message ---------- From: Rashad M <[hidden email]> To: [hidden email]
Cc: Date: Sat, 29 Dec 2012 23:55:17 +0530 Subject: Re: [GRASS-dev] Grass7 GUI compilation failed