[GRASS-user] r.stream.order export to shapefile

Markus Metz markus.metz.giswork at gmail.com
Tue Aug 28 13:15:51 PDT 2012


On Tue, Aug 28, 2012 at 9:05 PM, Micha Silver <micha at arava.co.il> wrote:
> A few more details regarding v.out.ogr when layer=2
> I see this ticket, possibly similar: http://trac.osgeo.org/grass/ticket/991
>
> I tried to export to PostGIS, and again, all attribute fields are created
> but all values are NULL. I also tried with the layer 2 database as a dbf
> file, instead of sqlite. Same result.
>
> This was all with GRASS 6.4.2 on scientific linux 6

What does v.category op=report say? Are there any categories in layer
2? If not, there is nothing to export.

Markus M

>
> Thanks,
> Micha
>
>
> On 08/28/2012 02:57 PM, Micha Silver wrote:
>
> I'm having two problems when exporting the output of r.stream.order to a
> shapefile.
> I have attached the created table (saved in my setup in sqlite) to the
> 'streams' map thru layer 2. Then
> v.db.select streams layer=2
> shows all the details of strahler order, prev_str, etc.
>
>
> First problem: When I try to do v.out.ogr, the column header named
> "next_stream" fails because it's 10 characters long, too long for a
> shapefile dbf. As a result all attributes are missing.  Here's a patch to
> io.c in r.stream.order I put in place to correct this:
>
>  [micha at SL6 r.stream.order]$ diff -u io.c.orig io.c
> --- io.c.orig    2012-08-28 12:21:46.020275045 +0300
> +++ io.c    2012-08-28 12:22:17.951382882 +0300
> @@ -292,7 +292,7 @@
>      /* table definition */
>      char *tab_cat_col_name = "cat integer";
>      char *tab_stream = "stream integer";
> -    char *tab_next_stream = "next_stream integer";
> +    char *tab_next_stream = "next_str integer";
>      char *tab_prev_streams;
>      char *tab_strahler = "strahler integer";
>      char *tab_horton = "horton integer";
> @@ -300,7 +300,7 @@
>      char *tab_hack = "hack integer";
>      char *tab_length = "length double precision";
>      char *tab_cumlength = "cum_length double precision";
> -    char *tab_stright = "stright double precision";
> +    char *tab_stright = "straight double precision";
>      char *tab_fractal = "fractal double precision";
>      char *tab_distance = "out_dist double precision";
>      char *tab_topo_dim = "topo_dim integer";
>
> (Also corrects a small typo in the column name "stright")
>
> After recompiling, then rerunning the r.stream.order addon, the sqlite table
> now has all column headers <= 10 characters suitable to shapefile.
>
>
> Problem 2, where I'm stuck. I export the vector map using :
> v.out.ogr streams layer=2 dsn=streams.shp
> The process finishes OK, and the shape is created with all attrib columns,
> but *all* values are NULL (including the cat). Any ideas what I've done
> wrong?
>
> Thanks,
> Micha
>
>
> This mail was received via Mail-SeCure System.
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
> This mail was received via Mail-SeCure System.
>
>
>
>
> --
> Micha Silver
> GIS Consultant, Arava Development Co.
> http://www.surfaces.co.il
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>


More information about the grass-user mailing list