[GRASSLIST:702] Re: d.measure units

Hamish hamish_nospam at yahoo.com
Thu Apr 13 08:09:41 EDT 2006


> The manual for d.measure says that it outputs distances in the units
> of the current location, but as far as I can tell it only outputs in
> meters.
..
> name: Transverse Mercator
> proj: tmerc
..
> and PROJ_UNITS contains:
> 
> unit: Foot_US
> units: Foot_USs
> meters: 0.3048006096012192
> 
> But each time I use d.measure, with or without the "-m" flag, it
> reports all distances in meters (and does so correctly, but requires
> that I reconvert back to US feet by hand).
> 
> The man page says that d.measure's only supposed to report in meters
> with -m (or presumably if the location's units are meters).  What's up
> here?  Bug, incorrect documentation, or error between keyboard and
> chair?


AFAICT it always says the answer in meters, the -m flag just suppresses
the other units from being reported when it is reporting an area:
  (see "m_flag" part and the print_length() fn)

http://freegis.org/cgi-bin/viewcvs.cgi/grass6/display/d.measure/msurements.c?rev=HEAD&content-type=text/vnd.viewcvs-markup

Now in that code the main length calculation uses G_distance()
  length += G_distance()

http://freegis.org/cgi-bin/viewcvs.cgi/grass6/lib/gis/distance.c?rev=HEAD&content-type=text/vnd.viewcvs-markup

..which should return a value in meters.



So "only in meters" means "and nothing else" as opposed to "as opposed
to local units"?

the help page says:
"Line lengths are stated in the same units as those of the current
LOCATION. In a XY-LOCATION, where no units are available, d.measure
prints a warning and gives results without units."

so the help page is wrong?


d.barscale and d.grid might help clear up any confusion / confirm.

Also the print_length() fn in d.measure could divide "length" by 
G_database_units_to_meters_factor() and report different units without 
very much effort.



Hamish




More information about the grass-user mailing list