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

Problem in isochrone_polygon_with_alpha_shape #4

Open
sblandin2018 opened this issue Aug 30, 2021 · 2 comments
Open

Problem in isochrone_polygon_with_alpha_shape #4

sblandin2018 opened this issue Aug 30, 2021 · 2 comments

Comments

@sblandin2018
Copy link

sblandin2018 commented Aug 30, 2021

Hello,

I tried to use isochrone_polygon_with_alpha_shape method but I get a TypeError like the following:

~\AppData\Local\Continuum\anaconda3\envs\ultra-np\lib\site-packages\geonetworkx\tools\isochrones.py in isochrone_polygon_with_alpha_shape(graph, source, limit, weight, alpha_quantile, remove_holes, tolerance)
    204     ego_graph = gnx.extended_ego_graph(graph, source, limit, distance=weight)
    205     edge_as_lines = ego_graph.get_edges_as_line_series()
--> 206     discretized_lines, _ = gnx.discretize_lines(edge_as_lines)
    207     alpha_shape = get_alpha_shape_polygon(discretized_lines, alpha_quantile)
    208     alpha_shape = alpha_shape.buffer(tolerance)

TypeError: discretize_lines() missing 1 required positional argument: 'discretization_tol'

You can reproduce the issue with the following code:

import geonetworkx as gnx
import osmnx as ox
g = ox.get_digraph(ox.graph_from_bbox(45.64890, 45.58723, 8.88880, 8.80244))
gg = gnx.read_geograph_with_coordinates_attributes(g)
gnx.fill_length_attribute(gg)
iso_poly = gnx.isochrone_polygon_with_alpha_shape(gg, 2321989260, 500)

It seems that discretize_lines function needs an additional discretization_tol parameter to work.

@adolmajian
Copy link

Any progress on this issue?

@Calvinssmao
Copy link

Calvinssmao commented Aug 1, 2023

I solve this problem by adding some code into geonetworkx.tools.isochrones.py on line 206-207.

discretization_tol = gnx.readwrite.graph_edges_to_gdf(graph)['length'].max()
discretized_lines, _ = gnx.discretize_lines(edge_as_lines, discretization_tol)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants