Hi Uwe,
I can really only speak for GRASS7 (and I would almost say this is the way to go). You'll need to give us a working script plus your error messages/tracebacks. Have you tried running your script inside a grass session either from the commandline or inside the python shell that comes with the gui?
Best,
Michel

On 03/03/2016 03:57 PM, Uwe Fischer wrote:
Michel,

thank you very much for your answer. In my little script, there are more lines above that 
come from the wiki you referenced, too. I did not want to write them all down here in 
order to keep it short. Without the environment setup, I got messages like "no such 
module" when trying to call Grass. But that was the easier part (although hard 
enough for me, too :-) because I had messages.

Now the problem is that things start working (v.in) and then it crashes without 
any message. So I have not idea what could be wrong.

Do you really think that Grass 7 makes a diff? The menu command in 6.4.4 works 
fine. That's confusing to me.

Mit freundlichen Grüßen,

UWE FISCHER

-----Ursprüngliche Nachricht-----
Von: grass-user [mailto:grass-user-boun...@lists.osgeo.org] Im Auftrag von 
grass-user-requ...@lists.osgeo.org
Gesendet: Donnerstag, 3. März 2016 14:31
An: grass-user@lists.osgeo.org
Betreff: grass-user Digest, Vol 119, Issue 4

Send grass-user mailing list submissions to
        grass-user@lists.osgeo.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.osgeo.org/mailman/listinfo/grass-user
or, via email, send a message with subject or body 'help' to
        grass-user-requ...@lists.osgeo.org

You can reach the person managing the list at
        grass-user-ow...@lists.osgeo.org

When replying, please edit your Subject line so it is more specific than "Re: 
Contents of grass-user digest..."


Today's Topics:

    1. Change GRASS region multiple times (Luna, Daniel Eduardo)
    2. Re: stream network (Stefan Lüdtke)
    3. v.in.ogr in Python script not working (Uwe Fischer)
    4. Re: v.in.ogr in Python script not working (Michel Wortmann)


----------------------------------------------------------------------

Message: 1
Date: Wed, 2 Mar 2016 21:40:05 +0000
From: "Luna, Daniel Eduardo" <de...@pitt.edu>
To: "grass-user@lists.osgeo.org" <grass-user@lists.osgeo.org>
Cc: "Liang, Xu" <xuli...@pitt.edu>, "Hernandez Cruz, Felipe"
        <fe...@pitt.edu>
Subject: [GRASS-user] Change GRASS region multiple times
Message-ID:
        
<bn3pr0401mb16395b804c952062e8fa8974d7...@bn3pr0401mb1639.namprd04.prod.outlook.com>
        
Content-Type: text/plain; charset="iso-8859-1"

Hello!

I'm working with pygrass, developing a new module for GRASS.

I need to create a new raster map during the execution. I'm using the commands:

         from grass.pygrass import raster

         newRasterMap = raster.RasterSegment('new')
         newRasterMap.open('w', 'CELL')


I've noticed that new raster maps are created with the resolution of the 
current region in GRASS. I've noticed also that it is possible to change the 
current region during the execution of my new module using the script 
'g.region'. However, it looks like if I want to change the resolution again, 
the script 'g.region' does not have any effect. My conclusion: GRASS can change 
the current region just 1 time during the execution of a module. Is that 
correct?

I would like to know how can I develop a new module (using pygrass) where I 
could be able to create three new raster maps with different resolutions each?

Thank you all very much!
--
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.osgeo.org/pipermail/grass-user/attachments/20160302/84eb7d6e/attachment-0001.html>

------------------------------

Message: 2
Date: Thu, 3 Mar 2016 10:38:42 +0100
From: Stefan Lüdtke <slued...@gfz-potsdam.de>
To: Janet Choate <jsc....@gmail.com>, Will Fields
        <will.openfie...@gmail.com>
Cc: grass list <grass-user@lists.osgeo.org>
Subject: Re: [GRASS-user] stream network
Message-ID: <56d80622.1070...@gfz-potsdam.de>
Content-Type: text/plain; charset="utf-8"

Hi Janet,

can you provide a screenshot of the river network, I think that helps to 
understand what is going on in your specific case?!

Cheers,
Stefan

On 02/03/16 20:42, Janet Choate wrote:
Hi Will,
When running r.watershed on a small 35 hectare watershed, it produces
a fully connected stream network. However, when running r.watershed on
a
6400 hectare watershed, the stream network is not fully connected.
No preprocessing with regards to merging different raster maps,
however, I did try using r.fill.dir first to deal with any possible
depressions that might be causing non-connected stream segments.
thanks,
Janet

On Wed, Mar 2, 2016 at 11:22 AM, Will Fields
<will.openfie...@gmail.com <mailto:will.openfie...@gmail.com>> wrote:

     Hi Janet,

     Can you give some more information about what you mean by larger
     watershed basins?  Did you do any preprocessing of the elevation
     raster before you tried to extract the stream networks?  Were you
     using an elevation raster that had been merged from different
     rasters?  I've ran into issues in the past where "seams" along the
     original edges of a raster resulted in odd stream networks.

     Will

     On Wed, Mar 2, 2016 at 11:40 AM, Janet Choate <jsc....@gmail.com
     <mailto:jsc....@gmail.com>> wrote:

         Hi GRASS community,
         When creating a stream network with r.watershed, I end up with
         some isolated stream segments - particularly in larger watershed
         basins. Does anyone know how to generate a stream network that
         is fully connected, or how to correct this issue?
         thank you,
         Janet



         _______________________________________________
         grass-user mailing list
         grass-user@lists.osgeo.org <mailto:grass-user@lists.osgeo.org>
         http://lists.osgeo.org/mailman/listinfo/grass-user





