Function that returns distance information
The ST_Distance function takes two geometries and, optionally, a unit as input parameters and returns the shortest distance between any point in the first geometry to any point in the second geometry, measured in the given units.
If the second geometry is not represented in the same spatial reference system as the first geometry, it will be converted to the other spatial reference system.
If any of the two given geometries is null or is empty, then null is returned.
For example, ST_Distance could report the shortest distance an aircraft must travel between two locations. The following figure illustrates this information.
The figure shows a map of the United States with a straight line between points labeled Los Angeles and Chicago.