Skip to content
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

Open
wants to merge 29 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
68afffb
Initial commit
OLFDB May 23, 2022
5a0288b
Merge branch 'navit-gps:trunk' into navitori
OLFDB May 23, 2022
e3cb9c2
Merge pull request #18 from navit-gps/trunk
OLFDB Jan 4, 2023
fd91e40
Fix:#1185
OLFDB Jan 5, 2023
be87cd3
Fix:#1185
OLFDB Jan 5, 2023
a2ffdea
Update after further tests
OLFDB Jan 7, 2023
31c48d4
Update navit.c
OLFDB Jan 7, 2023
90ff624
Update navit.c
OLFDB Jan 7, 2023
ae572cc
Revert "Fix:#1185"
OLFDB Jan 8, 2023
57cba4e
Revert "Fix:#1185"
OLFDB Jan 8, 2023
381e544
Merge trunk.
OLFDB Jan 11, 2023
64c5eab
merge trunk
OLFDB Jan 11, 2023
be53f3d
Merge branch 'navit-gps-trunk' into navitori
OLFDB Jan 11, 2023
34fcdb9
Taken from wiki and added UTM coordinate description
OLFDB Jan 14, 2023
ca0fd3c
Convinience Macro to get projection names in text
OLFDB Jan 14, 2023
7620dc4
Added SIZE enum member to calculate size of enum
OLFDB Jan 14, 2023
5d0bfe0
Changes to fix handling of UTM coordinates.
OLFDB Jan 14, 2023
223b8b3
Changed SIZE to projection_enumsize
OLFDB Jan 14, 2023
fb0afeb
Removed unneccessary macro PROJASSTRING
OLFDB Jan 21, 2023
90d36d7
Removed unneccessary enum value projection_enumsize
OLFDB Jan 21, 2023
7c2492a
Use dbg instead of printf again
OLFDB Jan 21, 2023
c187fda
Linked new file coordinates.rst
OLFDB Jan 21, 2023
d9c0f97
astyle
OLFDB Jan 21, 2023
4f64b74
Update after testing with all coordinate formats. Google Maps included.
OLFDB Jan 21, 2023
c3dba1b
Changed to rst format and added Google Maps coordinates description
OLFDB Jan 31, 2023
1167d94
Merge branch 'trunk' into bookmarkissue
OLFDB Dec 25, 2023
55f0c86
Revert "Merge branch 'trunk' into bookmarkissue"
OLFDB Dec 26, 2023
8a3fa0d
Fixes for testcases
OLFDB Dec 26, 2023
cf5587b
Fix for testcases
OLFDB Dec 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Current vehicle position from gpsd or directly from NMEA (GPS) sensors. \
Optimal routes and directions spoken in 70+ languages. \
Points of interest (POIs) in many formats.

