#12 closed enhancement/feature request (fixed)
Add imperial measurements
Reported by: | KaZeR | Owned by: | number6 |
---|---|---|---|
Priority: | major | Milestone: | want patch / contribution |
Component: | core | Version: | git master |
Severity: | Keywords: | imperial miles units osd | |
Cc: | flabrosse, http://openid-provider.appspot.com/daveroundy, nick@… |
Description
Navit should be able to use metric or imperial measurements, according to the LC settings.
Attachments (4)
Change History (28)
comment:1 Changed 15 years ago by avantman42
comment:2 Changed 14 years ago by KaZeR
- Milestone set to want patch / contribution
comment:3 Changed 14 years ago by dctucker
- Owner changed from somebody to dctucker
This is currently my main priority. Once I'm more familiar with the codebase I'll make it work with locale settings. For now I'm going to make it a configuration option.
comment:4 Changed 14 years ago by dctucker
- Status changed from new to assigned
- Version set to svn
Changed 14 years ago by dctucker
patch generated by svn diff - includes autogen.sh and configure.in patch for OS X
comment:5 Changed 14 years ago by hoorah
I added km/h to mph conversion (optional, per OSD settings) to dctucker's patch.
Do not think locale should determine which unit navit displays (user should not have to change locale settings while crossing U.S/Canadian border). Configuration option may be best for now.
I'm a new navit user, so my code/patch probably needs some additional work.
Changed 14 years ago by hoorah
comment:6 Changed 13 years ago by kazer
- Owner changed from dctucker to kazer
- Status changed from assigned to new
comment:7 Changed 13 years ago by flabrosse
- Cc flabrosse added
Has the patch been merged in the trunk? If not, doing so would be great. I tried the suggested config file but I get:
navit:convert_to_attrs:failed to create attribute 'imperial' with value '1'
Cheers,
Fred
comment:8 Changed 13 years ago by openid-provider.appspot.com/daveroundy
- Cc http://openid-provider.appspot.com/daveroundy added
comment:9 Changed 13 years ago by openid-provider.appspot.com/daveroundy
I'll just add that I'm also eager to see this feature added! (It's possible that I'll be able to code on it, but I've got a lot to learn about OSM for now... and numerous other projects.)
comment:10 Changed 13 years ago by kazer
I recall having tested the patch some times ago, but if it hadn't made its way to the trunk, something was probably wrong. I should have posted what..
If someone is willing to review/update the patch, it would be nice.
It has been discussed yesterday in #navit :
mars 05 07:40:52 <samco> ColdFyre: I can't say for sure why it hasn't been applied, but format_distance is buggy. mars 05 07:41:11 <ColdFyre> hmm mars 05 07:41:20 <samco> if (!strcmp(sep,"US")) should be if (imperial) mars 05 07:42:06 <samco> and the two calls to g_strdup_printf have too few arguments for the format string (add sep as the final argument).
comment:11 Changed 13 years ago by xcoldfyrex
The patch no longer cleanly applied. I fixed that(tried on rev 3000), but I got a compile error after:
osd_core.c: In function 'format_distance': osd_core.c:105: warning: too few arguments for format osd_core.c:107: warning: too few arguments for format osd_core.c: In function 'osd_scale_draw': osd_core.c:1331: error: 'format' undeclared (first use in this function) osd_core.c:1331: error: (Each undeclared identifier is reported only once osd_core.c:1331: error: for each function it appears in.)
Changed 13 years ago by xcoldfyrex
comment:12 Changed 13 years ago by xcoldfyrex
This is just the updated patch, allowing it to apply cleanly. The compile problem still exists and is out of my realm.
comment:13 Changed 12 years ago by number6
- Cc nick@… added
- Keywords imperial miles units osd added
- Owner changed from kazer to number6
- Status changed from new to assigned
Ideally, the user should be able to select what units to use via the vehicle profile - allowing for quick switching to the correct units at a boarder, e.g. USA --> Mexico.
The current patch is over 1000 revisions old. If someone would re-rewite the patch for the latest revision and allow the user to select the units by going into the Vehicle section of Navit, I will commit the patch.
Number6
comment:14 Changed 12 years ago by korrosa
I notice that in the patch (line 24) there's the line:
if (!strcmp(sep,"US")){
Now, I've no idea what this does, but the US isn't the only place to use imperial measurements - if we're to have a parameter in the <vehicle> tag (which I agree is the correct place) then it should be something like "imperial=true" - i.e. independent of the US.
There probably also needs to be a list compiled in the code of all the states using imperial measurements, and enable Navit to auto-switch to imperial if the locale fits into one of these states. This auto-switching should also be an option...
Links of interest: http://en.wikipedia.org/wiki/Imperial_units#Current_use_of_imperial_units, http://lamar.colostate.edu/~hillger/internat.htm
comment:15 Changed 12 years ago by number6
Should the user not be able to have two vehicle profiles, one for metric and one for imperial, so he / she can change to the correct measurement system if needed?
For example, if I have a car that measures speed in MPH, I should be allowed to force Navit to use MPH.
Perhaps an "imperial=true" and "imperial=auto" tag (with no tag being needed for metric to ensure backwards compatibility for people's XML files) would allow both Navit and the user to select the correct units.
comment:16 Changed 12 years ago by korrosa
I agree with all three of your paragraphs!
One vehicle has imperial=true and uses MPH, another doesn't and uses KPH. This way, as you say, the default is metric for navit.xml backwards compatibility.
Then, a separate option of auto-switching (true/false) could be included, which will override the imperial=true/false and set the vehicle to the locale's units. If auto-switching=false, the imperial=true/false is honoured.
I think your idea of allowing the imperial tag to use "true/false/auto" (where default=false)is probably the best idea, but then my third paragraph wouldn't quite work...
comment:17 follow-up: ↓ 20 Changed 12 years ago by number6
Your last paragraph would work, there are only a handful of countries that use imperial measurements by default for roadsigns - USA, UK, Liberia and Myanmar.
Other countries can be added as needed, if we come across them!
comment:18 Changed 12 years ago by korrosa
Imperial units can now be spoken and displayed by Navit, as of http://navit.svn.sourceforge.net/navit/?rev=4126&view=rev.
<navit ... imperial="1" ... >
..should do it.
I won't close this until confirmed test reports.
comment:19 follow-up: ↓ 21 Changed 12 years ago by korrosa
- Resolution set to fixed
- Status changed from assigned to closed
Works on my system. Some OSD items need updating to take account of this change, but otherwise this works fine.
Please re-open if you disagree.
comment:20 in reply to: ↑ 17 Changed 12 years ago by zoff99
Replying to http://wiki.navit-project.org/index.php/user:number6:
Your last paragraph would work, there are only a handful of countries that use imperial measurements by default for roadsigns - USA, UK, Liberia and Myanmar.
Other countries can be added as needed, if we come across them!
sweet. i can just picture a guy in myanmar using navit everyday on his way to work :-)
comment:21 in reply to: ↑ 19 Changed 12 years ago by flabrosse
Replying to https://wiki.navit-project.org/index.php/user:korrosa:
Some OSD items need updating to take account of this change, but otherwise this works fine.
Could you please elaborate on that a bit? What changes did you have to make? Anything specific to using imperial?
I haven't had a chance to try yet, so any hint would be appreciated.
Cheers.
comment:22 Changed 12 years ago by korrosa
If you want to use imperial, just add imperial="1" into your navit tag, i.e.
<navit ... imperial="1" ... >
tegzed made some more commits last night, and one included an update to the speed_warner OSD so now that takes account of imperial units too. All other OSD items also show in imperial if using imperial="1" (such as the text OSD with labels navigation.item.destination_length[named], navigation.item[1].length[named] and any others which I may have missed....)
comment:23 Changed 12 years ago by flabrosse
I have now tried it and it all works very well.
A minor point though: the use of feet instead of yards means that some long numbers are displayed and spoken, making for long announcements. Maybe a combination of both would be good? Or is that already possible or there and I didn't notice?
comment:24 Changed 12 years ago by korrosa
Unfortunately it's only miles and feet. I commented in the IRC channel when the feature was put in that here in the UK yards are used on the roadsigns. Unfortunately, it seems like the "other" great imperial user (USA) uses feet. It'd be nice to have the option to use either feet or yards, but there isn't one yet. Perhaps a new ticket?
I would like to see imperial measurements supported. In the UK, road signs give distances & speeds in miles per hour, so having directions in kilometres is confusing.