Skip to content

Commit

Permalink
text elevation #392
Browse files Browse the repository at this point in the history
  • Loading branch information
dcooley committed Nov 25, 2024
1 parent 3d2d5ab commit 72c7985
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# v0.3.6

* `add_text()` gets `elevation` argument for when using a `data.frame`
* `map_click` event added to shiny - e.g. `observeEvent({input$map_click})`

# v0.3.5
Expand Down
4 changes: 3 additions & 1 deletion R/map_layer_text.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ add_text <- function(
text,
lon = NULL,
lat = NULL,
elevation = NULL,
polyline = NULL,
fill_colour = NULL,
fill_opacity = NULL,
Expand Down Expand Up @@ -120,6 +121,7 @@ add_text <- function(
l <- list()
l[["lon"]] <- force( lon )
l[["lat"]] <- force( lat )
l[["elevation"]] <- force( elevation )
l[["fill_colour"]] <- force( fill_colour )
l[["fill_opacity"]] <- resolve_opacity( fill_opacity )
l[["size"]] <- force( size )
Expand Down Expand Up @@ -168,7 +170,7 @@ add_text <- function(
geometry_column <- c( "geometry" )
shape <- rcpp_text_geojson( data, l, geometry_column, digits )
} else if ( tp == "df" ) {
geometry_column <- list( geometry = c("lon", "lat") )
geometry_column <- list( geometry = c("lon", "lat", "elevation") )
shape <- rcpp_text_geojson_df( data, l, geometry_column, digits )
} else if ( tp == "sfencoded" ) {
geometry_column <- "polyline"
Expand Down
2 changes: 2 additions & 0 deletions src/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

Rcpp::List text_defaults(int n) {
return Rcpp::List::create(
_["elevation"] = mapdeck::defaults::default_elevation(n),
_["fill_colour"] = mapdeck::defaults::default_fill_colour(n),
_["anchor"] = mapdeck::defaults::default_text_anchor(n),
_["angle"] = mapdeck::defaults::default_angle(n),
Expand Down Expand Up @@ -71,6 +72,7 @@ Rcpp::List rcpp_text_geojson_df(
parameter_exclusions,
geometry_columns,
true, // jsonify legend
true, // elevation
digits
);
}
Expand Down

0 comments on commit 72c7985

Please sign in to comment.