Re: python parse_command

Anna Petrášová <[email protected]>
Newsgroups gmane.comp.gis.grass.user
Message-ID <CAE0EDEppeDMTujFaLs6GOHiacwcAJFZnjRKkJO5-BTHiDOZvRA@mail.gmail.com>
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" <[email protected]> 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
[email protected]
https://lists.osgeo.org/mailman/listinfo/grass-user

_______________________________________________
grass-user mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/grass-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.