Opened 16 years ago

Last modified 4 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

Description

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

Change History (12)

comment:1 by neteler, 16 years ago

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

Markus

comment:2 by hamish, 16 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.

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

Hamish

comment:3 by hamish, 16 years ago

"r.buffer --help":

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

comment:4 by martinl, 14 years ago

Component: defaultVector
CPU: Unspecified
Platform: Unspecified

comment:5 by martinl, 8 years ago

Milestone: 7.0.07.0.5

comment:6 by neteler, 7 years ago

Milestone: 7.0.57.0.6

comment:7 by neteler, 6 years ago

Milestone: 7.0.67.0.7

comment:8 by martinl, 5 years ago

Milestone: 7.0.77.8.0
Type: taskenhancement

comment:9 by neteler, 5 years ago

Milestone: 7.8.07.8.1

Ticket retargeted after milestone closed

comment:10 by neteler, 4 years ago

Milestone: 7.8.17.8.2

Ticket retargeted after milestone closed

comment:11 by neteler, 4 years ago

Milestone: 7.8.2

Ticket retargeted after milestone closed

comment:12 by neteler, 4 years ago

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