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

fill_colour in add_polygon not correct when stroke_colour is not defined #287

Closed
tim-salabim opened this issue Apr 4, 2020 · 4 comments
Closed
Assignees

Comments

@tim-salabim
Copy link

When using add_polygon and only defining fill_colour the resulting colour seems not correct (should be white).

library(mapdeck)

key = "<my_api_key>"
set_token(key)

sf <- geojsonsf::geojson_sf("https://symbolixau.github.io/data/geojson/SA2_2016_VIC.json")

map = mapdeck(
  token = key
  , style = mapdeck_style('dark')
)

## not white
map %>%
  add_polygon(
    data = sf
    , fill_colour = "#ffffffff"
  )

Screenshot from 2020-04-04 15-40-56

However, when we also define stroke_colour it renders correctly (in white)

## white
map %>%
  add_polygon(
    data = sf
    , fill_colour = "#ffffffff"
    , stroke_colour = "#000000"
  )

Screenshot from 2020-04-04 15-41-46

I realised this behaviour when testing mapview with mapdeck for add_pointcloud. Given that add_pointcloud does not have a stroke_colour argument, I haven't found a way to get the proper colour representation for add_pointcloud.

@tim-salabim tim-salabim changed the title fill_colour in add_polygon not correct when stroke_colour is not defined fill_colour in add_polygon not correct when stroke_colour is not defined Apr 4, 2020
@dcooley dcooley self-assigned this Apr 4, 2020
@dcooley
Copy link
Collaborator

dcooley commented Apr 4, 2020

ok, this is caused by the

const polygonLayer = new deck.PolygonLayer({
  ... 
  extruded: true
  ...
});

When this is set to false, the colour is as it should be.

I can make this work for non-extruded polygons from within R, but I think the colouring issue lies with deck.gl.

I'll make a reprex and post an issue on their github.

@dcooley
Copy link
Collaborator

dcooley commented Apr 4, 2020

It also might have to do with the lighting effects, which I haven't fully explored yet ( #174 )

mapdeck(
	, style = mapdeck_style('dark')
)  %>%
	add_polygon(
		data = sf
		, fill_colour = "#ffffffff"
		#, stroke_colour = "#ffffffff"
		, elevation = 2000
	)

Screen Shot 2020-04-05 at 9 26 43 am

dcooley added a commit that referenced this issue Apr 4, 2020
@dcooley
Copy link
Collaborator

dcooley commented Apr 4, 2020

this commit should solve the imediate issue.

@tim-salabim
Copy link
Author

Thanks for the quick action! From my side, this is solved.

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

No branches or pull requests

2 participants