[GRASS-dev] [GRASS GIS] #182: v.segment: offset units support

#182: v.segment: offset units support
------------------------+---------------------------------------------------
Reporter: martinl | Owner: grass-dev@lists.osgeo.org
     Type: task | Status: new
Priority: minor | Milestone: 7.0.0
Component: default | Version: svn-trunk
Keywords: vector, LL |
------------------------+---------------------------------------------------
Based on

http://lists.osgeo.org/pipermail/grass-user/2008-June/045035.html

  It would be cool if v.segment could accept offsets in various units.

Martin

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

#182: v.segment: offset units support
----------------------+-----------------------------------------------------
  Reporter: martinl | Owner: grass-dev@lists.osgeo.org
      Type: task | Status: new
  Priority: minor | Milestone: 7.0.0
Component: default | Version: svn-trunk
Resolution: | Keywords: vector, LL
----------------------+-----------------------------------------------------
Comment (by neteler):

v.to.db has code which could be used: see
[source:grass/trunk/vector/v.to.db/units.c]
(this file should possibly go to library level).

Markus

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

#182: v.segment: offset units support
----------------------+-----------------------------------------------------
  Reporter: martinl | Owner: grass-dev@lists.osgeo.org
      Type: task | Status: new
  Priority: minor | Milestone: 7.0.0
Component: default | Version: svn-trunk
Resolution: | Keywords: vector, LL
----------------------+-----------------------------------------------------
Comment (by hamish):

''If'' it is wanted, G_distance() includes code to automatically convert
map units to meters- for Lat/Lon geodesic (great circle) distance is
automatically used.

lib/gis/distance.c
{{{
/**
  * \fn double G_distance (double e1, double n1, double e2, double n2)
  *
  * \brief Returns distance in meters.
  *
  * This routine computes the distance, in meters, from
  * <b>x1</b>,<b>y1</b> to <b>x2</b>,<b>y2</b>. If the projection is
  * latitude-longitude, this distance is measured along the geodesic. Two
  * routines perform geodesic distance calculations.
  *
  * \param[in] x1
  * \param[in] y1
  * \param[in] x2
  * \param[in] y2
  * \return double
  */
}}}

this is used by d.measure, swig/python/m.distance, ...

also check what r.buffer does, it goes to a lot of trouble with units and
projections and seems to end up doing the right thing.

I think importantly for the vector modules Vect_line_length() just uses
hypot(dx,dy) so will only work properly in projected locations. For
Lat/Lon there is Vect_line_geodesic_length(). (and I assume ''area''
equivalents) I do not know if it is better to do `if(G_projection() ==
PROJECTION_LL)` in each module or automatically take care of that in the
library like for G_distance().

There is also the small matter of the vector library not wrapping at 180
longitude, while libgis generally does; but I won't hijack the ticket. :slight_smile:

Hamish

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

#182: v.segment: offset units support
----------------------+-----------------------------------------------------
  Reporter: martinl | Owner: grass-dev@lists.osgeo.org
      Type: task | Status: new
  Priority: minor | Milestone: 7.0.0
Component: default | Version: svn-trunk
Resolution: | Keywords: vector, LL
----------------------+-----------------------------------------------------
Comment (by hamish):

"r.buffer --help":
{{{
       units Units of distance
               options: meters,kilometers,feet,miles,nautmiles
               default: meters
}}}

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

#182: v.segment: offset units support
--------------------------+-------------------------------------------------
  Reporter: martinl | Owner: grass-dev@lists.osgeo.org
      Type: task | Status: new
  Priority: minor | Milestone: 7.0.0
Component: Vector | Version: svn-trunk
Resolution: | Keywords: vector, LL
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by martinl):

  * platform: => Unspecified
  * component: default => Vector
  * cpu: => Unspecified

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/182#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>