In [1]:
sc
Out[1]:
In [2]:
from shapely.geometry import Point
import pyproj
import geopandas as gpd
proj = pyproj.Proj(init='epsg:2263', preserve_units=True)
entr_points = sqlContext.read.load('../why_yellow_taxi/Data/2016_(May)_New_York_City_Subway_Station_Entrances.json', \
format='json', header=True, inferSchema=True).collect()[0].asDict()['features']
routes = ['route_'+str(i) for i in range(1,12)]
entr_geo = gpd.GeoDataFrame(columns=['geometry', 'lines'])
for i in range(len(entr_points)):
entr_coor = entr_points[i].asDict()['geometry'].asDict()['coordinates']
entr_buffer = Point(proj(float(entr_coor[0]), float(entr_coor[1]))).buffer(100)
entr_prop = entr_points[i].asDict()['properties'].asDict()
entr_lines = [entr_prop[r] for r in routes if entr_prop[r]]
entr_geo = entr_geo.append({'geometry':entr_buffer, 'lines':entr_lines}, ignore_index=True)
In [3]:
shp = gpd.read_file('../why_yellow_taxi/Buffer/entr_buffer_100_feet_epsg4269_nad83/entr_buffer_100_feet_epsg4269_nad83.shp')
In [4]:
entr_geo.head(2)
Out[4]:
In [5]:
shp.head(2)
Out[5]:
In [6]:
entr_geo.head(2).geometry[1] == shp.head(2).geometry[1]
Out[6]:
In [7]:
shp.head(2).geometry[0].centroid.x
Out[7]:
In [8]:
shp.head(2).geometry[0].centroid.y
Out[8]:
In [9]:
entr_geo.head(2).geometry[0].centroid.x
Out[9]:
In [10]:
entr_geo.head(2).geometry[0].centroid.y
Out[10]: