Skip to content

Commit

Permalink
Fix underlaying / overlaying features (#1151)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuang11 authored Sep 26, 2023
1 parent 5b4b9e4 commit 6aba047
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hvplot/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,10 @@ def _apply_layers(self, obj):
scale)
else:
feature_obj = feature_obj.opts(scale=scale)
obj = feature_obj * obj
if feature_obj.group in ["Land", "Ocean"]:
obj = feature_obj * obj # Underlay land/ocean
else:
obj = obj * feature_obj # overlay everything else

if self.tiles:
tile_source = 'EsriImagery' if self.tiles == 'ESRI' else self.tiles
Expand Down
5 changes: 5 additions & 0 deletions hvplot/tests/testgeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ def test_plot_with_specific_gv_tile_obj(self):
self.assertEqual(len(plot), 2)
self.assertIsInstance(plot.get(0), gv.element.WMTS)

def test_plot_with_features_properly_overlaid_underlaid(self):
# land should be under, borders should be over
plot = self.df.hvplot.points('x', 'y', features=["land", "borders"])
assert plot.get(0).group == "Land"
assert plot.get(2).group == "Borders"

class TestGeoElements(TestCase):

Expand Down

0 comments on commit 6aba047

Please sign in to comment.