holoviz-topics / EarthSim

Tools for working with and visualizing environmental simulations.
https://earthsim.holoviz.org
BSD 3-Clause "New" or "Revised" License
65 stars 21 forks source link

Using polygons or paths in the annotators #287

Closed kcpevey closed 5 years ago

kcpevey commented 5 years ago

We can specify an annotator like this:

sample_poly=dict(
    Longitude = [-10114986, -10123906, -10130333, -10121522, -10129889, -10122959],
    Latitude  = [  3806790,   3812413,   3807530,   3805407,   3798394,   3796693])

gvdata = gv.Polygons(data=[sample_poly], crs=ccrs.GOOGLE_MERCATOR)

annotator = PolyAnnotator(polys=gvdata)
annotator.panel()

This will produce a panel with the map on the left and tabs on the right for the polygon table and the vertex table. The vertex table is the listing of the lat/longs for all the vertices on the polygon. This works as it should.

Now, with the annotators we can easily switch this to paths using gvdata = gv.Path(data=[sample_poly], crs=ccrs.GOOGLE_MERCATOR)
which will properly display paths on the map. However, the vertex table will not populate when a path is selected.

In order to get the table to populate properly, one must use: annotator = PolyAnnotator(path_type=hv.Path, polys=gvdata) to explicitly specify the path_type.

It's quite confusing that path_type is not required for proper map visualization but IS required for table visualization.

philippjfr commented 5 years ago

I can't reproduce this anymore, please reopen if you can @kcpevey.