-
-
Notifications
You must be signed in to change notification settings - Fork 295
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
Jupyter: Interactive display #1684
Conversation
…into interactive-display
|
This is just a draft (it doesn't allow the display of vectors at all yet!) but I wanted to open a PR so we could discuss and I could have some feedback. One of the issues I'm working on is figuring out the best way to pass raster/vector data between GRASS and folium. In this first draft, a PNG of the raster is written by GRASS then overlayed on a map in folium. But, I think folium only takes certain projections (WGS84), so I reproject the bounding box of the region and stretch the PNG into the box when it's overlayed. Thoughts and feedback welcome. |
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.
Leaving aside the issue of reprojection for now, the image size does not correspond to the region. The region is fitted into the image, but the image contains whitespace on the sides which is outside of the computational region (in other context, it could be used e.g. for legend). However, to georeference the image, it needs to actually exactly fit the region, so the ratio needs to be the same. See for example of the this procedure:
https://github.com/ncsu-geoforall-lab/grass-web-publishing
You can test the basic fit with the base map using:
gs.run_command("v.to.rast", input="roadsmajor", output="roadsmajor", use="val")
spm_map.d_rast("roadsmajor")
spm_map.show_interactively(opacity=0.7)
|
These changes are in PR #1710. |
This PR contains interactive functions for displaying GRASS maps in Jupyter Notebooks using folium. It is part of an ongoing Google Summer of Code project, Improved Integration of GRASS and Jupyter Notebooks. You can find more information here.
The functions can also be tried in this Jupyter Notebook:
https://mybinder.org/v2/gh/chaedri/grass/interactive-display?urlpath=lab%2Ftree%2Fdoc%2Fnotebooks%2Fjupyter_integration.ipynb