--
Tague Team Lab Manager
1005 Bren Hall
UCSB, Santa Barbara, CA.


_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

--
Stefan Lüdtke

Section 5.4-  Hydrology
Tel.: +49 331 288 2821
Fax: +49 331 288 1570
Email: slued...@gfz-potsdam.de

Helmholtz-Zentrum Potsdam
Deutsches GeoForschungsZentrum GFZ
(GFZ German Research Centre for Geoscience) Stiftung des öff. Rechts Land 
Brandenburg Telegrafenberg, 14473 Potsdam
-------------------

PGP Public Key: http://bit.ly/13d9Sca

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: 
<http://lists.osgeo.org/pipermail/grass-user/attachments/20160303/a325b3ed/attachment-0001.sig>

------------------------------

Message: 3
Date: Thu, 3 Mar 2016 13:35:50 +0100
From: "Uwe Fischer" <gisfi...@t-online.de>
To: <grass-user@lists.osgeo.org>
Subject: [GRASS-user] v.in.ogr in Python script not working
Message-ID: <003f01d17549$38babe80$aa303b80$@t-online.de>
Content-Type: text/plain; charset="utf-8"

Hello,

I' new to this list and this is my first question. I try to develop a script 
that is able to import CAD files (MicroStation DGN) into a grass mapset.
First, I tried the command v.in.ogr in the menu system and everything works 
fine. The result is exactly as desired. Then, I tried to write a Python script 
that is able to do exactly the same but without starting GRASS.

The command line provided by the menu input (in QGIS' Grass toolbox) reads:

v.in.ogr dsn=D:/my.dgn output=gr03 type=boundary,centroid snap=0.01
min_area=1 "where="Level" = 1" -o

Searching the internet for sample scripts, I found some of those and modified 
my command string according to the samples:

import grass.script as grass

import grass.script.setup as gsetup

gsetup.init(gisbase,gisdbase,location,mapset)

input_dgn = "D:\\my.dgn"

grass.run_command("v.in.ogr",

                   dsn = input_dgn,

                   output = 'gr03',

                   type = 'boundary,centroid',

                   snap = 0.01,

                   min_area = 1,

                   where = """"Level" = 1""")

Unfortunately, this does not work. I get an error crash message telling me that 
v.in.ogr does not work any more. I tried many different options, including 
other use of quotes or leaving some args off. Nothing helped.
Maybe there is a keyword conflict or an issue with the order of the args?
The "where" part is very important since it helps me split the data like i need 
to. I use Grass 6.4.4

Thanks a lot for help an ideas,

Regards, Uwe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.osgeo.org/pipermail/grass-user/attachments/20160303/a38bba02/attachment-0001.html>

------------------------------

Message: 4
Date: Thu, 3 Mar 2016 14:24:27 +0100
From: Michel Wortmann <wortm...@pik-potsdam.de>
To: grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] v.in.ogr in Python script not working
Message-ID: <56d83b0b.4010...@pik-potsdam.de>
Content-Type: text/plain; charset="utf-8"; Format="flowed"

Hi Uwe,
I think you are missing a few environment setup steps if you want to start your 
python script without starting grass. Here is all you need, although this wiki 
refers to GRASS7. The grass.setup.init is not enough.
https://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly
But I highly recommend upgrading to GRASS7 anyways. Only the v.in.ogr argument 
dsn has been changed to input.
Hope it helps.
Best,
Michel
On 03/03/2016 01:35 PM, Uwe Fischer wrote:
Hello,

I‘ new to this list and this is my first question. I try to develop a
script that is able to import CAD files (MicroStation DGN) into a
grass mapset. First, I tried the command v.in.ogr in the menu system
and everything works fine. The result is exactly as desired. Then, I
tried to write a Python script that is able to do exactly the same but
without starting GRASS.

The command line provided by the menu input (in QGIS‘ Grass toolbox)
reads:

v.in.ogr dsn=D:/my.dgn output=gr03 type=boundary,centroid snap=0.01
min_area=1 "where="Level" = 1" –o

Searching the internet for sample scripts, I found some of those and
modified my command string according to the samples:

import grass.script as grass

import grass.script.setup as gsetup

gsetup.init(gisbase,gisdbase,location,mapset)

input_dgn = "D:\\my.dgn"

grass.run_command("v.in.ogr",

                   dsn = input_dgn,

                   output = 'gr03',

                   type = 'boundary,centroid',

                   snap = 0.01,

                   min_area = 1,

                   where = """"Level" = 1""")

Unfortunately, this does not work. I get an error crash message
telling me that v.in.ogr does not work any more. I tried many
different options, including other use of quotes or leaving some args
off. Nothing helped. Maybe there is a keyword conflict or an issue
with the order of the args? The „where“ part is very important since
it helps me split the data like i need to. I use Grass 6.4.4

Thanks a lot for help an ideas,

Regards, Uwe



_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.osgeo.org/pipermail/grass-user/attachments/20160303/30d26eac/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

------------------------------

End of grass-user Digest, Vol 119, Issue 4
******************************************


_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to