Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/osmnx import #64

Merged
merged 9 commits into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions dhnx/input_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def download_street_network(self):
print('Downloading street network...')

graph = ox.graph_from_point(
center_point=self.place, distance=self.distance
center_point=self.place, dist=self.distance
)

graph = ox.project_graph(graph)
Expand All @@ -206,8 +206,10 @@ def download_footprints(self):

print('Downloading footprints...')

footprints = ox.footprints.footprints_from_point(
point=self.place, distance=self.distance
footprints = ox.geometries_from_point(
center_point=self.place,
dist=self.distance,
tags={'building': True},
)

footprints = footprints.drop(labels='nodes', axis=1)
Expand Down Expand Up @@ -268,7 +270,7 @@ def graph_to_gdfs(G, nodes=True, edges=True, node_geometry=True, fill_edge_geome
axis=1)
gdf_nodes.set_geometry('geometry', inplace=True)
gdf_nodes.crs = G.graph['crs']
gdf_nodes.gdf_name = '{}_nodes'.format(G.graph['name'])
gdf_nodes.gdf_name = '{}_nodes'.format(G.name)

to_return.append(gdf_nodes)

Expand Down Expand Up @@ -300,7 +302,7 @@ def graph_to_gdfs(G, nodes=True, edges=True, node_geometry=True, fill_edge_geome
# create a GeoDataFrame from the list of edges and set the CRS
gdf_edges = gpd.GeoDataFrame(edges)
gdf_edges.crs = G.graph['crs']
gdf_edges.gdf_name = '{}_edges'.format(G.graph['name'])
gdf_edges.gdf_name = '{}_edges'.format(G.name)

to_return.append(gdf_edges)

Expand Down Expand Up @@ -401,8 +403,6 @@ def load(self):

footprints = self.download_footprints()

footprints = ox.project_gdf(footprints)

component_dfs = self.process(graph, footprints)

self.add_component_data_to_network(component_dfs)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ def read(fname):
extras_require={
'cartopy': ['cartopy'],
'geopandas': ['geopandas'],
'osmnx': ['osmnx'],
'osmnx': ['osmnx >= 0.16.1'],
}
)