Description of the bug
I have done the same over different regions of India and USA, I didn't get this issue untill trying over Banglore... Any thoughts and answers are most welcomed, Thanks!
OSM data (optional)
bbox = [12.8881, 77.5079, 12.9918, 77.6562]
Environment
-
Operating system: Windows 10 pro
-
Python version: 3.7.6
-
OSMnet version: 0.1.5
-
OSMnet required packages versions (optional): pandana 0.4.4, pandas 0.25.3, geopandas 0.6.3
Paste the code that reproduces the issue here:
import pandas as pd, geopandas as gpd
df = pd.DataFrame(
{'id':[1522786113, 2227865111, 309601717, 1513928857, 2220792136, 6455354942],
'Name': ['Neil', 'Nitin', 'Mukesh','Alpha','Beta','Office'],
'Area': ['Valsad', 'Silvasa', 'Daman','Rajkot','Dui','Vapi'],
'lat': [12.956550, 12.950360, 12.912047,12.955546,12.939653,12.928109],
'lon': [77.540640, 77.581135, 77.586969,77.529658,77.542523,77.639337]})
pois = gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df.lon, df.lat))
network = osm.network_from_bbox(bbox[0], bbox[1], bbox[2], bbox[3],network_type='drive')
network=pandana.Network(network[0]["x"],network[0]["y"], network[1]["from"], network[1]["to"],network[1][["distance"]])
lcn = network.low_connectivity_nodes(impedance=1000, count=10, imp_name='distance')
network.precompute(distance + 1)
network.init_pois(num_categories=1, max_dist=distance, max_pois=7)
network.set_pois(category='my_amenity', x_col=pois['lon'], y_col=pois['lat'])
access = network.nearest_pois(distance=distance, category='my_amenity', num_pois=7)
bbox_aspect_ratio = (bbox[2] - bbox[0]) / (bbox[3] - bbox[1])
fig_kwargs = {'facecolor':'w',
'figsize':(15, 15 * bbox_aspect_ratio)}
# keyword arguments to pass for scatter plots
plot_kwargs = {'s':5,
'alpha':0.9,
'cmap':'viridis_r',
'edgecolor':'none'}
n = 1
bmap, fig, ax = network.plot(access[n], bbox=bbox, plot_kwargs=plot_kwargs, fig_kwargs=fig_kwargs)
ax.set_facecolor('k')
ax.set_title('Walking distance (m) to nearest boi around Bangalore-India', fontsize=15)
fig.savefig('images/accessibility.png', dpi=200, bbox_inches='tight')
plt.show()
Paste the error message (if applicable):
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-22-d557c4f5993e> in <module>
1 # plot the distance to the nth nearest amenity
2 n = 1
----> 3 bmap, fig, ax = network.plot(access[n], bbox=bbox, plot_kwargs=plot_kwargs, fig_kwargs=fig_kwargs)
4 ax.set_facecolor('k')
5 ax.set_title('Walking distance (m) to nearest {} around Berkeley/Oakland'.format(amenity), fontsize=15)
~\miniconda3\envs\ox\lib\site-packages\pandana\network.py in plot(self, data, bbox, plot_type, fig_kwargs, bmap_kwargs, plot_kwargs, cbar_kwargs)
457 bmap = Basemap(
458 bbox[1], bbox[0], bbox[3], bbox[2], ax=ax, **bmap_kwargs)
--> 459 bmap.drawcoastlines()
460 bmap.drawmapboundary()
461
~\miniconda3\envs\ox\lib\site-packages\mpl_toolkits\basemap\__init__.py in drawcoastlines(self, linewidth, linestyle, color, antialiased, ax, zorder)
1849 # get current axes instance (if none specified).
1850 ax = ax or self._check_ax()
-> 1851 coastlines = LineCollection(self.coastsegs,antialiaseds=(antialiased,))
1852 coastlines.set_color(color)
1853 coastlines.set_linestyle(linestyle)
~\miniconda3\envs\ox\lib\site-packages\matplotlib\collections.py in __init__(self, segments, linewidths, colors, antialiaseds, linestyles, offsets, transOffset, norm, cmap, pickradius, zorder, facecolors, **kwargs)
1357 **kwargs)
1358
-> 1359 self.set_segments(segments)
1360
1361 def set_segments(self, segments):
~\miniconda3\envs\ox\lib\site-packages\matplotlib\collections.py in set_segments(self, segments)
1372 _segments = self._add_offsets(_segments)
1373
-> 1374 self._paths = [mpath.Path(_seg) for _seg in _segments]
1375 self.stale = True
1376
~\miniconda3\envs\ox\lib\site-packages\matplotlib\collections.py in <listcomp>(.0)
1372 _segments = self._add_offsets(_segments)
1373
-> 1374 self._paths = [mpath.Path(_seg) for _seg in _segments]
1375 self.stale = True
1376
~\miniconda3\envs\ox\lib\site-packages\matplotlib\path.py in __init__(self, vertices, codes, _interpolation_steps, closed, readonly)
128 if vertices.ndim != 2 or vertices.shape[1] != 2:
129 raise ValueError(
--> 130 "'vertices' must be a 2D list or array with shape Nx2")
131
132 if codes is not None:
ValueError: 'vertices' must be a 2D list or array with shape Nx2