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
Feature/graph analysis ipyleaflet visualisation #47
Feature/graph analysis ipyleaflet visualisation #47
Conversation
…leaflet-visualisation
Add habitat layer selection to widget in GeoGraphViewer. Also includes other minor fixes for GeoGraphViewer
Added because of Jasmin server instability.
Also includes minor fixes: - fix node color - fix node, edge drawing order
…leaflet-visualisation
…sis-ipyleaflet-visualisation
…into feature/graph-analysis-ipyleaflet-visualisation
This factors the GeoGraphViewer control functionality into separate widgets for better readability.
These traits can be used by multiple control widgets to determine their content.
…ture/graph-analysis-ipyleaflet-visualisation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Love it already before reviewing! 😉 😍 |
node_gdf = gpd.GeoDataFrame(columns=["id", "geometry"]) | ||
rep_points = graph.nodes(data="rep_point") | ||
for idx, rep_point in rep_points: | ||
node_gdf.loc[idx] = [idx, rep_point] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since .loc
is quite slow, you should be able to speed this up quite a lot by just initialising the node_gdf
using rep_points
: https://www.geeksforgeeks.org/creating-a-pandas-dataframe-using-list-of-tuples/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I added a performance improvement issue, so I don't forget it in the future. I think the cost of this compared to components is minor, therefore I will focus on other things first.
point_b = rep_points[node_b] | ||
line = shapely.geometry.LineString([point_a, point_b]) | ||
|
||
edge_gdf.loc[idx] = [idx, line] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And similarly here, but you'll need to build the list of tuples in the loop first then make the edge_gdf
from it at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All done, looks good to me! I made some suggestions, a few are minor nitpicks and a couple more are performance improvements. Since time is tight there's no need to resolve those before the deadline if you're too busy.
And fix typo.
Thanks a lot for the review @herbiebradley! Was able to address most points in 42eae9e, and created Issue #50 for the remaining performance improvements, to be dealt with at a later point. |
Introducing
GeoGraphViewer
🎉 ... this PR adds theGeoGraphViewer
visualisation class and a bunch of code that enables it. As theGeoGraphViewer
is a fairly complex widget, this PR is somewhat lengthy, apologies in advance! Thanks a lot for your review!Main changes:
visualisation/*
. The oldmodels/visualisation.py
has been removed.GeoGraphViewer
class (invisualisation/geoviewer.py
): this allows us to visualise GeoGraphs interactively.visualisation/control_widgets.py
): these make up the side control panel seen in demos. See architecture image below for a rough outline how they relate and are added to theGeoGraphViewer
.Other changes:
GeoGraphViewer
. These are invisualisation/widget_utils.py
visualisation/folium_utils.py
(old functions fromvisualisation.py
, no need to review)visualisation/graph_utils.py
(old functions fromvisualisation.py
, no need to review)data_loading/test_data.py
visualisation/style.py
that contains constants defining the plotting style of graph, etc. inGeoGraphViewer
.requirements/dev-requirements.txt
notebooks/exploratory/rdnfn-8-polesia-geographviewer-demo.ipynb
will likely be interesting, which is the demo on the Polesia data. Feel free to use it, it should work with the environment created viamake env
(if you updated it to new requirements)FoliumGeoGraphViewer
class (ingeoviewer.py
)Architecture
GeoGraphViewer demo