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.

6
  • 6
    How about the old fashioned distance formula? √[(x₂ - x₁)² + (y₂ - y₁)²]
    – Pointdump
    Commented Jan 6, 2023 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? Commented Jan 6, 2023 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
    Commented Jan 6, 2023 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
    Commented Jan 6, 2023 at 13:10
  • 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
    Commented Jan 6, 2023 at 13:31

0

Browse other questions tagged or ask your own question.