1

I receive some distance differences in degrees, like this:

0.0009698680322606666

using this function:

def radius(gpd_df, cpt, radius):
    sindex = gpd_df.sindex

    bbox = (cpt.geometry.x-radius, 
            cpt.geometry.y-radius, 
            cpt.geometry.x+radius, 
            cpt.geometry.y+radius)

    good = []
    for n in sindex.intersection(bbox):
        dist = cpt.geometry.distance(gpd_df['geometry'][n])
        if dist<radius:
            good.append((dist,n))

    good.sort() 

    return [x for x in good]

How do I transform that distance into meters in Python?

4
  • 3
    The distance between points on earth depends on latitude and longitude. You can't just take distance in degrees and transform it to meters. – Comrade Che Nov 1 '19 at 12:25
  • 2
    Not without a lot of calculation and knowing the start- and endpoint of the distance measured. 1 degree at the equator is about 110 km from east to west, while at the polar circle it's only 39 km. – Erik Nov 1 '19 at 12:25
  • @erick see my edited question – Dervin Thunk Nov 1 '19 at 12:33
  • 1
    Cartesian degrees are useless. If the units are angular, you need a geodesic function (or an approximation, like haversine) to compute distance in linear units. Fortunately, there are a number of such tools. – Vince Nov 1 '19 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.