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

Add Neighborhood region type #153

Open
shansen5 opened this issue Jan 23, 2025 · 2 comments
Open

Add Neighborhood region type #153

shansen5 opened this issue Jan 23, 2025 · 2 comments

Comments

@shansen5
Copy link
Collaborator

Let the user select a polygon "neighborhood" from a map, and use that as the region of analysis.

@ericnost
Copy link
Member

It occurs to me that to do this we'll need to bring in mapping code that allows users to draw.

In the example I shared, we do this with ipyleaflet. I don't recall there being a specific reason for using that library vs. the one we use for everything else, folium.

Either way, we'd probably want to back-end the code that enables drawing.

That means adding something like this to utilities.py:

def draw():
  from folium.plugins import Draw # see https://python-visualization.github.io/folium/latest/user_guide/plugins/draw.html
  ...
  m = folium.Map()

  Draw(export=True).add_to(m)

  return m

Then in the notebook:

from ECHO_modules.utilities import draw
m = draw()
m

Next cell:

coords = m.shapes.pop() # something like that
program.store_results( region_type="Neighborhood",
                            region_value=coords )

I think it's more complicated than that because of the need to "handle" the shapes users draw (this may be why I was testing with ipyleaflet rather than folium).

@ericnost
Copy link
Member

Yes, way ahead of me! edgi-govdata-archiving/ECHO_modules#87

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

2 participants