-
Notifications
You must be signed in to change notification settings - Fork 45
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
Allow custom geojson files in create_map #238
Conversation
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.
@bowguy thanks for this contribution! Overall, I'm in favor of making this kind of change to the create_map function, as I can see how this would be useful.
That said, there are several things about this function that I think could be improved, unrelated to your contribution. You're following the patterns in the function, which is great. But the patterns I wrote many moons ago aren't so great. These are some of the things that give me pause:
- There is no type hinting, which makes it tricky for users to know what to types to pass into this function (this is an issue throughout most of swmmio, to be address under add type hints on all the public functions/methods #240)
- The arguments should follow snake case per PEP8, but only one of them does (the one that isn't even used in the function)
- The arguments should be more consistent with the draw_model function, at least where there is overlap. (e.g. there is a
filename
argument in one and afile_path
argument in the other) 🫠
So, before we make this change, I'd prefer to clean up some of these things. I propose that we do the following:
- sync your branch with the latest in master (this will include a more complete docstring for this function)
- expand the docstring to include these new optional arguments
- add type hints
- refactor the function to use the following arguments and types:
- model : swmmio.Model, optional
- nodes : geopandas.GeoDataFrame or GeoJSON string, optional
- links : geopandas.GeoDataFrame or GeoJSON string, optional
- file_path : string or Path, optional
- basemap : string or Path, optional
What do you think? I'm open to suggestions, I just want to make sure we improving the user experience while we add new features.
I appreciate all your comments on this. Some of my thoughts
Maybe I should cancel my pull request and tackle things one step at a time. Obviously, the documentation will need to be fleshed out. Are you thinking about replacing create_map with a new function? |
Wow I didn't realize that (or forgot). Overall I agree with you that something needs to be tweaked, and I think it makes sense to address the nodes and storage nodes issues separately. I suggest we keep this PR and focus it on
Then separately we can work on the nodes and storages issues you've identified. Is that okay with you?
No, I don't think so. But I am interested in making this functionality available as a method on the core Model object. But that's not a critical issue IMO - something that we can consider separately. |
Closed this due to the confusion. New pull request submitted. |
Add two additional parameters in create_map to allow custom GeoJSON files. Existing examples and usage unchanged.