Skip to content
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

Elevation property for add_text() #392

Open
Zekiye-VAP opened this issue Oct 17, 2024 · 1 comment
Open

Elevation property for add_text() #392

Zekiye-VAP opened this issue Oct 17, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Zekiye-VAP
Copy link

What do you want the feature to do?
Wondering if it is possible to change the elevation of text added to a map using add_text(). When combined with other layers that do have elevation, the text becomes very hard to read. See image for example of text (A, B, C, D characters) being obscured by elevated polygons.
Screenshot 2024-10-17 115015
Would be great to have a dynamic elevation so the text can sit above other elevated layers.

@Zekiye-VAP Zekiye-VAP added the enhancement New feature or request label Oct 17, 2024
@dcooley
Copy link
Collaborator

dcooley commented Nov 19, 2024

This currently works if your 'text' data is an sf object with a Z attribute:

library(mapdeck)
library(sf)
library(sfheaders)

set_token(secret::get_secret("MAPBOX"))

df <- data.frame(x = 0:5, y = 0:0, z = c(100000, 0, 100000, 0, 100000, 0), label = letters[1:6])

sf <- sfheaders::sf_point(
	obj = df
	, x = "x"
	, y = "y"
	, z = "z"
	, keep = TRUE
)

mapdeck() %>%
	add_text(
		data = sf
		, text = "label"
	)

Screenshot 2024-11-19 at 3 46 21 PM

it needs a bit of work to get the data.frame version working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants