Hi:
I do think it could be interesting, in fact I am using a couple of
modules that performs Horton and Strahler ordering with my students. I
just regret not be able to be more participative in this list.
I attach you the code in case it could be helpful.
The code it's a bit of a mess (not to mention that the comments are in
Spanish ;-)
It assumes that the tables linked to the vector data are in postgresql.
There are two modules:
v.ordena_red (network ordering), performs Strahler or Shreve ordering
(crit parameter). "desembocadura" means outlet (you have to pass the
cat value of the oulet reach).
v.str2hor converts an ordering from Horton to Strahler.
They work fine as long as your network nodes have only 3 links.
In case have any problem, you should delete all the created files and
tables to rerun them.
Good luck.
Paco
Jarek Jasiewicz escribió:
Hi list!
I've just thinked how to create horton stream order based on my
module strahler module and accumulation file. Hortons stream order
differs sligty form strahler order, see for example here fig. 1 page
78 http://iahs.info/hsj/134/134008.pdf
Because I have some tests results from some of you (many thanks for
your courage) i'm about to finish module, modify code to meet grass
requiments and officialy anouce it on grass-dev, but If I will add
horton stream order it will may take a bit more time.
So I have 2 question about that (horton):
Did you think taht horton stream order has already sense (it is
almost not in use)
Does any body know any program (commercial or not) which calculate
horton's stream order
Thanks for ansvers
Jarek
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
#include "grass/gis.h"
#include "grass/Vect.h"
#include "grass/display.h"
#include "grass/raster.h"
#include "grass/colors.h"
#include
#include
#include "libreria.h"
#include "math.h"
int crea_db(char* nombre_tabla,int *ordenacion,struct Map_info *map);
int main (int argc,char *argv[]){
struct GModule *module; //Definición del módulo
struct Map_info map,map2; //Mapas
struct Option *input, *output,*crit,*des; //Opciones de usuario
struct line_pnts *linea,*linea1,*linea2; //Secuencias de puntos
struct line_cats *cats;
int lev,n1,n2,criterio,desemb,busc;
int i,ii,l,k,l1,l2,l3,l4,ll,n_lines,n_nodes,fin,p,prev;
char *mapset, err_msg[200],buf[1024],*name,*name2;
double *recta,*sinuosidad,*longit,long2,recta2,sinu2;
int *orden,*sigue1,*sigue2,*tocado,*coming,*desem,*att,*n_lineas,*fuente1,*fuente2,*fuente3;
double x,y;
char *colorin;
//Variables de la base de datos
char *db_nombre, *driver_nombre, *ordenc;
dbDriver *driver;
dbHandle handle;
dbTable *tabla;
dbColumn *columna;
dbString orden_sql;
ordenc=(char *) malloc(200);
colorin=(char *) malloc(11);
G_gisinit (argv[0]);
// Gestión de la linea de comandos
module = G_define_module();
module->description ="Ordena una red de drenaje generada artificialmente";
input = G_define_option();
input->key = "input";
input->type = TYPE_STRING;
input->required = YES;
input->description = "Nombre del mapa vectorial que vas a abrir";
input->gisprompt = "viejo,vectorial,mapa vectorial";
output = G_define_option();
output->key = "output";
output->type = TYPE_STRING;
output->required = YES;
output->description = "Nombre del mapa vectorial que vas a crear";
output->gisprompt = "nuevo,vectorial,mapa vectorial";
crit = G_define_option();
crit->key = "crit";
crit->type = TYPE_INTEGER;
crit->required = YES;
crit->description = "Criterio de ordenación (1:Strahler 2:Shreve 3:Crea tabla)";
crit->gisprompt = "";
des = G_define_option();
des->key = "desembocadura";
des->type = TYPE_INTEGER;
des->required = YES;
des->description = "cat del tramo de desembocadura de la red";
des->gisprompt = "";
if (G_parser(argc,argv)) exit(1);
criterio=atoi(crit->answer);
desemb=atoi(des->answer);
//Inicialización de comandos gráficos
if (R_open_driver()!=0) G_fatal_error("No hay monitor\n");
D_setup(0);//R_standard_color(0);
G_setup_plot(D_get_d_north(),D_get_d_south(),D_get_d_west(),D_get_d_east(),D_move_abs,D_cont_abs);
//COMENZAR LA CREACION DE LA BASE DE DATOS
//Establecer parámetros de la conexión
driver_nombre=db_get_default_driver_name();
db_nombre=db_get_default_database_name();
//Abrimos
driver=db_start_driver(driver_nombre);
db_init_handle(&handle);
db_set_handle(&handle,db_nombre,NULL);
if(db_open_database(driver,&handle)!=DB_OK){exit(ERROR);}
//Generar y comprobar la orden SQL de creación de tabla
db_init_string(&orden_sql);
db_zero_string (&orden_sql);
sprintf(ordenc,"create table %s ( cat integer, ",output->answer);
db_append_string(&orden_sql,ordenc);
db_append_string(&orden_sql,"orden integer, longitud double precisio