[GRASS-user] python parse_command

Anna Petrášová kratochanna at gmail.com
Mon Feb 12 06:51:41 PST 2018


Isn't the problem that you have there r.in_xyz instead of r.in.xyz?

Anna

On Feb 12, 2018 9:35 AM, "Pietro" <peter.zamb at gmail.com> wrote:

Dear Jonathan,

the error is due to grass_session that is not creating the location if
missing.
I don't have time in this day to fix this issue in grass_session, so the
fastest fsolution at the momenth is to check and create what is needed step
by step.

I did not have xyz file to test so I've only execute g.gisenv and it works,
let me know if it works also with r.inxyz:

```python
from __future__ import print_function
import os

from grass_session import Session
from grass.script import core as gcore

GISDBASE = "/tmp/grassdata"
LOCATION = "nrw"
EPSG = "EPSG:4326"


if not os.path.exists(GISDBASE):
    os.makedirs(GISDBASE)

if not os.path.exists(os.path.join(GISDBASE, LOCATION)):
    with Session(gisdb=GISDBASE, location=LOCATION,
                 create_opts=EPSG):
        print("Created a new location!")
else:
    print("Location already exist!")


with Session(gisdb=GISDBASE, location=LOCATION, mapset="elevation",
             create_opts=""):
    gcore.run_command("g.gisenv")
```

Best regards

Pietro

_______________________________________________
grass-user mailing list
grass-user at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180212/218f83de/attachment.html>


More information about the grass-user mailing list