# What is the unit of measurement of the distance between two points using geopandas distance function?

I have created three buffers using `geopandas` in `python` and I have a few points scattered here and there, some of them are inside the buffers.But the problem is the following:

1. When I obtain distance between the buffer centers and the points, for those points which are inside the buffer the distance shown here is 0 and for others some value >0. But the problem may arise if we have all these randomly scattered points inside the buffers, then the distance from the center of the buffer to all these points is 0. But in that case you cannot sort the values distance wise (in meters) and find the minimum one?

My code here is thus:

``````    import pandas as pd
import geopandas
import numpy as np
print(us_states.geometry)

from shapely.geometry import Point,Polygon,LineString
import fiona
import shapely
from shapely.geometry import shape

df = pd.DataFrame(
{'City': ['Fargo', 'Orange', 'Jersey City'],
'State': ['North dakota', 'California', 'New Jersey'],
'Latitude': [46.877186 , 33.787914 , 40.728157 ],
'Longitude': [-96.789803, -117.853104, -74.077644]})
df['Coordinates']  = list(zip(df.Longitude, df.Latitude))
df['Coordinates'] = df['Coordinates'].apply(Point)
gdf = geopandas.GeoDataFrame(df, geometry='Coordinates')
gdf_points=gdf

# We restrict to USA.
ax = world[world.name == 'United States'].plot(
color='white', edgecolor='black',figsize=(20,10))
us_states.plot(ax=ax,figsize=(20,10))
gdf.plot(ax=ax, color='red')
ax.set(xlim=(-140,-50),ylim=(0,60))
us_states.crs
gdf.crs= {'+init' :'epsg:4326'}
print(gdf.crs['units'])
us_name = world[world.name=='United States']
gdf['Coordinates']=gdf.buffer(3)
gplot=geopandas.overlay(us_states,gdf,how='identity')
gx=gplot.plot(edgecolor='k', alpha=0.5, cmap='tab10', ax=ax)
gdf.plot(ax=ax)

df1=pd.DataFrame(
{'Points':['Point1','Point2','Point3','Point4','Point5','Point6'],
'Latitude':[44.773491,30.287765,41.279906,45.234565,31.23345,38.778987],
'Longitude':[-94.789323,-114.565309,-72.055234,-93.230988,-112.233456,-72.239989]})
df1['Coordinates']  = list(zip(df1.Longitude, df1.Latitude))
df1['Coordinates'] = df1['Coordinates'].apply(Point)
gdf1 = geopandas.GeoDataFrame(df1, geometry='Coordinates')

gdf1.plot(ax=gx,color='red')
gx.set(xlim=(-140,-50),ylim=(0,60))

#a = Point(-93.230988, 45.234565)
centroid_of_buffers=gdf['Coordinates'].centroid
#dist_a=centroid_of_buffers.distance(a)
#min_dist=centroid_of_buffers.distance(gdf1[gdf1.Coordinates=="POINT (-93.230988 45.234565)"])
gdf_distance_cluster_California=gdf1.distance(gdf['Coordinates'])
gdf_distance_cluster_New_Jersey=gdf1.distance(gdf['Coordinates'])
``````

From here what I can guess is how do I obtain the euclidean distance between the buffer centers and the randomly scattered points ?

You can find the `us_states` dataset from https://www.census.gov/geo/maps-data/data/cbf/cbf_state.html

``````gdf_distance_cluster_Nevada=gdf1['Coordinates'].distance(gdf['Coordinates'].centroid)