[GRASS-user] Problems getting unique categories with v.category

Hi,

I have created a point vector from a coastline using v.to.points:

v.to.points input=CanCoast_Shoreline type=line output=CanCoast_Shoreline_points use=vertex --v

This works fine, and the next thing I want to do is upload raster slope values from a DEM to the attribute table of the points vector using v.what.rast, but I get tons of warnings like these:

WARNING: Multiple points (12) of category 16, value set to ‘NULL’

I assume this is telling me the points have duplicate categories?

So to get around this, I tried recreating the points, this time without an attribute table, using v.to.points -t, then adding the table and categories manually:

v.to.points input=CanCoast_Shoreline type=line output=CanCoast_Shoreline_points use=vertex -t --v --o

v.db.addtable map=CanCoast_Shoreline_points columns=“Slope_percent integer”

v.category input=CanCoast_Shoreline_points option=add output=CanCoast_Shoreline_points_with_cat

But running v.what.rast still gives me the same error as before.

I ran v.categories in report mode to see what is going on:

v.category input=CanCoast_Shoreline_points_with_cat option=report
Layer/table: 1/CanCoast_Shoreline_points_with_cat
type count min max
point 105427 1 1692
line 0 0 0
boundary 0 0 0
centroid 0 0 0
area 0 0 0
face 0 0 0
kernel 0 0 0
all 105427 1 1692
Layer: 2
type count min max
point 105427 1 105427
line 0 0 0
boundary 0 0 0
centroid 0 0 0
area 0 0 0
face 0 0 0
kernel 0 0 0
all 105427 1 105427

Where did the two layers come from? I thought v.to.points -t wasn’t supposed to make an attribute table. And the fact that the ‘max’ value reported above is ‘1692’ seems to be a hangover from the line features they were created from.

In this case, I don’t care about the IDs or categories of the lines the points originated from; I want unique categories for the 105427 points that were made so I can then successfully run v.what.rast and upload my DEM slope values.

It’s been a while since I’ve used these tools, so I’m a little rusty. Is there a way to do this?

~ Eric.

On Thu, Oct 19, 2017 at 8:38 PM, Eric Patton <thepattonian@gmail.com> wrote:

Hi,

I have created a point vector from a coastline using v.to.points:

v.to.points input=CanCoast_Shoreline type=line output=CanCoast_Shoreline_points use=vertex --v

This works fine, and the next thing I want to do is upload raster slope values from a DEM to the attribute table of the points vector using v.what.rast, but I get tons of warnings like these:

WARNING: Multiple points (12) of category 16, value set to ‘NULL’

I assume this is telling me the points have duplicate categories?

Exactly. From the manual of v.to.points:
“The output is a vector map with 2 layers. Layer 1 holds the category of the input features; all points created along the same line have the same category, equal to the category of that line. In layer 2 each point has its unique category”

The solution is to upload values to layer 2 with v.what.rast layer=2

So to get around this, I tried recreating the points, this time without an attribute table, using v.to.points -t, then adding the table and categories manually:

With v.to.points -t, the category values are already there, but not the tables.

HTH,

Markus M

v.to.points input=CanCoast_Shoreline type=line output=CanCoast_Shoreline_points use=vertex -t --v --o
v.db.addtable map=CanCoast_Shoreline_points columns=“Slope_percent integer”
v.category input=CanCoast_Shoreline_points option=add output=CanCoast_Shoreline_points_with_cat

But running v.what.rast still gives me the same error as before.

I ran v.categories in report mode to see what is going on:

v.category input=CanCoast_Shoreline_points_with_cat option=report
Layer/table: 1/CanCoast_Shoreline_points_with_cat
type count min max
point 105427 1 1692
line 0 0 0
boundary 0 0 0
centroid 0 0 0
area 0 0 0
face 0 0 0
kernel 0 0 0
all 105427 1 1692
Layer: 2
type count min max
point 105427 1 105427
line 0 0 0
boundary 0 0 0
centroid 0 0 0
area 0 0 0
face 0 0 0
kernel 0 0 0
all 105427 1 105427

Where did the two layers come from? I thought v.to.points -t wasn’t supposed to make an attribute table. And the fact that the ‘max’ value reported above is ‘1692’ seems to be a hangover from the line features they were created from.

In this case, I don’t care about the IDs or categories of the lines the points originated from; I want unique categories for the 105427 points that were made so I can then successfully run v.what.rast and upload my DEM slope values.

It’s been a while since I’ve used these tools, so I’m a little rusty. Is there a way to do this?

~ Eric.


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user