The interoperability between Shapely and Jupyter/iPython is nice. I can do cool stuff like create a bunch of geometric shapes and view them in the notebook:
some_nodes = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2]] some_boxes =  some_boxes.append([some_nodes, some_nodes, some_nodes, some_nodes]) some_boxes.append([some_nodes, some_nodes, some_nodes, some_nodes]) from shapely.geometry import MultiPolygon, Polygon MultiPolygon([Polygon(box) for box in some_boxes])
...and Jupyter will show me this:
Now THAT is cool! It has been especially useful to me for quickly viewing and editing, for example, polygons that make up 2D finite element meshes.
Sadly, the images produced are just static SVG graphics; there's no interaction built in. It would be helpful to be able to select a subset of those objects in the image using this same graphical interface in iPython.
More specifically, I'd like to be able to create a list and add some of the displayed polygons to it by, for example, clicking/selecting them, or dragging a lasso/box around them, and also perhaps remove them when clicking a second time.
Since Jupyter is a somewhat sprawling tool with lots of features that I am probably not aware of, I am wondering if there are already existing solutions out there for interaction of this sort in the context of a Jupyter notebook?
UPDATE: It looks like I'm going to have to create something myself. Happily, this tutorial is going to make that a LOT easier.
UPDATE #2: It appears that Bokeh is a library much more suited for this purpose. I believe I am going to abandon the idea of creating custom Jupyter widgets and create an app using Bokeh widgets and interactions instead. Such an app can be used in a Jupyter notebook, but also elsewhere.
UPDATE #3: I ended up using the jupyter widget system anyway. Added my own answer showing a proof of concept.
Bokeh and Plotly are two interactive python visualization libraries with support for spatial data. you can check out some examples (1, 2) to see if this is what you are looking for. This repository contains some very cool examples of 2D and 3D visualizations which you can run right in your jupyter notebook. You can also use GeoPandas and Folium to create fully interactive maps (here is a great tutorial).
- Turn index match statement into Google Script
- How to pass particular color to parent component in Vue.js?
- Listen to all events in Chrome browser
- Prevent browser scroll on HTML5 History popstate
- Best way of combining meshgrid with matrix multiplication in function
- In Kivy, how do I close a Popup using a close button from another class?
- Parsing and arranging text in python
- Check if a string is a date value
- Firebase realtime database not returning any data