-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Description
@songololo created a great package called cityseer that has a some degree of overlap with street network stuff we are doing here. It implements centrality analysis using numba, so it is way faster and parallelised. In #346 we started a discussion on possible interface between cityseer and momepy.
cityseer has a very different API and approach so I am not sure to which degree we will be able to use it internally instead of slow networkx algorithms. We should explore that figure out the best way of linking both libraries.
This snippet is able to create cityseer object from momepy-generated graph.
import geopandas
import momepy
import networkx as nx
from cityseer.metrics.networks import NetworkLayerFromNX
edges = geopandas.read_file("/Users/martin/Downloads/network_prg.gpkg")
primal = momepy.gdf_to_nx(edges)
x = {}
y = {}
for node in primal.nodes():
x[node] = node[0]
y[node] = node[1]
nx.set_node_attributes(primal, x, 'x')
nx.set_node_attributes(primal, y, 'y')
for u, v, k, data in primal.edges.data(keys=True):
primal[u][v][k]['geom'] = data["geometry"]
net = NetworkLayerFromNX(primal, distances=[400])songololojGaboardi
Metadata
Metadata
Assignees
Labels
No labels