#2417: r.profile should report distance in location units
--------------------------------+-------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.1.0
Component: Projections/Datums | Version: svn-trunk
Keywords: r.profile, units | Platform: All
Cpu: Unspecified |
--------------------------------+-------------------------------------------
r.profile reports the length in meters no matter which units the current
location uses. It would be better if it could report it in the current
units. This ticket is created based on #1787. Once this is changed,
certain changes must be reverted in GUI profile tool (r61910, r61269).
#2417: r.profile should report distance in location units
--------------------------------+-------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.1.0
Component: Projections/Datums | Version: svn-trunk
Keywords: r.profile, units | Platform: All
Cpu: Unspecified |
--------------------------------+-------------------------------------------
Comment(by mlennert):
Replying to [ticket:2417 annakrat]:
> r.profile reports the length in meters no matter which units the current
location uses. It would be better if it could report it in the current
units.
The attached patch is a very simple attempt to use location units. I don't
have time right now to revert the GUI profile tool changes to check
whether this solves the problem, but at least with this patch distances
are in location units.
The question is whether this should be the default behaviour of r.profile,
or whether this should be only activated when a flag is set.
#2417: r.profile should report distance in location units
--------------------------------+-------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.1.0
Component: Projections/Datums | Version: svn-trunk
Keywords: r.profile, units | Platform: All
Cpu: Unspecified |
--------------------------------+-------------------------------------------
Comment(by annakrat):
Replying to [comment:1 mlennert]:
> Replying to [ticket:2417 annakrat]:
> > r.profile reports the length in meters no matter which units the
current location uses. It would be better if it could report it in the
current units.
>
> The attached patch is a very simple attempt to use location units. I
don't have time right now to revert the GUI profile tool changes to check
whether this solves the problem, but at least with this patch distances
are in location units.
Thanks for looking into this. The patch seems to work. I got confused from
the handling of units in the library which is completely weird, and I
thought the conversion is not working properly but it's fortunately
computed correctly. I improved the patch. The only problem is the name of
the units which is in case of Foot_US not recognized and
`G_database_unit_name` gives just ''unit''. As a result, r.profile now
prints something like this
>
> The question is whether this should be the default behaviour of
r.profile, or whether this should be only activated when a flag is set.
In my opinion, in most cases you want the current units. If you think the
flag would be useful, it should switch to meters and by default (unset
flag) use current units. Anyone has any opinion on adding this flag?
No opinion on what should be the default, but I definitely think it to be useful to have the option to switch to meters if desired (especially useful when using latlon in which case current units will probably be less useful)
···
On Mon, Sep 15, 2014 at 5:45 PM, GRASS GIS <trac@osgeo.org> wrote:
#2417: r.profile should report distance in location units
--------------------------------±------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.1.0
Component: Projections/Datums | Version: svn-trunk
Keywords: r.profile, units | Platform: All
Cpu: Unspecified |
--------------------------------±------------------------------------------
Comment(by annakrat):
Replying to [comment:1 mlennert]:
Replying to [ticket:2417 annakrat]:
r.profile reports the length in meters no matter which units the
current location uses. It would be better if it could report it in the
current units.
The attached patch is a very simple attempt to use location units. I
don’t have time right now to revert the GUI profile tool changes to check
whether this solves the problem, but at least with this patch distances
are in location units.
Thanks for looking into this. The patch seems to work. I got confused from
the handling of units in the library which is completely weird, and I
thought the conversion is not working properly but it’s fortunately
computed correctly. I improved the patch. The only problem is the name of
the units which is in case of Foot_US not recognized and G_database_unit_name gives just ‘‘unit’’. As a result, r.profile now
prints something like this
The question is whether this should be the default behaviour of
r.profile, or whether this should be only activated when a flag is set.
In my opinion, in most cases you want the current units. If you think the
flag would be useful, it should switch to meters and by default (unset
flag) use current units. Anyone has any opinion on adding this flag?
#2417: r.profile should report distance in location units
--------------------------------+-------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.1.0
Component: Projections/Datums | Version: svn-trunk
Keywords: r.profile, units | Platform: All
Cpu: Unspecified |
--------------------------------+-------------------------------------------
Comment(by mlennert):
Replying to [comment:2 annakrat]:
> The only problem is the name of the units which is in case of Foot_US
not recognized and `G_database_unit_name` gives just ''unit''. As a
result, r.profile now prints something like this
>
> {{{
> Output Format:
> [Along Track Dist. (units)] [Elevation]
> Approx. transect length [205.092833] units
> ...
> }}}
>
> but this is a different problem.
It seems to me that it should be possible to get the correct units name
from the PROJ_UNITS file, but I just can't find a library function to do
just that. I'm sure it must exist...
#2417: r.profile should report distance in location units
--------------------------------+-------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.1.0
Component: Projections/Datums | Version: svn-trunk
Keywords: r.profile, units | Platform: All
Cpu: Unspecified |
--------------------------------+-------------------------------------------
Comment(by mlennert):
Replying to [comment:4 annakrat]:
> I implemented the -m flag in r62035. In case of latlon, meters are used
always. I reverted the changes in GUI.
Great, thanks !
This still leaves the issue of how to get the unit names if they are
outside the standard. As they are correct in PROJ_UNITS there should be a
way to get them from there.
#2417: r.profile should report distance in location units
--------------------------------+-------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.1.0
Component: Projections/Datums | Version: svn-trunk
Keywords: r.profile, units | Platform: All
Cpu: Unspecified |
--------------------------------+-------------------------------------------
Comment(by marisn):
Replying to [comment:4 annakrat]:
> I implemented the -m flag in r62035. In case of latlon, meters are used
always. I reverted the changes in GUI.
If changing module parameters, wouldn't it be better to implement it as a
choice option with appropriate parser standard option chooser? Default
could be location units. Then the user could decide, if he wants to have
metres, feet, etc. Just a question not a request.
#2417: r.profile should report distance in location units
--------------------------------+-------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: major | Milestone: 7.0.0
Component: Projections/Datums | Version: svn-trunk
Keywords: r.profile, units | Platform: All
Cpu: Unspecified |
--------------------------------+-------------------------------------------
Changes (by neteler):
* priority: normal => major
* milestone: 7.1.0 => 7.0.0
Comment:
At least in California (http://maps.cityofdavis.org/library/, Street
Centerline, http://epsg.io/102642) as well as some North Carolina .prj definitions
with
* unit: Foot_US
* units: Foot_USs
still exist, hence should be supported as well.
I have created a patch (attached) which introduces US_USFEET as suggested
years ago
by Glynn. It contains one TODO where I don't know how to distinguish the
special
State Plane feet case. How to do that properly? with PROJECTION_SP_USF?
TODO: GS_geodistance() in ogsf/GS_util.c comes with hardcoded values!
Instead G_meters_to_units_factor() should be used, stuff to be merged.
#2417: r.profile should report distance in location units
--------------------------------+-------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: major | Milestone: 7.0.0
Component: Projections/Datums | Version: svn-trunk
Keywords: r.profile, units | Platform: All
Cpu: Unspecified |
--------------------------------+-------------------------------------------
Comment(by annakrat):
Replying to [comment:7 neteler]:
> I have created a patch (attached) which introduces US_USFEET as
suggested years ago
> by Glynn. It contains one TODO where I don't know how to distinguish the
special
> State Plane feet case. How to do that properly? with PROJECTION_SP_USF?
#2417: r.profile should report distance in location units
--------------------------------+-------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: major | Milestone: 7.0.0
Component: Projections/Datums | Version: svn-trunk
Keywords: r.profile, units | Platform: All
Cpu: Unspecified |
--------------------------------+-------------------------------------------
Comment(by annakrat):
Replying to [comment:6 marisn]:
> Replying to [comment:4 annakrat]:
> > I implemented the -m flag in r62035. In case of latlon, meters are
used always. I reverted the changes in GUI.
>
> If changing module parameters, wouldn't it be better to implement it as
a choice option with appropriate parser standard option chooser? Default
could be location units. Then the user could decide, if he wants to have
metres, feet, etc. Just a question not a request.
Yes, it was not so difficult so I added this option in r62046 (and removed
the flag).
#2417: r.profile should report distance in location units
--------------------------------+-------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: major | Milestone: 7.0.0
Component: Projections/Datums | Version: svn-trunk
Keywords: r.profile, units | Platform: All
Cpu: Unspecified |
--------------------------------+-------------------------------------------
Comment(by neteler):
Thanks for fixing my proposed patch. Since PROJECTION_SP is not recognized
but treated as
PROJECTION_OTHER, I suggest to remove the "case PROJECTION_SP" entirely in
order to simplify
the code.