[GRASS-dev] [GRASS GIS] #3430: v.clean threshold in lat-long: metric or not?

#3430: v.clean threshold in lat-long: metric or not?
-------------------------+-------------------------
Reporter: neteler | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.2.3
Component: Vector | Version: 7.2.2
Keywords: v.clean | CPU: Unspecified
Platform: Unspecified |
-------------------------+-------------------------
From:
https://gis.stackexchange.com/questions/258089/v-clean-with-rmarea-and-
lat-long-projection

There is some confusion concerning this message:
main.c:
{{{
     /* TODO: threshold might be recalculated with optional geodesic
support to meters */
     if (G_projection() == PROJECTION_LL)
         G_important_message(_("Note: In latitude-longitude coordinate
system specify threshold in degree unit"));
}}}

while the documentation reads:
{{{
grep meter v.clean.html
case, also the threshold parameter requires several values to be listed
Threshold must always be in square meters, also for latitude-longitude
locations or locations with units other than meters.
}}}

Should the G_important_message() be removed from main.c?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3430&gt;
GRASS GIS <https://grass.osgeo.org>

#3430: v.clean threshold in lat-long: metric or not?
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.3
Component: Vector | Version: 7.2.2
Resolution: | Keywords: v.clean
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by mlennert):

Replying to [ticket:3430 neteler]:
> From:
> https://gis.stackexchange.com/questions/258089/v-clean-with-rmarea-and-
lat-long-projection
>
> There is some confusion concerning this message:
> main.c:
> {{{
> /* TODO: threshold might be recalculated with optional geodesic
support to meters */
> if (G_projection() == PROJECTION_LL)
> G_important_message(_("Note: In latitude-longitude coordinate
system specify threshold in degree unit"));
> }}}
>
> while the documentation reads:
> {{{
> grep meter v.clean.html
> case, also the threshold parameter requires several values to be listed
> Threshold must always be in square meters, also for latitude-longitude
> locations or locations with units other than meters.
> }}}
>
> Should the G_important_message() be removed from main.c?

Looking through the code, I actually have the feeling that the
documentation is wrong, at least for some of v.clean's functionalities.
For example for snapping, I see the following in the
[https://trac.osgeo.org/grass/browser/grass/trunk/lib/vector/Vlib/snap.c#L302
code]:

{{{
             dx = XPnts[pointb].x - XPnts[point].x;
             dy = XPnts[pointb].y - XPnts[point].y;
             dist2 = dx * dx + dy * dy;

             if (dist2 > thresh2) /* outside threshold */
                 continue;
}}}

So while area calculations might use meters (i.e. the rmarea function
mentioned in the SE message), I'm not sure this is the case for snapping
distances... I think this needs very careful review before deciding what
to do.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3430#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3430: v.clean threshold in lat-long: metric or not?
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.3
Component: Vector | Version: 7.2.2
Resolution: | Keywords: v.clean
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by mmetz):

Replying to [comment:1 mlennert]:
> Replying to [ticket:3430 neteler]:
[...]
> >
> > Should the G_important_message() be removed from main.c?
>
> Looking through the code, I actually have the feeling that the
documentation is wrong, at least for some of v.clean's functionalities.
[...]
>
> So while area calculations might use meters (i.e. the rmarea function
mentioned in the SE message), I'm not sure this is the case for snapping
distances... I think this needs very careful review before deciding what
to do.

I suggest to remove the message, because the message does not distinguish
between the different cleaning tools. For tool=rmarea, the threshold must
always be in square meters as stated in the manual. Otherwise, I'm pretty
sure that the threshold is map units, also for latlon.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3430#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3430: v.clean threshold in lat-long: metric or not?
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.3
Component: Vector | Version: 7.2.2
Resolution: | Keywords: v.clean
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by mmetz):

Replying to [comment:2 mmetz]:
> Replying to [comment:1 mlennert]:
> > Replying to [ticket:3430 neteler]:
> [...]
> > >
> > > Should the G_important_message() be removed from main.c?
> >
> > Looking through the code, I actually have the feeling that the
documentation is wrong, at least for some of v.clean's functionalities.
> [...]
> >
> > So while area calculations might use meters (i.e. the rmarea function
mentioned in the SE message), I'm not sure this is the case for snapping
distances... I think this needs very careful review before deciding what
to do.
>
> I suggest to remove the message, because the message does not
distinguish between the different cleaning tools. For tool=rmarea, the
threshold must always be in square meters as stated in the manual.
Otherwise, I'm pretty sure that the threshold is map units, also for
latlon.

According to https://gis.stackexchange.com/questions/258089/v-clean-with-
rmarea-and-lat-long-projection there is another issue with v.clean
tool=rmarea because it might remove areas that should not be removed. A
test dataset would be helpful.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3430#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#3430: v.clean threshold in lat-long: metric or not?
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.6.2
Component: Vector | Version: 7.2.2
Resolution: | Keywords: v.clean
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------
Changes (by martinl):

* milestone: 7.2.4 => 7.6.2

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3430#comment:6&gt;
GRASS GIS <https://grass.osgeo.org>