Hi,
I have been trying to use GRASS without opening it explicitly following the instructions from here: http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Python:_GRASS_GIS_6
Since I am on Windows, I had to adapt it a bit (and I tried many, many variations). The most likely
import os
import sys
location = “AZ”
mapset = “AZMAP”
gisbase = os.environ[‘GISBASE’] = “C:/Program Files/QGIS Valmiera/apps/grass/grass-6.4.3”
sys.path.append(os.path.join(os.environ[‘GISBASE’], “etc”, “python”))
gisdbase = os.path.join(os.getenv(‘APPDATA’, ‘GRASS6/grassrc6’))
import grass.script as grass
import grass.script.setup as gsetup
gsetup.init(gisbase, gisdbase, location, mapset)
What I get when I run these lines is the line below:
‘c:\users\pcamargo\appdata\local\temp\tmp7wvogg’
The content of this file is
GISDBASE: C:/Users/pcamargo/AppData/Roaming/GRASS6/grassrc6
LOCATION_NAME: AZ
MAPSET: AZMAP
While it should be getting the contents from the file at C:\Users\pcamargo\AppData\Roaming\GRASS6\grassrc6
What am I doing wrong?
Thanks,
Pedro
He Pedro
Please try to specific your GISDBASE location as the code showing below;
import os
import sys
gisbase = os.environ[‘GISBASE’] = “C:/Program Files/QGIS Valmiera/apps/grass/grass-6.4.3”
sys.path.append(os.path.join(os.environ[‘GISBASE’], “etc”, “python”))
gisdbase = os.path.join(os.getenv(‘APPDATA’, ‘GRASS6/grassrc6’))
location = “AZ”
gisdbase = “C:/Users/pcamargo/AppData/Roaming/GRASS6/grassrc6”
mapset = “AZMAP”
import grass.script as grass
import grass.script.setup as gsetup
gsetup.init(gisbase, gisdbase, location, mapset)
Best,
Sittichai
···
On Fri, Mar 6, 2015 at 11:16 PM, Pedro Camargo <veigacamargo@gmail.com> wrote:
Hi,
I have been trying to use GRASS without opening it explicitly following the instructions from here: http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Python:_GRASS_GIS_6
Since I am on Windows, I had to adapt it a bit (and I tried many, many variations). The most likely
import os
import sys
location = “AZ”
mapset = “AZMAP”
gisbase = os.environ[‘GISBASE’] = “C:/Program Files/QGIS Valmiera/apps/grass/grass-6.4.3”
sys.path.append(os.path.join(os.environ[‘GISBASE’], “etc”, “python”))
gisdbase = os.path.join(os.getenv(‘APPDATA’, ‘GRASS6/grassrc6’))
import grass.script as grass
import grass.script.setup as gsetup
gsetup.init(gisbase, gisdbase, location, mapset)
What I get when I run these lines is the line below:
‘c:\users\pcamargo\appdata\local\temp\tmp7wvogg’
The content of this file is
GISDBASE: C:/Users/pcamargo/AppData/Roaming/GRASS6/grassrc6
LOCATION_NAME: AZ
MAPSET: AZMAP
While it should be getting the contents from the file at C:\Users\pcamargo\AppData\Roaming\GRASS6\grassrc6
What am I doing wrong?
Thanks,
Pedro
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
–
Dr.Sittichai Choosumrong
Lecturer,
Geography and Geographic Information Science (GISci)
Department of Natural Resources and Environment,
Faculty of Agriculture, Natural Resources and Environment,
Naresuan University, Thailand 65000
Office: +66 55 962753
Mobile: +66 95-635-8102
email: sittichaic@nu.ac.th
■□■□■□■□■□■□■□■□■
Hi Sittichai,
The location of the database is J:\MY_PROJECT\GRASS
Is that what you wanted to know?
Thanks,
Pedro
···
On Fri, Mar 6, 2015 at 5:51 PM, sittichai choosumrong <sittichai.ocu@gmail.com> wrote:
He Pedro
Please try to specific your GISDBASE location as the code showing below;
import os
import sys
gisbase = os.environ[‘GISBASE’] = “C:/Program Files/QGIS Valmiera/apps/grass/grass-6.4.3”
sys.path.append(os.path.join(os.environ[‘GISBASE’], “etc”, “python”))
gisdbase = os.path.join(os.getenv(‘APPDATA’, ‘GRASS6/grassrc6’))
location = “AZ”
gisdbase = “C:/Users/pcamargo/AppData/Roaming/GRASS6/grassrc6”
mapset = “AZMAP”
import grass.script as grass
import grass.script.setup as gsetup
gsetup.init(gisbase, gisdbase, location, mapset)
Best,
Sittichai
On Fri, Mar 6, 2015 at 11:16 PM, Pedro Camargo <veigacamargo@gmail.com> wrote:
Hi,
I have been trying to use GRASS without opening it explicitly following the instructions from here: http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Python:_GRASS_GIS_6
Since I am on Windows, I had to adapt it a bit (and I tried many, many variations). The most likely
import os
import sys
location = “AZ”
mapset = “AZMAP”
gisbase = os.environ[‘GISBASE’] = “C:/Program Files/QGIS Valmiera/apps/grass/grass-6.4.3”
sys.path.append(os.path.join(os.environ[‘GISBASE’], “etc”, “python”))
gisdbase = os.path.join(os.getenv(‘APPDATA’, ‘GRASS6/grassrc6’))
import grass.script as grass
import grass.script.setup as gsetup
gsetup.init(gisbase, gisdbase, location, mapset)
What I get when I run these lines is the line below:
‘c:\users\pcamargo\appdata\local\temp\tmp7wvogg’
The content of this file is
GISDBASE: C:/Users/pcamargo/AppData/Roaming/GRASS6/grassrc6
LOCATION_NAME: AZ
MAPSET: AZMAP
While it should be getting the contents from the file at C:\Users\pcamargo\AppData\Roaming\GRASS6\grassrc6
What am I doing wrong?
Thanks,
Pedro
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
–
Dr.Sittichai Choosumrong
Lecturer,
Geography and Geographic Information Science (GISci)
Department of Natural Resources and Environment,
Faculty of Agriculture, Natural Resources and Environment,
Naresuan University, Thailand 65000
Office: +66 55 962753
Mobile: +66 95-635-8102
email: sittichaic@nu.ac.th
■□■□■□■□■□■□■□■□■
So you need to set the GISDBASE variable to the above. NOT as you set in your first mail:
···
On 03/07/2015 08:31 AM, Pedro Camargo wrote:
Hi Sittichai,
The location of the database is J:\MY_PROJECT\GRASS
Is that what you wanted to know?
gisdbase = os.path.join(os.getenv(‘APPDATA’, ‘GRASS6/grassrc6’))
Hi Sittichai and Micha,
I just came back from a conference, thus back to this issue.
I tried many configurations for the code, including the following
gisdbase = os.path.join(os.getenv(‘APPDATA’, ‘grassdata’))
and
gisdbase = os.path.join(‘J:/MY_PROJECT/GRASS/’)
and
gisdbase=‘J:\MY_PROJECT\GRASS’
and
gisdbase = os.path.join(os.getenv(‘APPDATA’)+ “/GRASS6/grassrc6”)
For all these, the output was the same, and created a file in the temp folder as below.
c:\users\pedro\appdata\local\temp\tmprdjnow
-1073741515
Any other suggestions?
Thanks a lot,
Pedro
···
On Sat, Mar 7, 2015 at 4:29 AM, Study <sittichai.ocu@gmail.com> wrote:
Hi Predo
On BE2558/03/07, at 15:39, Micha Silver <micha@arava.co.il> wrote:
On 03/07/2015 08:31 AM, Pedro Camargo wrote:
Hi Sittichai,
The location of the database is J:\MY_PROJECT\GRASS
Is that what you wanted to know?
So you need to set the GISDBASE variable to the above. NOT as you set in your first mail:
Yes, as Micha said please set the GISDBASE to “J:\MY_PROJECT\GRASS”
Best,
–
■□■□■□■□■□■□■□■□■
Dr. Sittichai Choosumrong (Ph.D)
Lecturer at Faculty of Agriculture, Natural Resources and Environment,
Department of Natural Resources and Environment,
Geography
99 Moo 9 Tambon Tha Pho,
Amphoe Muang
Phitsanulok Thailand 65000
Office: +66 55 962753
Mobile: +66 95-635-8102
email: sittichaic@nu.ac.th
■□■□■□■□■□■□■□■□■
I’m not an expert in python, but I think you need something like: gisdbase = os.path.join(“J:/”,“MY_PROJECT”,“GRASS”) Then, of course, run the grass.init function
···
On 03/15/2015 07:26 AM, Pedro Camargo wrote:
Hi Sittichai and Micha,
I just came back from a conference, thus back to this issue.
I tried many configurations for the code, including the following
gisdbase = os.path.join(os.getenv(‘APPDATA’, ‘grassdata’))
and
gisdbase = os.path.join(‘J:/MY_PROJECT/GRASS/’)
and
gisdbase=‘J:\MY_PROJECT\GRASS’
and
gisdbase = os.path.join(os.getenv(‘APPDATA’)+ “/GRASS6/grassrc6”)
For all these, the output was the same, and created a file in the temp folder as below.
c:\users\pedro\appdata\local\temp\tmprdjnow
-1073741515
Any other suggestions?
Thanks a lot,
Pedro
On Sat, Mar 7, 2015 at 4:29 AM, Study <sittichai.ocu@gmail.com> wrote:
Hi Predo
On BE2558/03/07, at 15:39, Micha Silver <micha@arava.co.il> wrote:
On 03/07/2015 08:31 AM, Pedro Camargo wrote:
Hi Sittichai,
The location of the database is J:\MY_PROJECT\GRASS
Is that what you wanted to know?
So you need to set the GISDBASE variable to the above. NOT as you set in your first mail:
Yes, as Micha said please set the GISDBASE to “J:\MY_PROJECT\GRASS”
Best,
–
■□■□■□■□■□■□■□■□■
Dr. Sittichai Choosumrong (Ph.D)
Lecturer at Faculty of Agriculture, Natural Resources and Environment,
Department of Natural Resources and Environment,
Geography
99 Moo 9 Tambon Tha Pho,
Amphoe Muang
Phitsanulok Thailand 65000
Office: +66 55 962753
Mobile: +66 95-635-8102
email: sittichaic@nu.ac.th
■□■□■□■□■□■□■□■□■
This mail was received via Mail-SeCure System.