# Distance between two lat/lng-points (geography) on a plane [closed]

I use PostGIS with PostgreSQL to calculate the distance between two places, specified by a latitude and longitude coordinate. The outcome of 18.5 km is what I expect:

``````SELECT ST_DISTANCE(epicenter, house_location)/1000 "distance_in_km"
FROM (
SELECT ST_SetSRID(ST_Point(53.345, 6.672),4326)::geography(point,4326)         epicenter
,      ST_SetSRID(ST_Point(53.2081669, 6.5759146),4326)::geography(point,4326) house_location
) x;
``````

What I want to know is the distance between those two points, without considering the curve of the earth.

My use case: I have a location of an earthquake (epicentre) and a location of a house. I also know the depth of the earthquake, and with Pythagoras I calculate the distance between the house and the hypocenter.

These calculations are Euclidean, but the distance calculation is not. I've heard the difference is minimal, but I want to know for myself what the difference is, how I can calculate it?

I assume both places have the same distance to the earth's center (but if you know how to take that fact into the equation, I would be interested as well).

## closed as too broad by whyzar, mgri, nmtoken, Mapperz♦Jun 22 '17 at 19:40

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Nice question. Anyways, I would say the direct waves of an earthquake will move along the surface, so the distance including the curve will be right to measure wave speed or similar. For non-direct waves it's way more complicated ... – pLumo Jun 22 '17 at 14:21
• Possible duplicate of How to calculate straight line distance from spherical distance – pLumo Jun 22 '17 at 14:35
• The difference is really small: `2×6371×sin(0,5×18,5÷6371) = 18,4999935` (Needed to change Angle Units of Gnome Calculator from Degrees to Radians `Calculator --> Preferences`) – pLumo Jun 22 '17 at 14:49
• How high is the plane? – Jay Cummins Jun 22 '17 at 17:43
• I'm not sure how to make my question less broad... However, it has been answered below. I also think my question is a duplicate... – doekman Jun 26 '17 at 8:24

You can measure the euclidean distance as described in this answer.

In your case, you can directly calculate it in PostGIS like this:

``````SELECT 2*6371*sin(0.5*(ST_DISTANCE(epicenter, house_location)/1000)/6371) direct_distance_in_km
FROM (
SELECT ST_SetSRID(ST_Point(53.345, 6.672),4326)::geography(point,4326) epicenter,
ST_SetSRID(ST_Point(53.2081669, 6.5759146),4326)::geography(point,4326) house_location
) x;

direct_distance_in_km
------------------
18.4999935003692
(1 row)
``````