Opened 15 years ago

Last modified 3 years ago

#182 new enhancement

v.segment: offset units support

Reported by: martinl Owned by: grass-dev@…
Priority: minor Milestone: 7.8.3
Component: Vector Version: svn-trunk
Keywords: vector, LL Cc:
CPU: Unspecified Platform: Unspecified


Based on

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


Change History (12)

comment:1 by neteler, 15 years ago has code which could be used: see grass/trunk/vector/ (this file should possibly go to library level).


comment:2 by hamish, 15 years ago

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.


 * \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. :)


comment:3 by hamish, 15 years ago

"r.buffer --help":

      units   Units of distance
              options: meters,kilometers,feet,miles,nautmiles
              default: meters

comment:4 by martinl, 13 years ago

Component: defaultVector
CPU: Unspecified
Platform: Unspecified

comment:5 by martinl, 7 years ago


comment:6 by neteler, 6 years ago


comment:7 by neteler, 5 years ago


comment:8 by martinl, 4 years ago

Type: taskenhancement

comment:9 by neteler, 3 years ago


Ticket retargeted after milestone closed

comment:10 by neteler, 3 years ago


Ticket retargeted after milestone closed

comment:11 by neteler, 3 years ago

Milestone: 7.8.2

Ticket retargeted after milestone closed

comment:12 by neteler, 3 years ago

Milestone: 7.8.3
Note: See TracTickets for help on using tickets.