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
Projection sometimes required in .opts #366
Comments
Nothing to do with jupyter at all. This is the documented and expected behaviour when using the bokeh backend, which always defaults to Mercator to allow the use of tile sources. |
I suppose it's not clear to me why it can't project it to Mercator though |
Seems like GeoViews should assume data in lon,lat unless specified otherwise, and with the Bokeh backend should project into Web Mercator by default since that's what Bokeh supports. I think this issue came up for someone else recently on gitter or github as well. |
I'm confused, that's exactly what it does now. |
^ Might have been me the other day. I was still pinning down the error at the time I can see how specifying crs in the This is what I expected to work (and it does work locally): |
both are using a bokeh backend |
@philippjfr 's comment made me realize the root of this problem is actually that it can't reproject the data into Mercator. This code:
Produces this warning:
And So my workaround for simply displaying gv elements is to add |
@kcpevey Could you report all your versions? That Polygon reprojects just fine when I try it. |
cartopy 0.17.0 |
Strange, same versions here and this produces no warnings: data = [
(-95.777304976205, 29.70081935868131),
(-95.777131944776, 29.70009523405696),
(-95.780067725666, 29.69971579007273),
(-95.780184253531, 29.70061729352786),
(-95.778716019600, 29.70071746836681),
(-95.777304976205, 29.70081935868131)
]
polys = gv.Polygons([data], crs=ccrs.PlateCarree())
polys_reproj = gv.operation.project(polys, projection=ccrs.GOOGLE_MERCATOR) As an aside, that code is exactly equivalent to: polys = gv.Polygons([data])
polys_reproj = gv.project(polys) |
I know, my local setup is the same and produces no warnings, works like expected. I can't imagine what else it could be. |
Could you export the environment so I can reproduce? |
It turns out this was a problem on our end. We have a complex kubernetes setup and we had a version mismatch that was not immediately apparent. We got it tracked down. Sorry for the confusion! |
Thanks for reporting back! |
I have a local jupyter lab instance where this code works just fine:
Then I have a JupyterHub instance with the same holoviz packages, but the above code produces a warning about the projection being wrong and results in an empty plot.
While projecting a Polygons element from a PlateCarree coordinate reference system (crs) to a Mercator projection none of the projected paths were contained within the bounds specified by the projection.
If I add the projection to
.opts
, e.g.:gv.Polygons([poly], crs=ccrs.PlateCarree()).opts(projection=ccrs.PlateCarree())
it will work properly on JHub. Any idea why the extra projection specification is required for my JHub instance?
geoviews=1.6.4 from conda-forge
The text was updated successfully, but these errors were encountered: