1

I have two points and their coordinates (lon and lat) expressed in EPSG:32632. I'd like to calculate the distance between them. In my case, distance is really very small.

I've tried to use Euclidean distance but I'm not sure if it is the correct approach. I've seen other approaches such as Haversine formula.

I need to do this in a Python script.

Vince
  • 20,017
  • 15
  • 45
  • 64
lorenzlorg
  • 11
  • 1
  • 6
    How about the old fashioned distance formula? √[(x₂ - x₁)² + (y₂ - y₁)²] – Pointdump Jan 06 '23 at 11:11
  • 4
    EPSG:32632 is a projected coordinate system and its unit is meter. The coordinates are not expressed as latitude and longitude. How did you get latitude and longitude? – Kadir Şahbaz Jan 06 '23 at 11:16
  • @KadirŞahbaz sorry, you're right. I'm a little confused, I have no experience with these concepts and I'm struggling a bit. So as you suggest, I've x and y and not lat and lon. Considering this and also meter as unit of measure do you think that it make sense using Euclidean distance? – lorenzlorg Jan 06 '23 at 11:31
  • The whole point of using a UTM projection is being able to use Cartesian trigonometry. Note that "x and y" and "lat and lon" are opposite coordinate dimensions (latitude is Y). – Vince Jan 06 '23 at 13:10
  • @Vince so are you saying that since I'm using EPSG:32632, a UTM projection, using Euclidean distance (as a trigonometric concept) could be a good idea? – lorenzlorg Jan 06 '23 at 13:16
  • 1
    Yes, if you have X and Y coordinates in a Cartesian coordinate system that preserves distance (within tolerances), you can use Euclidean distance. Note that Web Mercator (EPSG:3857) does not preserve distance, so just because the units are "meters" does not mean distance calculation is automatically valid. But transverse Mercator projections are valid within their 6-degree zone. – Vince Jan 06 '23 at 13:31

0 Answers0