Help and more info available on [the wiki](https://navit.readthedocs.io/en/v0.5.6/). \
Help and more info available on [the wiki](https://wiki.navit-project.org/index.php/Main_Page). \
The [Reporting Bugs](http://wiki.navit-project.org/index.php/Reporting_Bugs) document helps you file issues.

Maps
Expand Down
136 changes: 136 additions & 0 deletions docs/configuration/coordinates.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
Coordinates in Navit
====================

Various parts of Navit will read geographical coordinates provided as
text:

- the `textfile <https://wiki.navit-project.org/index.php/Textfile>`__
map format

- the "center=" attribute in the configuration file

- some Navit commands (e.g. set_position), which can be invoked via
the `internal
GUI <https://wiki.navit-project.org/index.php/Internal_GUI>`__ or the
`Dbus <https://wiki.navit-project.org/index.php/Dbus>`__ bindings

- the files for bookmarks and last map position (bookmarks.txt and
center.txt)

This page documents the coordinate systems and formats that Navit will
accept.

Supported coordinate systems and formats
========================================

.. _longitude--latitude-in-decimal-degrees:

Longitude / Latitude in decimal degrees
---------------------------------------

Longitude / latitude in degrees can be specified as signed decimal
fractions:

.. code::

-33.3553 6.334

That would be about 33° West, 6° North. Note that in this format
longitude comes first. The coordinates are assumed to be based on WGS84
(the coordinate system used by the GPS system, and by practically all
common navigation systems).

.. _latitude--longitude-in-degrees-and-minutes:

Latitude / Longitude in degrees and minutes
-------------------------------------------

Latitude / Longitude can also be specified in degress and minutes with
compass directions (N/S, E/W):

.. code::

4808 N 1134 E

Latitude and longitude are multiplied by 100, so the position above
corresponds to 48°8' N, 11°34' (Munich).

For greater precision you can write the minutes as decimal fractions:

.. code::

4808.2356 N 1134.5252 E

That is 48°8.2356' N 11°34.5252' E, the center of the Marienplatz in
Munich.

Notes:

- This format is rather unusual (because it uses arcminutes, but not
arcseconds). It is probably easier to just use decimal fractions of
degrees.

- The spaces are relevant for parsing. Use exactly one space between
the number and the letter N/S/E/W.

Cartesian coordinates
---------------------

Internally, Navit uses a cartesian coordinate system induced by a
Mercator projection. Coordinates are written as hexadecimal integers:

.. code::

0x13a3d7 0x5d6d6d

or specifying a projection:

.. code::

mg: 0x13a3d7 0x5d6d6d

That is again 48°8.2356' N 11°34.5252' E. The part up to and including
the colon is optional, it names the projection to use. Possible values:

- mg - the projection used by Map&Guide (the default)

- garmin - "Garmin" projection (TODO: When would it be useful?)
Copy link
Contributor

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 format is used internally by Navit, but is probably not very useful
for other purposes.

Google Maps Format
Copy link
Contributor

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
Copy link
Contributor

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)?


That is again 48°8.2356' N 11°34.5252' E. The values are comma
separated. You can pick such values from Google Maps with right click on
a location and then click on the coordinate in the context menu. This is
useful when planning a route online by creating a waypoint file.

UTM coordinates
---------------

Navit can read coordinates in the `Universal Transverse Mercator
coordinate
system <http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system>`__
(UTM).

.. code::

utm32U: 674499.306 5328063.675

.. code::

utmref32UPU:74499.306 28063.675

Development notes
=================

The coordinates are parsed in function coord_parse() in coord.c. This
code is used everywhere where Navit parses coordinates, except for the
manual coordinate input in the Internal GUI (which uses its own format
and parsing function).
2 changes: 1 addition & 1 deletion docs/configuration/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ On Navit's very first startup, it needs a **center** to look at on the map. By d

center="11.5666 48.1333"

Coordinates can be written in different formats; see [[Coordinate_format]] for the full list.
Coordinates can be written in different formats; see :doc:`coordinates` for the full list.
To determine a specific latitude and longitude for your location you can use http://itouchmap.com/latlong.html.
Usually, changing the "center" setting is not necessary, since it is only used during the first start.
On subsequent starts, Navit will remember the last map position (stored in "center.txt") and ignore the "center" setting.
Expand Down
23 changes: 22 additions & 1 deletion navit/attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,28 @@ extern "C" {

enum item_type;

#include "attr_type_def.h"
/**
* Attribute type values, created using macro magic.
*/
enum attr_type {
#define ATTR2(x,y) attr_##y=x,
#define ATTR(x) attr_##x,

/* Special macro for unused attribute types. Creates a placeholder entry
* in the enum so the following values do not change. */
#define ATTR_UNUSED ATTR_UNUSED_L(__LINE__)
#define ATTR_UNUSED_L(x) ATTR_UNUSED_WITH_LINE_NUMBER(x)
#define ATTR_UNUSED_WITH_LINE_NUMBER(x) ATTR_UNUSED_##x,

#include "attr_def.h"

#undef ATTR_UNUSED_WITH_LINE_NUMBER
#undef ATTR_UNUSED_L
#undef ATTR_UNUSED

#undef ATTR2
#undef ATTR
};

enum attr_format {
attr_format_default=0,
Expand Down
37 changes: 0 additions & 37 deletions navit/attr_type_def.h

This file was deleted.

Loading