[GRASS-user] v.select output vector is empty

Greetings!

I am attempting to execute a "point-in-polygon" process on 2 vectors using
v.select and the output vector is empty, it contains no value/s.

When I create a map display of the 2 vectors I can clearly see the point
intersecting a polygon on the area layer, so it isn't an issue of no-intersecting
values between the two datasets.

The point vector was created using:
cat /home/kfw4/dev/grass_db/one_point.txt | v.in.ascii out=single_point fs=',' x=3 y=2 col='batch_id varchar(32),decimal_la double precision,decimal_lo double precision' --o

v.info and db.select show the correct imported value:

GRASS 6.4.svn (lat_lon):~ > v.info single_point
  +----------------------------------------------------------------------------+
  | Layer: single_point
  | Mapset: PERMANENT
  | Location: lat_lon
  | Database: /home/kfw4/dev/grass_db
  | Title:
  | Map scale: 1:1
  | Map format: native
  | Name of creator: kfw4
  | Organization:
  |----------------------------------------------------------------------------
  | Type of Map: vector (level: 2)
  |
  | Number of points: 1 Number of areas: 0
  | Number of lines: 0 Number of islands: 0
  | Number of boundaries: 0 Number of faces: 0
  | Number of centroids: 0 Number of kernels: 0
  |
  | Map is 3D: No
  | Number of dblinks: 1
  |
  | Projection: Latitude-Longitude
  | N: 34:06:59.1408N S: 34:06:59.1408N
  | E: 116:04:04.116W W: 116:04:04.116W
  |
  | Digitization threshold: 0
  | Comments:
  |
  +----------------------------------------------------------------------------+

GRASS 6.4.svn (lat_lon):~ > db.select single_point
cat|batch_id|decimal_la|decimal_lo
1|BAT000000074|34.116428|-116.06781

The area vector was re-projected using v.proj:

  v.proj PREC0101 location=PREC0101 mapset=PERMANENT

GRASS 6.4.svn (lat_lon):~ > v.info PREC0101
  +----------------------------------------------------------------------------+
  | Layer: PREC0101
  | Mapset: PERMANENT
  | Location: lat_lon
  | Database: /home/kfw4/dev/grass_db
  | Title:
  | Map scale: 1:1
  | Map format: native
  | Name of creator: kfw4
  | Organization:
  | Source date: Wed Oct 29 09:15:47 2008
  |----------------------------------------------------------------------------
  | Type of Map: vector (level: 2)
  |
  | Number of points: 0 Number of areas: 6720
  | Number of lines: 0 Number of islands: 1212
  | Number of boundaries: 13970 Number of faces: 0
  | Number of centroids: 0 Number of kernels: 0
  |
  | Map is 3D: No
  | Number of dblinks: 1
  |
  | Projection: Latitude-Longitude
  | N: 49:25:31.535591N S: 24:27:48.66742N
  | E: 66:54:50.339466W W: 124:46:59.356755W
  |
  | Digitization threshold: 0
  | Comments:
  |
  +----------------------------------------------------------------------------+

Clearly, the single_point projection is contained by the PREC0101 projection. (Clearly?)

Yet, v.select yields nothing.

GRASS 6.4.svn (lat_lon):~ > v.select ainput=single_point binput=PREC0101 output=single_select op=overlap --overwrite --v
WARNING: Vector map <single_select> already exists and will be overwritten
Processing ainput lines ...
  100%
Processing ainput areas ...
Writing attributes ...
Layer 1
v.select complete.
Building topology for vector map <single_select>...
0 primitives registered
0 vertices registered
0 areas built
0 isles built
Attaching islands:
Attaching centroids: Topology was built
Number of nodes : 0
Number of primitives: 0
Number of points : 0
Number of lines : 0
Number of boundaries: 0
Number of centroids : 0
Number of areas : 0
Number of isles : 0
GRASS 6.4.svn (lat_lon):~ > v.db.select -c single_select
GRASS 6.4.svn (lat_lon):~ >

Any suggestions?

Thank you.

KFW

Kevin Webb wrote:

I am attempting to execute a "point-in-polygon" process on 2 vectors using
v.select and the output vector is empty, it contains no value/s.

most likely one of both of the inputs is missing category numbers.

if areas do not have centroids you should add them with v.centroids.
In general add cat numbers to features with v.category.

d.what.vect may help you see if they do or not.
does "v.db.select map_name" show output?

I just added some hints about this to the help page, it's a common gotcha.
https://trac.osgeo.org/grass/changeset/34085

Hamish

Thank you for your reply Hamish.

2 questions based on your suggestion...

At 11:18 PM 10/29/2008, Hamish wrote:

Kevin Webb wrote:
> I am attempting to execute a "point-in-polygon" process on 2 vectors using
> v.select and the output vector is empty, it contains no value/s.

most likely one of both of the inputs is missing category numbers.

if areas do not have centroids you should add them with v.centroids.
In general add cat numbers to features with v.category.

Your suggestion to use v.category worked, v.select on the output vector from the
v.category command yielded a result.

1.) Why does a 'cat' column show in both vectors but v.select doesn't work until
v.category is executed?

Both vectors have the 'cat' column and a visual check of the contents of the
attribute tables for both vectors show a cat value for all records.

GRASS 6.4.svn (lat_lon):~ > v.info -c single_point
Displaying column types/names for database connection of layer 1:
INTEGER|cat
CHARACTER|batch_id
DOUBLE PRECISION|decimal_la
DOUBLE PRECISION|decimal_lo
GRASS 6.4.svn (lat_lon):~ > v.info -c PREC0101
Displaying column types/names for database connection of layer 1:
INTEGER|cat
INTEGER|ID
INTEGER|GRIDCODE
CHARACTER|INCHES

2.) How should I copy/transfer the ID|GRIDCODE|INCHES vector table data from the
source vector to the output vector created by the v.category command?

On 04/11/08 17:57, Kevin Webb wrote:

Thank you for your reply Hamish.

2 questions based on your suggestion...

At 11:18 PM 10/29/2008, Hamish wrote:

Kevin Webb wrote:
> I am attempting to execute a "point-in-polygon" process on 2 vectors using
> v.select and the output vector is empty, it contains no value/s.

most likely one of both of the inputs is missing category numbers.

if areas do not have centroids you should add them with v.centroids.
In general add cat numbers to features with v.category.

Your suggestion to use v.category worked, v.select on the output vector from the
v.category command yielded a result.

1.) Why does a 'cat' column show in both vectors but v.select doesn't work until
v.category is executed?

Both vectors have the 'cat' column and a visual check of the contents of the
attribute tables for both vectors show a cat value for all records.

Just because there is a cat column in the attribute table does not mean that the actual features have category numbers. To check that you can compare the output of v.category option=report ("count" column) with the output of v.info -t.

Moritz