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

Generating Interactive leaflet networks #404

Closed
MunsakaPKM opened this issue Feb 4, 2024 · 7 comments
Closed

Generating Interactive leaflet networks #404

MunsakaPKM opened this issue Feb 4, 2024 · 7 comments
Assignees
Labels

Comments

@MunsakaPKM
Copy link

MunsakaPKM commented Feb 4, 2024

I am struggling with generating leaflet networks, I guess it requires some certain knowledge about folium and UTM that i don't have or maybe a certain environment for running the code. How can I generate this using desktop compiler, I am aware of the example given in the documentation(Graphics) but it is not working for me because I am failing to complete it and make it run. Please help, thank you !

Example

longlat_map = {'Lake':(-106.6851, 35.1344), '219': (-106.5073, 35.0713)}
wn2 = wntr.morph.convert_node_coordinates_to_longlat(wn, longlat_map)
length = wn2.query_link_attribute('length')
wntr.graphics.plot_leaflet_network(wn2, link_attribute=length, link_width=3,
... link_range=[0,1000], filename='length.html')

Environment
[Optional] Provide information on your computing environment.

  • Operating system: 10
  • Python version: 3.11
  • WNTR version: Current version
@kaklise kaklise assigned kaklise and kbonney and unassigned kaklise Feb 12, 2024
@kbonney
Copy link
Collaborator

kbonney commented Feb 12, 2024

HI @MunsakaPKM, it looks like you need to load in the water network first before running the code you shared.
Try running this line first:
wn = wntr.network.WaterNetworkModel('networks/Net3.inp')

If that doesn't solve your issue, please share the error you are seeing on your end.

@MunsakaPKM
Copy link
Author

MunsakaPKM commented Feb 14, 2024 via email

@kbonney
Copy link
Collaborator

kbonney commented Feb 14, 2024

@MunsakaPKM, glad you were able to resolve the issue. Saving is the expected behavior.

@MunsakaPKM
Copy link
Author

MunsakaPKM commented Feb 15, 2024 via email

@MunsakaPKM
Copy link
Author

MunsakaPKM commented Feb 16, 2024 via email

@kbonney
Copy link
Collaborator

kbonney commented Feb 16, 2024

@MunsakaPKM, I suspect that this issue has to do with the ordering of the coordinates. WNTR uses (long, lat) as opposed to (lat, long). You can use the convert_node_coordinates_to_longlat to perform this conversion for you. Alternatively, if your coordinates are already in (lat, long) you can just write a for loop that swaps the ordering manually.

@MunsakaPKM
Copy link
Author

MunsakaPKM commented Feb 16, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants