Table of Contents
Understanding JOSM Coordinates
Openstreetmap uses Latitude/Longitude coordinates in the WGS84 geodetic datum (being compatible with GPS) for its nodes, stored in decimal degree notation with 7 decimal places in the .osm XML files.
The same spot on earth would have slightly different Latitude/Longitude values in other coordinate systems, depending on the respective reference ellipsoid and reference points being used.
To render nodes and ways on the rectangular, flat computer screen, the location of the nodes needs to be reversibly mapped into a cartesian coordinate system, i.e. having perpendicular axes. JOSM uses the Java 2D graphics API to take care of the rendering process. The Java API implements the concept of a user space that could be understood as a large canvas with an origin (0,0) in the top left corner, and virtually infinite extension to the right (x) and down (y). Java 2D supports both integers and single or double precision float variables for the (x,y) pair.
When displaying an area from this virtual canvas to the limited device space, the screen window in this case, Java internally converts these (x,y) coordinates to screen coordinates, automatically during rendering.
Although negative coordinates, going left of or above the (0,0) origin, are theoretically possible, it is not recommended to draw outside of the available screen space, as not all Java version work reliably with points outside of the visible area.
east() returns the x and north() returns the y coordinate.
This means that the numerical value of east() increases towards East, while the value of north() decreases towards North.
The class also provides some methods for manipulating the coordinates.
The reversible mapping from LatLon coordinates to a flat map or the flat computer screen is a projection. JOSM supports a number of different projections because they have different use cases, in particular in the representation of shapes or the usage of different source material which comes already projected, such as printed maps, land registry data, satellite imagery, WMS servers, etc. to be traced over. Some WMS servers may support a variety of projections on request, others are limited to a specific one.
The projections are defined in classes in org.openstreetmap.josm.data.projection.
Using JOSM, the projection can be switched in the Preferences menu. Current versions of JOSM support switching without restart.
When switching projection, the same LatLon coordinate becomes represented as different numerical values of EastNorth.
The bidirectional conversion between LatLon and EastNorth is the core calculation of each implementation of the class Projection. The implementation needs to take care that the valid range of LatLon values is mapped to a valid range of EastNorth values.
Since some projections are valid only for certain regions of the earth, the implementation can also define boundaries in which JOSM can edit, i.e. pan the device window over the user space.
Some use cases for projections supported in JOSM are summarised below.
The cylindrical Mercator projection, named after its inventor, maps meridians and parallels straight and perpendicular.
In JOSM, e.g. small round objects such as roundabouts appear as a circle, and rectangular buildings are seen rectangular.
Disadvantage is the stretching of the poles to infinity.
Currently Mercator is the standard projection in JOSM.
Most WMS servers don't support this projection, but JOSM does display EPSG:4326 data also for Mercator projection (which is not completely correct, but the resulting errors are small in the current version of the software).
EPSG:4326 is a common Lat/Lon coordinate reference system that refers to WGS84.
(discuss need for WMS servers / Landsat and Yahoo Sat usage)
The Transverse Mercator projection is an adaptation of the Mercator projection, rotating the cylinder 90°.
The Universal Transverse Mercator (UTM) with its 60 zones, as well as a number of national grid reference systems, are based on this projection.
Within UTM zones or the national grid systems, a reference of 2-dimensional cartesian coordinates can be defined, typically given in Eastings and Northings as a meter value from a particular point of origin. These Eastings and Northings must not be confused with the EastNorth coordinate within JOSM.
Many countries specify their own reference systems, some based on Transverse Mercator, some not.
In general, JOSM can support any of these systems as soon as the LatLon to EastNorth conversion has been implemented.
It is planned to have support for PROJ4 library as plugin, which supports lots of transformations.