Skip to content

Commit

Permalink
clearing h3
Browse files Browse the repository at this point in the history
  • Loading branch information
dcooley committed May 16, 2024
1 parent 817b3cd commit bffbca6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions R/map_layer_h3.R
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ add_h3 <- function(
geometry_column <- "hexagon"

## use 'polyline' method because we have strings (cells), not lat/lon coordinates
shape <- rcpp_point_polyline( data, l, geometry_column, "h3_hexagon")
shape <- rcpp_point_polyline( data, l, geometry_column, "h3")

jsfunc <- "add_h3_hexagon"

Expand All @@ -185,5 +185,5 @@ add_h3 <- function(
#' @export
clear_h3_hexagon <- function( map, layer_id = NULL, update_view = TRUE, clear_legend = TRUE) {
layer_id <- layerId(layer_id, "h3")
invoke_method(map, "md_layer_clear", map_type( map ), layer_id, "h3_hexagon", update_view, clear_legend )
invoke_method(map, "md_layer_clear", map_type( map ), layer_id, "h3", update_view, clear_legend )
}
8 changes: 4 additions & 4 deletions inst/htmlwidgets/lib/h3/h3.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function add_h3_hexagon( map_id, map_type, h3_hexagon_data, layer_id, light_sett

const h3Layer = new deck.H3HexagonLayer({
map_id: map_id,
id: 'h3_hexagon-'+layer_id,
id: 'h3-'+layer_id,
data: h3_hexagon_data,
pickable: true,
stroked: true,
Expand All @@ -23,14 +23,14 @@ function add_h3_hexagon( map_id, map_type, h3_hexagon_data, layer_id, light_sett
autoHighlight: auto_highlight,
highlightColor: md_hexToRGBA( highlight_colour ),
onHover: md_update_tooltip,
onClick: info => md_layer_click( map_id, "h3_hexagon", info ),
onClick: info => md_layer_click( map_id, "h3", info ),
transitions: js_transition || {}
});

if( map_type == "google_map") {
md_update_overlay( map_id, 'h3_hexagon-'+layer_id, h3Layer );
md_update_overlay( map_id, 'h3-'+layer_id, h3Layer );
} else {
md_update_layer( map_id, 'h3_hexagon-'+layer_id, h3Layer );
md_update_layer( map_id, 'h3-'+layer_id, h3Layer );
}

if (legend !== false) {
Expand Down
4 changes: 2 additions & 2 deletions src/point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Rcpp::StringVector get_point_legend_colours( std::string layer_name ) {

Rcpp::StringVector point_legend;

if( layer_name == "column" || layer_name == "scatterplot" || layer_name == "h3_hexagon") {
if( layer_name == "column" || layer_name == "scatterplot" || layer_name == "h3") {
point_legend = mapdeck::layer_colours::fill_stroke_legend;
} else if ( layer_name == "pointcloud" ) {
point_legend = mapdeck::layer_colours::fill_legend;
Expand All @@ -70,7 +70,7 @@ std::unordered_map< std::string, std::string > get_point_colours( std::string la

std::unordered_map< std::string, std::string > point_colours;

if( layer_name == "column" || layer_name == "scatterplot" || layer_name == "h3_hexagon" ) {
if( layer_name == "column" || layer_name == "scatterplot" || layer_name == "h3" ) {
point_colours = mapdeck::layer_colours::fill_stroke_colours;
} else if ( layer_name == "pointcloud" ) {
point_colours = mapdeck::layer_colours::fill_colours;
Expand Down

0 comments on commit bffbca6

Please sign in to comment.