[GRASS-user] Nothing Inserted into Attribute Table from v.to.db

I have vector maps called "incidents" (points) and "roads" (lines). For some
reason, I am getting nothing as output in the final attribute table; that
is, the attribute table is not being updated at all. I am sure I am making
some silly mistake.

v.distance from=incidents to=roads output=connecting_lines upload=cat
column=nearest
#I copied table "incidents" to "connecting_lines" and called it
"connecting_lines". I used the option
#key=nearest. I added two columns called end_x and end_y, both double
precision.
v.net input=connecting_lines output=nodes operation=nodes alayer=1 nlayer=2
#I also tried swapping alayer and nlayer with no luck.
v.to.db map=nodes type=point,line,boundary,centroid layer=1 qlayer=1
option=end column=end_x,end_y

The output I get from v.to.db is:

1 categories read from map
30831 records selected from table
0 categories read from map exist in selection from table
0 categories read from map don't exist in selection from table
0 records updated/inserted
0 update/insert errors

What could I be doing wrong?
--
View this message in context: http://www.nabble.com/Nothing-Inserted-into-Attribute-Table-from-v.to.db-tp19793008p19793008.html
Sent from the Grass - Users mailing list archive at Nabble.com.

On 03/10/08 08:57, Ryan R. Rosario wrote:

I have vector maps called "incidents" (points) and "roads" (lines). For some
reason, I am getting nothing as output in the final attribute table;

First of all: could you state clearly and precisely what you want to do ?

that
is, the attribute table is not being updated at all. I am sure I am making
some silly mistake.

[...]

What could I be doing wrong?

This:
> v.distance from=incidents to=roads output=connecting_lines upload=cat
> column=nearest
> #I copied table "incidents" to "connecting_lines" and called it
> "connecting_lines". I used the option
> #key=nearest.

(Second: please be more explicit in the description of your actions. In this case, for example, please tell us which command you used. I assume v.db.connect...)

The output map of the v.distance command contains only lines for visualisation which do not even contain a category value allowing to identify each line. You cannot, therefore, link the map to a table. Well, you can, but no records in the table will correspond to a line as the latter do not have a ids.

Debatedly, v.distance could be enhanced to include some information in an attribute table accompanying the map, such as from_cat and to_cat, but someone would have to implement that.

Moritz

v.distance gives me a set of lines from my points vector to my lines vector.
I am trying to extract the point where each connecting line intersects a
line in the lines vector.

I used the GUI for the database copying and connection. I have added the
commands below:

v.distance from=incidents to=roads output=connecting_lines upload=cat
column=nearest
db.copy from_driver=dbf from_database=$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
from_table=incidents to_driver=dbf
to_database=$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ to_table=connecting_lines
v.db.connect map=connecting_lines driver=dbf
database=$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ table=connecting_lines
key=nearest layer=1
v.db.addcol map=connecting_lines layer=1 'columns=end_x double, end_y
double'
v.net input=connecting_lines output=nodes operation=nodes alayer=1 nlayer=2
#I also tried swapping alayer and nlayer with no luck.
v.to.db map=nodes type=point,line,boundary,centroid layer=1 qlayer=1
option=end column=end_x,end_y

#I may have forgotten to include a database command for the nodes vector
somewhere, but I have confirmed that the attribute tables for
connecting_lines and nodes are identical.

Sorry for the vagueness, but I am thoroughly confused on what goes on with
these attribute tables at times.

Moritz Lennert-2 wrote:

On 03/10/08 08:57, Ryan R. Rosario wrote:

I have vector maps called "incidents" (points) and "roads" (lines). For
some
reason, I am getting nothing as output in the final attribute table;

First of all: could you state clearly and precisely what you want to do ?

that
is, the attribute table is not being updated at all. I am sure I am
making
some silly mistake.

[...]

What could I be doing wrong?

This:
> v.distance from=incidents to=roads output=connecting_lines upload=cat
> column=nearest
> #I copied table "incidents" to "connecting_lines" and called it
> "connecting_lines". I used the option
> #key=nearest.

(Second: please be more explicit in the description of your actions. In
this case, for example, please tell us which command you used. I assume
v.db.connect...)

The output map of the v.distance command contains only lines for
visualisation which do not even contain a category value allowing to
identify each line. You cannot, therefore, link the map to a table.
Well, you can, but no records in the table will correspond to a line as
the latter do not have a ids.

Debatedly, v.distance could be enhanced to include some information in
an attribute table accompanying the map, such as from_cat and to_cat,
but someone would have to implement that.

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

--
View this message in context: http://www.nabble.com/Nothing-Inserted-into-Attribute-Table-from-v.to.db-tp19793008p19801906.html
Sent from the Grass - Users mailing list archive at Nabble.com.

On 03/10/08 19:03, Ryan R. Rosario wrote:

[...]

Sorry for the vagueness, but I am thoroughly confused on what goes on with
these attribute tables at times.

See my response below: the lines in connected_lines to not contain ids and so you cannot connect them to any database table.

I guess, you are trying to apply solution 2b proposed in [1] ? But you are also trying to get the attributes of the incidents points linked to the projected points.

As you can read in that mail: "(you might have to use v.db.addtable on that to create a table first, can't remember)". As I mention below, you have to do that since v.distance does not create a table.

So, here are the steps I propose (untested):

1) v.distance [...] output=connecting_lines

2) v.db.addtable [...] columns="cat int, inc_cat int"

3) v.distance from=connecting_lines to=incidents upload=cat column=inc_cat dmax=0 (I suppose that the connecting lines touch the incident points. If they don't you might have to slightly increase dist)

4) db.copy from="incidents table" to="projected_incidents" (optional, you can also link directly to the incidents table)

4) v.db.connect -o connecting_lines key=inc_cat [...]

Moritz

[1] http://lists.osgeo.org/pipermail/grass-user/2008-October/046905.html

Moritz Lennert-2 wrote:

On 03/10/08 08:57, Ryan R. Rosario wrote:

I have vector maps called "incidents" (points) and "roads" (lines). For
some
reason, I am getting nothing as output in the final attribute table;

First of all: could you state clearly and precisely what you want to do ?

that
is, the attribute table is not being updated at all. I am sure I am
making
some silly mistake.

[...]

What could I be doing wrong?

This:
> v.distance from=incidents to=roads output=connecting_lines upload=cat
> column=nearest
> #I copied table "incidents" to "connecting_lines" and called it
> "connecting_lines". I used the option
> #key=nearest.

(Second: please be more explicit in the description of your actions. In this case, for example, please tell us which command you used. I assume v.db.connect...)

The output map of the v.distance command contains only lines for visualisation which do not even contain a category value allowing to identify each line. You cannot, therefore, link the map to a table. Well, you can, but no records in the table will correspond to a line as the latter do not have a ids.

Debatedly, v.distance could be enhanced to include some information in an attribute table accompanying the map, such as from_cat and to_cat, but someone would have to implement that.

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