#2324: v.to.rast: useless area warning on points-only maps
-------------------------+--------------------------------------------------
Reporter: neteler | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Vector | Version: svn-releasebranch70
Keywords: v.to.rast | Platform: Unspecified
Cpu: Unspecified |
-------------------------+--------------------------------------------------
There is a small issue which confuses (new) users a lot:
{{{
# rasterizing a map with only points:
# GRASS 7.1.svn (nc_spm_08_grass7):~ >
# ... but there is an area related warning!:
v.to.rast input=geodetic_pts output=test use=attr attr=GDC_ID
WARNING: No areas selected from vector map <geodetic_pts>
Reading features...
100%
Writing raster map...
100%
Converted points/lines: 29939 of 29939
v.to.rast complete.
}}}
The issue is here:
{{{
vect2rast.c:
Points = Vect_new_line_struct();
if (use != USE_Z && use != USE_D && (ftype & GV_AREA)) {
if ((nareas = sort_areas(&Map, Points, field, cat_list)) == 0)
G_warning(_("No areas selected from vector map <%s>"),
vector_map);
}}}
but I don't know how to change the if() condition properly.
#2324: v.to.rast: useless area warning on points-only maps
-------------------------+--------------------------------------------------
Reporter: neteler | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Vector | Version: svn-releasebranch70
Keywords: v.to.rast | Platform: Unspecified
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by annakrat):
It seems to me that the condition is ok. You get the warning because the
default value of type parameter is point,line and area. So you should
specify explicitly type=point to avoid the warning. To avoid the confusion
the type parameter could be required but then we need to type more which
is probably not what we want.
BTW, I wonder why there is no warning about lines as well.
#2324: v.to.rast: useless area warning on points-only maps
-------------------------+--------------------------------------------------
Reporter: neteler | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Vector | Version: svn-releasebranch70
Keywords: v.to.rast | Platform: Unspecified
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by hcho):
IMO, type=point,line,area means to select those types only if they are
valid type in the input map. If a map is point only, type=line,area should
be ignored and no warnings about areas should be printed.
{{{
int sort_areas(...)
{
...
nareas = Vect_get_num_areas(Map);
if (nareas == 0)
return -1;
...
}
int vect_to_rast(...)
{
...
if (use != USE_Z && use != USE_D && (ftype & GV_AREA)) {
if ((nareas = sort_areas(&Map, Points, field, cat_list)) >= 0) {
if (nareas == 0)
G_warning(_("No areas selected from vector map <%s>"),
vector_map);
G_debug(1, "%d areas sorted", nareas);
} /* else map with no areas */
}
...
}
}}}
Points-only patching with v.patch reports the confusing messages:
{{{
Intersections at borders will have to be snapped
Lines common between files will have to be edited
The header information also may have to be edited
}}}
Likely only the last message should be shown in case that no areas/lines
are present.