# How to use GeoSeries.distance to get the right answer

This is a distance in degrees, the coordinates of your data. I can get this using Pythagoras' theorem from your coordinates:

```
>>> a = [117.454361, 38.8459879]
>>> b = [117.45988, 38.846255]
>>> math.sqrt((a[0]-b[0])**2 + (a[1]-b[1])**2)
0.005525459565494833
```

to get a distance in metres, transform to a metric coordinate system, such as the UTM zone for your data.

Possible help here:

Calculate distance between a coordinate and a county in GeoPandas

```
import geopandas as gpd
from shapely.geometry import Point
geom=[Point(xy) for xy in zip([117.454361,117.459880],[38.8459879,38.846255])]
gdf=gpd.GeoDataFrame(geometry=geom,crs={'init':'epsg:4326'})
gdf.to_crs(epsg=3310,inplace=True)
l=gdf.distance(gdf.shift())
print(l)
```

The result is 479.450134meters.

Pythagoras only works on a flat plane and not an sphere. The distance between two points on the surface of a sphere is found using great-circle distance:

where φ's are latitude and λ's are longitudes. To convert the distance to meter you need to know the radius of the sphere (6371km for Earth) and multiply it by Δσ in radians. Here is a code that does that:

```
def haversine(coord1, coord2):
import math
# Coordinates in decimal degrees (e.g. 2.89078, 12.79797)
lon1, lat1 = coord1
lon2, lat2 = coord2
R = 6371000 # radius of Earth in meters
phi_1 = math.radians(lat1)
phi_2 = math.radians(lat2)
delta_phi = math.radians(lat2 - lat1)
delta_lambda = math.radians(lon2 - lon1)
a = math.sin(delta_phi / 2.0) ** 2 + math.cos(phi_1) * math.cos(phi_2) * math.sin(delta_lambda / 2.0) ** 2
c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a))
meters = R * c # output distance in meters
km = meters / 1000.0 # output distance in kilometers
meters = round(meters)
km = round(km, 3)
print(f"Distance: {meters} m")
print(f"Distance: {km} km")
```

and run it for the coordinates you get 479m.

```
haversine(coord1= (117.454361,38.8459879), coord2= (117.459880,38.846255))
```

The other way to this is to do what @CJ Xu did and convert the coordinates to UTM.