[GRASS-user] Adding a point vector

Hi folks,

I have a question. I was examining some point vectors for archaeological sites that I am planning to do some research on and I noticed that a site was missing. I know it exists because I've been their. I got the information from shape files put out by Ireland's office of public works.

I have most of the important information on the site and I was wondering if there is an easy way to add it. I am using sqlite and have my grass data base set for sqlite. I considered simply adding the record to the appropriate table, but didn't want to make a mess of things by experimenting. I checked the third addition of Markus Neteler and Helena Mitasova's book, but didn't find what I was looking for.

Any ideas. Thanks for any information you can give.

Kurt

It won’t be enough to add the data to your sqlite table, That;s just the attributes, not the geography. The easiest way to add one point (assuming you know it’s coordinates) would be with v.edit:
v.edit arch_sites tool=add coord=,

Regards,
Micha

On Fri, 2011-09-23 at 13:22 -0400, Kurt Springs wrote:

Hi folks,

I have a question.  I was examining some point vectors for
 archaeological sites that I am planning to do some research on and I
 noticed that a site was missing.  I know it exists because I've been
 their.  I got the information from shape files put out by Ireland's
 office of public works.

I have most of the important information on the site and I was
 wondering if there is an easy way to add it.  I am using sqlite and
 have my grass data base set for sqlite.  I considered simply adding
 the record to the appropriate table, but didn't want to make a mess of
 things by experimenting.  I checked the third addition of Markus
 Neteler and Helena Mitasova's book, but didn't find what I was looking
 for.

Any ideas.  Thanks for any information you can give.

