Coder Social home page Coder Social logo

Comments (6)

sablanchard avatar sablanchard commented on July 2, 2024

Hi @SHITIANYU-hue it looks like you do not have the optional package OSMnet installed in order to use that OSM network download function and thats why you have a geodataframe with no geometry column, see the error: modulenotfounderror in the traceback. try installing that package and trying it again. Ill close this issue for now.

from pandana.

eric-gengzhou avatar eric-gengzhou commented on July 2, 2024

I encountered the same error but I do have the OSMnet package installed.

from pandana.

larsschwarz avatar larsschwarz commented on July 2, 2024

Same here.

pandana 0.6.1
osmnet 0.1.6
geopandas 0.11.0

from pandana.

knaaptime avatar knaaptime commented on July 2, 2024

the error originates from osmnet, which pandana uses under the hood. The issue has been fixed upstream, so you can install the dev version of osmnet to get this working until a new release is made over there.

until then you could use osmnx to get the tables you need to input into pandana. Something like this should work

def pdna_network_from_gdf(gdf, network_type='walk'):
    
    graph = ox.graph_from_polygon(gdf.unary_union, network_type=network_type)
    n,e= ox.utils_graph.graph_to_gdfs(graph, geometry=False)
    e = e.reset_index()

    return pdna.Network(edge_from=e['u'], edge_to=e['v'], edge_weights=e[['length']], node_x=n['x'], node_y=n['y'])

from pandana.

larsschwarz avatar larsschwarz commented on July 2, 2024

Thanks @knaaptime, I tried the pdna_network_from_gdf fix together the Pandana example. Removed geometry=False, because it triggers another error (TypeError: graph_to_gdfs() got an unexpected keyword argument 'geometry') which seems due to the Osmnx version I use.

However the lcn = network.low_connectivity_nodes(impedance=1000, count=10, imp_name='distance') from the example then triggers a

line 395, in _imp_name_to_num assert imp_name in self.impedance_names, "An impedance with that name" \AssertionError: An impedance with that namewas not found

error. Guess I'll try the dev version of osmnet instead now.

from pandana.

knaaptime avatar knaaptime commented on July 2, 2024

in the func i gave above the impedance column is "length", so maybe try imp_name='length'

(or you could rename the column from the edge table e=e.rename(columns={'length':'distance'}))

from pandana.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.