Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14011

Subdividing streets with interpolate points function

$
0
0

I want to subdivide streets by maximum distance as described in this question and response. My problem is that I do not understand the "Interpolate Points" function output.

My current code is:

# Imports!pip install osmnximport osmnx as oximport networkx as nx# Enter the place name you want to search# Find accepted names at https://nominatim.openstreetmap.org/ui/search.html?q=Loop%2C+Chicago%2C+Illinoisplace_name = "Macon, Macon County, Illinois, United States"# Generate a graph of pedestrian circulation in nodes and edgesgraph = ox.graph_from_place(place_name, network_type="walk")fig, ax = ox.plot_graph(graph)# Interpolate every 10 metersmultiline_r = ox.utils_geo.interpolate_points(graph, 10)display(multiline_r)

And it gives me a strange output type called "generator" that cannot be transformed into a graph. I have also tried feeding the interpolate points function individual line segments and it gives me this same value. I was expecting some sort of output that I could build into a graph, for example a list of points.

In short, does anybody have a more detailed explanation for implementing the "Interpolate Points" function described in the previous post?

Edit: thanks to feedback got the solution

lst = [] # initiallize emtpy listfor i in range(len(geometry_list)): # iterate over geometry list    temp_lst = list(ox.utils_geo.interpolate_points(geometry_list[i], 10))    lst.append(temp_lst)

Viewing all articles
Browse latest Browse all 14011

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>