Kurt _______________________________________________ grass-user mailing
 [list](mailto:listgrass-user@lists.osgeo.org) [grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
 [http://lists.osgeo.org/mailman/listinfo/grass-user](http://lists.osgeo.org/mailman/listinfo/grass-user)

This mail was received via Mail-SeCure System.

Hi Micha,

Okay I’m trying that.

v.edit --verbose map=wedge_tomb@PERMANENT type=point tool=add coords=170402,374124

I would like to have said that I’ve tried it, but it’s still going. Any idea how long I should let it run before I decide there’s a problem?

Also, with attribute data, for that would I just fill in the blanks in sqlite?

Kurt

On Sep 23, 2011, at 1:48 PM, Micha Silver wrote:

It won’t be enough to add the data to your sqlite table, That;s just the attributes, not the geography. The easiest way to add one point (assuming you know it’s coordinates) would be with v.edit:
v.edit arch_sites tool=add coord=,

Regards,
Micha

On Fri, 2011-09-23 at 13:22 -0400, Kurt Springs wrote:

Hi folks,

I have a question.  I was examining some point vectors for
 archaeological sites that I am planning to do some research on and I
 noticed that a site was missing.  I know it exists because I've been
 their.  I got the information from shape files put out by Ireland's
 office of public works.

I have most of the important information on the site and I was
 wondering if there is an easy way to add it.  I am using sqlite and
 have my grass data base set for sqlite.  I considered simply adding
 the record to the appropriate table, but didn't want to make a mess of
 things by experimenting.  I checked the third addition of Markus
 Neteler and Helena Mitasova's book, but didn't find what I was looking
 for.

Any ideas.  Thanks for any information you can give.

Kurt _______________________________________________ grass-user mailing
 [list](mailto:listgrass-user@lists.osgeo.org) [grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
 [http://lists.osgeo.org/mailman/listinfo/grass-user](http://lists.osgeo.org/mailman/listinfo/grass-user)

This mail was received via Mail-SeCure System.

Hi,

2011/9/23 Kurt Springs <ferret_bard@mac.com>:

v.edit --verbose map=wedge_tomb@PERMANENT type=point tool=add
coords=170402,374124
I would like to have said that I've tried it, but it's still going. Any

it will not work, `tool=add` requires input in GRASS ASCII format [1].
In this case if you don't define option `input` it reads stdin. It can
be confusing for the user. The correct usage is

v.edit -n map=<map> tool=add << EOF

P 1 1
170402 374124
1 1
EOF

or

v.edit -n map=<map> tool=add input=<file>

In this case add new point with category 1 (layer 1) is added.

Martin

[1] http://grass.osgeo.org/grass70/manuals/html70_user/v.in.ascii.html
-> NOTES

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Hi,

2011/9/23 Martin Landa <landa.martin@gmail.com>:

In this case if you don't define option `input` it reads stdin. It can
be confusing for the user. The correct usage is

in r48434 <input> is required for `tool=add`, ie.

v.edit -n map=x tool=add
ERROR: Required parameter <input> not set

* read file

v.edit map=x tool=add input=<file>

* read stdin

v.edit map=x tool=add input=-

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Okay,

I'm using:
v.edit -n map=wedge_tomb@PERMANENT layer=1 type=point tool=add input=- coords=170402,374124

I used the command line in terminal. It immediately said "100%" but it has yet to return the command prompt, indicating it has more to do. How long should I wait? Did I miss something?

Kurt
On Sep 23, 2011, at 3:32 PM, Martin Landa wrote:

Hi,

2011/9/23 Martin Landa <landa.martin@gmail.com>:

In this case if you don't define option `input` it reads stdin. It can
be confusing for the user. The correct usage is

in r48434 <input> is required for `tool=add`, ie.

v.edit -n map=x tool=add
ERROR: Required parameter <input> not set

* read file

v.edit map=x tool=add input=<file>

* read stdin

v.edit map=x tool=add input=-

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Hi,

2011/9/23 Kurt Springs <ferret_bard@mac.com>:

v.edit -n map=wedge_tomb@PERMANENT layer=1 type=point tool=add input=- coords=170402,374124

* `coords`, `layer` and `type` do nothing in this case
* `input=-` means that it will read data from standard input, so the
command waits for that (it will wait for eternity if you do not
provide any input;-)

So store

"""
P 1 1
170402 374124
1 1
"""

into the file and run

v.edit -n map=wedge_tomb@PERMANENT tool=add input=<path/to/the/file>

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

2011/9/23 Martin Landa <landa.martin@gmail.com>:

see [1] -> Add new features to existing vector map

Martin

[1] http://grass.osgeo.org/grass70/manuals/html70_user/v.edit.html

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

A cruder way might be to make a new 1-point vector map and then overlay it.

Nick Cahill

Okay, I got the point to appear in the right spot. However it doesn't appear in the sqlite data base. I also wanted to add it's attributes. I take it that it isn't as easy as simply filling them in with Sqlite browser.

Kurt
On Sep 23, 2011, at 4:11 PM, Martin Landa wrote:

Hi,

2011/9/23 Kurt Springs <ferret_bard@mac.com>:

v.edit -n map=wedge_tomb@PERMANENT layer=1 type=point tool=add input=- coords=170402,374124

* `coords`, `layer` and `type` do nothing in this case
* `input=-` means that it will read data from standard input, so the
command waits for that (it will wait for eternity if you do not
provide any input;-)

So store

"""
P 1 1
170402 374124
1 1
"""

into the file and run

v.edit -n map=wedge_tomb@PERMANENT tool=add input=<path/to/the/file>

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Hi,

2011/9/24 Kurt Springs <ferret_bard@mac.com>:

Okay, I got the point to appear in the right spot. However it doesn't appear in the sqlite data base. I also wanted to add it's attributes. I take it that it isn't as easy as simply filling them in with Sqlite browser.

`v.edit` doesn't modify attribute table, you can add new record using
wxGUI Attribute Manager [1].

Martin

[1] http://grass.osgeo.org/grass70/manuals/html70_user/wxGUI.Attribute_Table_Manager.html

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Hi,

2011/9/24 Martin Landa <landa.martin@gmail.com>:

Okay, I got the point to appear in the right spot. However it doesn't appear in the sqlite data base. I also wanted to add it's attributes. I take it that it isn't as easy as simply filling them in with Sqlite browser.

`v.edit` doesn't modify attribute table, you can add new record using
wxGUI Attribute Manager [1].

I added FAQ article to the wiki, I hope it helps

http://grass.osgeo.org/wiki/Add_point_to_vector_map_at_given_position

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Hi!

What I am doing wrong, or is this the problem of v.vect.stats?

I have an area vector "area_vector" of three rectangular areas and a vector "point_vector" with numerous points inside these areas.
The output of the command

v.vect.stats -p points=point_vector areas=area_vector type=point player=1 alayer=1 method=average pcolumn=uav8 ccolumn=nuav scolumn=uav8mean --verbose

is empty. No error messages.

The areas in the area_vector have categories 1, 2, 3.
The column uav8 is present in the table point_vector and I can see the values of attributes making query in display window.
GRASS is using Postgres, driver pg. Attribute values are real.
v.rast.stats is working and updates attribute table.

Can the problem be that the point_vector has no column 'cat'? The key column for linking the vector layer to its attribute table has a different name.

I am using GRASS-7, r47868.

Andres Kuusk
Tartu Observatory, Estonia

On Tue, Oct 18, 2011 at 9:45 AM, Andres Kuusk <andres@aai.ee> wrote:

Hi!

What I am doing wrong, or is this the problem of v.vect.stats?

I have an area vector "area_vector" of three rectangular areas and a vector
"point_vector" with numerous points inside these areas.
The output of the command

v.vect.stats -p points=point_vector areas=area_vector type=point player=1
alayer=1 method=average pcolumn=uav8 ccolumn=nuav scolumn=uav8mean --verbose

is empty. No error messages.

The areas in the area_vector have categories 1, 2, 3.
The column uav8 is present in the table point_vector and I can see the
values of attributes making query in display window.
GRASS is using Postgres, driver pg. Attribute values are real.
v.rast.stats is working and updates attribute table.

Can the problem be that the point_vector has no column 'cat'? The key column
for linking the vector layer to its attribute table has a different name.

No, v.vect.stats uses the key column recorded in the db link info. If
there would be a problem with the points vector, v.vect.stats should
print something like

area_cat|count|average
1|0|null
2|0|null
3|0|null

I am using GRASS-7, r47868.

Maybe rebuilding topology helps? Also output of v.info on the area
vector and v.vect.stats after g.gisenv set="DEBUG=2".

Markus M

Hi,

.. v.vect.stats uses the key column recorded in the db link info. If
there would be a problem with the points vector, v.vect.stats should
print something like

area_cat|count|average
1|0|null
2|0|null
3|0|null

Maybe rebuilding topology helps?

I created a new vector of points (tmp4) using v.select, operator=within

Building areas...
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
Topology was built
Number of nodes: 577
Number of primitives: 577
Number of points: 577

All these points are inside the areas 1, 2, and 3 of the area vector "rami".

Also output of v.info on the area vector

Area vector is "rami":
   Type of map: vector (level: 2)
   Number of points: 0 Number of centroids: 3
   Number of lines: 0 Number of boundaries: 3
   Number of areas: 3 Number of islands: 3
   Map is 3D: No
   Number of dblinks: 1

and v.vect.stats after g.gisenv set="DEBUG=2".

(Tue Oct 18 12:36:48 2011)
g.gisenv set=DEBUG=2
(Tue Oct 18 12:36:48 2011) Command finished (0 sec)
(Tue Oct 18 12:36:58 2011)
v.vect.stats -p points=tmp4 areas=rami type=point method=average pcolumn=uav8 ccolumn=nuav scolumn=uav8min --verbose
(Tue Oct 18 12:36:58 2011) Command finished (0 sec)

I am using GRASS-7, r47868.

Andres

Andres Kuusk wrote:

[..]

and v.vect.stats after g.gisenv set="DEBUG=2".

(Tue Oct 18 12:36:48 2011)
g.gisenv set=DEBUG=2
(Tue Oct 18 12:36:48 2011) Command finished (0 sec)
(Tue Oct 18 12:36:58 2011)
v.vect.stats -p points=tmp4 areas=rami type=point method=average
pcolumn=uav8 ccolumn=nuav scolumn=uav8min --verbose
(Tue Oct 18 12:36:58 2011) Command finished (0 sec)

Weird. With DEBUG=2, all sorts of debug messages should be printed.
Looks like the module exits immediately and can not even open the
vectors. Can you run it again through CLI, not the GUI (also not the
GUI-CLI)?

BTW, works fine for me with the North Carolina dataset.

Markus M

I am using GRASS-7, r47868.

Andres

Hi,

I am sorry, the module v.vect.stats was missing in my set-up. I tried to start it through GUI-CLI, that was the output.
Now I upgraded GRASS-7 to r48840 or r48841 (I guess, sorry, I cannot check, the Internet connection of office is down), and v.vect.stats works fine. Thanks for your support.

However, the current version has again problems with using selection options for a vector - the display window is empty if I turn on a selection option. Vector(s) is(are) visible again if I turn the selection option off. I will give more details when I can access Internet in my office.

Andres

----------------
Tue, 18 Oct 2011, Markus Metz:

Weird. With DEBUG=2, all sorts of debug messages should be printed.
Looks like the module exits immediately and can not even open the
vectors. Can you run it again through CLI, not the GUI (also not the
GUI-CLI)?

Hi!

GRASS is r48844 on an openSUSE-11.4 and everything works fine.
Great work!

However, the current version has again problems with using selection options for a vector - the display window is empty if I turn on a selection option.

The layer number must be set.

Andres