-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix:#1218 #1219
base: trunk
Are you sure you want to change the base?
Fix:#1218 #1219
Conversation
Merge trunk
Missing opening bracket.
Needs AND not OR when combining if clauses.
This reverts commit fd91e40.
This reverts commit be87cd3.
Fix for navit-gps#1218 Crash when setting first destination Changes to make UTM coordinates working
Allow capital letters in UTM coordinates.
@jkoan: Could you link the coordinates.rst from configuration.rst? Don't know how to do that. |
navit/projection.c
Outdated
printf("invalid zone field '%c' in '%s'",zone_field,name); | ||
return projection_none; | ||
} | ||
i-=12; | ||
dbg(lvl_debug,"zone_field %d",i); | ||
printf("zone_field %d",i); | ||
baserow=i*887.6/100; | ||
utm_offset->x=zone*1000000; | ||
i=utmref_letter(square_x); | ||
utm_offset->x+=((i%8)+1)*100000; | ||
i=utmref_letter(square_y); | ||
dbg(lvl_debug,"baserow %d",baserow); | ||
printf("baserow %d",baserow); | ||
if (!(zone % 2)) | ||
i-=5; | ||
dbg(lvl_debug,"i=%d",i); | ||
printf("i=%d",i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why printf instead of dbg?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a leftover from the standalone test app I did. Changed to dbg.
navit/coord.c
Outdated
else { | ||
str_pro = projection_from_name(proj, &offset); | ||
if (str_pro == projection_none) { | ||
dbg(lvl_debug, "Unknown projection: %s\n", proj); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why change from error to debug? error seems to be fitting here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to error again.
navit/coord.c
Outdated
@@ -39,6 +39,9 @@ | |||
* @returns the coordinate | |||
*/ | |||
|
|||
int projection_enum_size[projection_enumsize]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
navit/projection.h
Outdated
projection_garmin, /*!< Garmin projection */ | ||
projection_screen, /*!< Screen projection */ | ||
projection_utm, /*!< UTM projection */ | ||
projection_enumsize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as the above is unused this isn't needed as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed projection_enumsize
.
navit/coord.c
Outdated
#define PROJASSTRING(x) (x==0?"projection_none":x==1?"projection_mg":x==2?"projection_garmin":x==3?"projection_screen":x==4?"projection_utm":"UNKNOWN") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this what projection_to_name is doing already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Removed the macro and used projection_to_name.
navit/coord.c
Outdated
dbg(lvl_debug, "str='%s' x=%f y=%f c=%d\n", str, lng, lat, ret); | ||
dbg(lvl_debug, "rest='%s'\n", str + ret); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why all the line returns? dbg should add those itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is original code. It is shown here as there were spaces inserted by eclipse formatter.
There was an issue with using the format '4808.2356 N 1134.5252 E' I have made testcases for the coordinate formats listed below. 65535 means the struct coord *result has not changed, so no coordinates have been set. Testing all allowed coordinate types and conversions: TestcasesLongitude / Latitude in decimal degrees to projection_none enter('-33.355300,6.334000',none,0x7ff7bfefef90) length: 19 X: 65535
|
docs/configuration/coordinates.rst
Outdated
@@ -0,0 +1,84 @@ | |||
## Coordinates in Navit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just updated coordinates.rst to be in rst format (at least I choose export reStructuredText in Typora to create it). Added some lines for Google Maps coordinates as well.
I will take you tests, convert them into unittests and check the before and after. Afterwards i will merge this. The code itself looks valid :-) thx |
Any updates on merging this? |
This format is used internally by Navit, but is probably not very useful | ||
for other purposes. | ||
|
||
Google Maps Format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes it sound like Google invented this format. Can’t we put this more nicely (e.g. decimal WGS84 lat/lon)? Also, since this is closely related to the other WGS84 formats, why not move it closer to them?
|
||
.. code:: | ||
|
||
48.137260, 11.575420 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there is another WGS84 decimal format, albeit with longitude before latitude, how does Navit know which of the two is meant (i.e. order of coordinates)? Or, what do I need to pay attention to when supplying these coordinates so Navit interprets them correctly (avoiding coordinates being swapped)?
|
||
- mg - the projection used by Map&Guide (the default) | ||
|
||
- garmin - "Garmin" projection (TODO: When would it be useful?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK this is for legacy reasons: Navit was started around 2002 (source code was released later). Note that this predates OSM – the first versions used commercial map data, including Garmin. Hence there would have been a need to support their coordinate system. This probably also explains why Navit internally uses mg
rather than WGS84.
This PR conflicts with the changes in #1221 and if i throw together the tests from you and the other PR both PR's have failing cases. |
Fixing the bookmark issue and making UTM coordinates working.
Examples:
utm32U: 674499.306 5328063.675
utmref32UPU:74499.306 28063.675
Added coordinates.rst taking over the wiki page and adding description for UTM coordinates.