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

Errors in http://ipython-books.github.io/featured-03/ #37

Open
mattkrems opened this issue Mar 6, 2016 · 0 comments
Open

Errors in http://ipython-books.github.io/featured-03/ #37

mattkrems opened this issue Mar 6, 2016 · 0 comments

Comments

@mattkrems
Copy link

A few issues:
Step 2: make sure to actually use "g = nx.read_shp("data/tl_2013_06_prisecroads.shp", simplify =False)". Without setting simplify to False, grid-like road structures become completely broken graphs. This is extremely important when using open street map data for example.

Step 3: to get the maximally connected subgraph, use the command 'max(nx.connected_component_subgraphs(g.to_undirected()), key=len)'

Step 7: Since the "JSON" coordinates are in the form (lon,lat), you are actually passing the wrong set to the geocalc function. Change to 'return np.sum(geocalc(path[1:,1],path[1:,0],path[:-1,1],path[:-1,0]))'. Surprisingly, the path it finds is nearly the same, and the distance is only a bit different.

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

1 participant