Only this week, get the SQL Complete Track of 9 courses in a special prize of $330 $89!


Okay. Notice that the answer we got in the previous exercise was well below 1. What was the unit? Kilometers? Miles? The answer is: none of these! By default, it is given in degrees.

To explain why, we need to go back to what we said at the beginning of our course: the Earth is a sphere. It's round, so it can't be ideally projected onto a 2D map. That's why the geometry type does not give exact results when calculating lengths of linestrings in meters or miles. In order to even come close to the real result, the geometry type needs a couple pieces of information, such as the type of map projection, the part of the world for which we are performing calculations, and the unit of measure we want to use.

It would be very time-consuming to provide all this necessary information each time we intend to run the function. That is why PostGIS has thousands of ready-made sets of information available. All you need to do is provide the so-called Spatial Reference Identifier, or SRID, which is different depending on what region of the Earth you are considering.

How can you find the right SRID? You can look it up on many websites: