[GRASS-dev] Re: [GRASS GIS] #182: v.segment: offset units support
GRASS GIS
trac at osgeo.org
Fri Jun 6 09:58:22 EDT 2008
#182: v.segment: offset units support
----------------------+-----------------------------------------------------
Reporter: martinl | Owner: grass-dev at 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. :)
Hamish
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/182#comment:2>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list