# Is there a better system than latitudes and longitudes? [closed]

I am a student programmer, with very little knowledge of geography and am working with maps for a project, and have to convert latitudes and longitudes to points on a screen (map to pixels).
So my principal problem with the system of latitudes and longitudes is having to specify a hemisphere along with the co-ordinates of a point on a map. Is there a system which provides co-ordinates without having to specify a direction, which is also widely used? And if so, do tools to convert between the two systems exist?
For example something like the left-top corner of a map is given (0,0), and as we go right X increases, and as we go down Y increases.

Thank you!

• Part of the answer depends on how large an area you are trying to display. The distance between longitude lines changes with latitude. There is no perfect general answer to your question because trying to show the whole earth is like peeling a mandarin orange in one piece and then trying to flatten that peel on a table. You don't end up with a nice rectangle, even discounting the fact that the earth isn't a perfect sphere. Many countries or states have their own coordinate systems for working in their areas. – haresfur Jun 22 '17 at 23:08
• You don't just need to know direction, you'll need to know what projection you are using to map 3D points into a 2D viewport. Look into map projections, different ones solve different problems. Look at open source GIS code for transforms. – casey Jun 23 '17 at 0:15
• A particular hemisphere is often specified with the use of a positive or negative number. There is a binary operation that can be used to assign a sign to a number. It is called "two's complement." This may lead you in the right direction. – reevesii Jun 23 '17 at 11:30
• It also depends on how lat & long co-ords are used. Generally, northings are positive numbers & southings are negative numbers. Regarding westings, which are mainly used in the Americas they can be converted to eastings by subtracting them from 360 degrees - thus 40 W is 360-40 = 320 E. This way eastings are always positive. – Fred Jun 23 '17 at 13:11

To answer the question in the title (with another question): better for what?

To answer the questions in the body: there is another system called rectilinear or x-y-z Cartesian coordinates. This system is the same as the 3-d Cartesian coordinates you used in calculus class. The center of the Earth is (0,0,0), and generally the z-direction goes to the poles, while x and y go to the equators at right angles, and towards points specified by whatever datum you are using. For example, the North Pole could be coordinates (0,0,6353000) in meters.

As for tools to do the conversion, you should probably send those kinds of questions to the GIS Stack Exchange. However, since they tend to be snippy when I've asked questions in the past I will tell you how I do it. I use the pyproj package for python, which is a python wrapper around the C Proj4 package.

Pyproj is pretty straight forward to use, but the transformations you want might not be so easy to figure out. The information you want is the EPSG numbers of the transforms. If you are using the common WGS-84 datum, for example, the rectilinear is 'epsg:4978' while the lat-lon is 'epsg:4326'.

A code example follows from a python (3.5) interactive console. To transform the estimated coordinates of the north pole above, we want to go from rectilinear to lat-lon.

>>> import pyproj
>>> rectProj = pyproj.Proj(init='epsg:4978')
>>> latlonProj = pyproj.Proj(init='epsg:4326')
>>> pyproj.transform(rectProj, latlonProj, 0, 0, 6353000)
(0.0, 90.0, -3752.3142451792955)


What we see here is that when we transform from rectilinear to lat-lon, we get a longitude of 0, latitude of 90, and azimuth (or altitude) of -3752.3 meters. So at the North Pole, 4 km below the surface. This altitude difference is due to both the roughness of my estimate and the specifics of the WGS-84 datum. To go the other way from the lat-lon Greenwich Observatory (at 51.478 degrees north, 0 degrees west; azimuth or elevation of 0 meters) we can do:

>>> pyproj.transform(latlonProj, rectProj, 0, 51.478, 0)
(3980563.802812242, 0.0, 4966838.380583356)


We see that 90 degrees north at altitude of zero in WGS-84 corresponds to that (x, y, z) triplet, in meters. Since Greenwich lies on the 'y' coordinate axis in the WGS-84 system, the y coord is zero.

Hope this helps.

Better is first and foremost opinion based so cannot be answered with a conical answer, but, will give it a stab anyway.

First, it is entirely dependent on application. Start with your suggestion of a 0,0 based coordinate system. This is used for many maps. It also has very little to associate it with reality as it is a two dimensional representation for a three dimensional problem. It works, somewhat, but for closer to reality the smaller of area that is being represented. It is "better" potential for reasonable speed surface travel and location applications like driving and walking.

Lat/Long is a navigational representation in three dimensions of a three dimensional situation. It becomes a far better solution for navigation when the curvature of the Earth and movement of the Earth becomes an issue. Long range ballistics, air travel, ocean navigation, etc. These all do not work with a flat 2D representation of a 3D reality, they need spherical coordinates, and that is were lat/long came in. Spheres are generally measured in angles, not lengths. There are other factors in navigation such as the rotation of the Earth, but Lat/Long was the attempt to have a better system for those applications, and it is better. It is not actually what most would consider the best, but it has been around, known and used for a long time so is typically understood well by those who need it. It has drawbacks, like units (degrees, minutes and seconds) are not uniform size.

A truer representation would be a spherical coordinate system, but would this actually be better? It is a true representation in 3D of location, but one that for most people has little to no meaning. Who, for most applications, needs to know their position at any time as described by distance from and angle to the center of the Earth. It is a much better and needed method if say you are building a cyclotron that accelerated particles to a high percentage of the speed of light, but not for applications that most of us will ever consider.

The other answers are correct on the subjectivity of "better." They are also right, in that the answer you may get will depend on your application.

My answer is yes and no.

Yes: There is a way to convert from latitude-longitude coordinates, but it depends on the projections. Python has become my favorite tool for programming and creating plots, especially maps. Specifically the Basemap module. See some examples. Careful reading of the examples show that it can transform latitude and longitude coordinates into X,Y coordinates (in meters): x, y = m(lons, lats).

No: The flaw with such a system is that the Earth is not flat; it is round. Say your point (0,0) is your left-top corner and (R,0) is your right-top corner. They are the same exact (or nearly exact) point, but on a map, they are a distance R away. This is why Greenland and Antarctica look so large on the Mercator projection.