Skip to content

Commit

Permalink
v.to.rast: Use verbose for no area message, not warning (#2459)
Browse files Browse the repository at this point in the history
When there are no areas in the vector map, v.to.rast would give warning, 'No areas selected'. However, no areas is a perfectly fine state when converting a vector map with points or lines only, so the warning is misleading.

To cover the case where a user may need to know about the number of areas, a verbose message is now added reporting the number replacing both the warning and a debug message with the number.

This removes the false alarm, warning inconsistency in behavior between types, and warning inconsistency with other modules. Empty selection is generally a valid result, so here it also gives no warning.

The alternative of always giving warning when no features of a specific type are present, generates a lot of warnings. Another alternative would be to completely rework of how the type option works, e.g., the default would be empty and warnings would be present if the type was explicit, but that still would be somewhat inconsistent with other modules and does not follow that an empty selection is generally a valid result.
  • Loading branch information
wenzeslaus committed Aug 5, 2022
1 parent fa88ff6 commit 87c9085
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions vector/v.to.rast/vect2rast.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,9 @@ int vect_to_rast(const char *vector_map, const char *raster_map, const char *fie
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);

G_debug(1, "%d areas sorted", nareas);
nareas = sort_areas(&Map, Points, field, cat_list);
G_verbose_message(_("Number of areas selected from vector map <%s>: %d"),
vector_map, nareas);
}
if (nareas > 0 && dense) {
G_warning(_("Area conversion and line densification are mutually exclusive, disabling line densification."));
Expand Down

0 comments on commit 87c9085

Please sign in to comment.