I'm trying to create network for a place where I want to check accessibility of my friends to me.
Importing libraries(all latest versions)
import warnings
warnings.filterwarnings("ignore")
import pandas as pd
from pandana.loaders import osm
import pandana
%pylab inline
from pyproj.crs import CRS
import numpy as np
import osmnx as ox
import networkx as nx
import peartree
import sys, os
import geopandas as gpd
import folium
import rasterio
from pandana.loaders import osm
from shapely.geometry import Point
import mplleaflet as mpll
from osgeo import ogr
from math import ceil, cos, pi
import geocoder
from shapely.geometry import mapping, Polygon, box
import fiona
Creating GeoDataFrame with point geometery and defining CRS
df = pd.DataFrame(
{'Name': ['Neil', 'Nitin', 'Mukesh'],
'Area': ['Valsad', 'Silvasa', 'Daman'],
'lat': [12.994270, 12.976576, 12.900404],
'lon': [77.536782, 77.653850, 77.575158]})
friends= gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df.lon, df.lat))
friends.crs = "EPSG:4326"
Defining methods to create network using pandana
def get_bounds(place_gdf, buffer_fraction):
bounds = emp_place_gdf.unary_union.bounds
x_width = abs(bounds[2] - bounds[0])
y_height = abs(bounds[3] - bounds[1])
minx = bounds[0] - (x_width * buffer_fraction)
miny = bounds[1] + (y_height * buffer_fraction)
maxx = bounds[2] - (x_width * buffer_fraction)
maxy = bounds[3] + (y_height * buffer_fraction)
return(minx, miny, maxx, maxy)
def create_network(frnd_gdf, bounding_increment):
coords = get_bounds(emp_gdf, bounding_increment)
coords = (coords[1],coords[0],coords[3],coords[2])
return(osm.pdna_network_from_bbox(*coords))
Creating network over friends
gdf
G_BOIS = create_network(friends, 0.2)
Please help me with the error and please comment If needed more information