You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
currently user specifies a column or a hex string. Need to know if the column is a list, and if so, it's the same length as the number of segments/vertices (or should the colours get recycled?)
If it's a list, spatialwidget will need to return a JSON array of hex strings for the colour.
If it's a list of hex strings, we will assume the list will apply to the segments directly
How do we let the user specify to use the sfc column, and and/or the Z/M attribute?
Maybe we could use a add_segmented_path() function, which will only accept list colours?
FWIW, recent rgl has a meshColor argument, which controls how input colours are recycled - by 'vertices', 'edges', or 'faces'. (face/edge is the same for lines, triangle/edge is distinct). I guess you'd add 'features' - in rgl feature- grouping is effectively stored indirectly as material properties, it's not reliable).
I'm actually writing up more about this now for mesh3d, but thought it might be worth knowing about if you are considering lower level colours.
df_roads<-sfheaders::sf_to_df(mapdeck::roads, fill=TRUE)
## Add a random value for each coordinate## These will become our colours at each vertexdf_roads$random<- sample(0:100, size= nrow(df_roads), replace=TRUE)
## rebuild the sf and include the `random` column as a `list`, so the value ## persists per vertexsf_roads<-sfheaders::sf_linestring(
obj=df_roads
, x="x"
, y="y"
, linestring_id="linestring_id"
, list_columns="random"
, keep=TRUE
)
mapdeck() %>%
add_path(
data=sf_roads
, stroke_colour="random"
, stroke_width=10
)
Some layers can accept a different colour per 'segment' (or vertex for polygon). For example we can have a multi-coloured path (eg ).
(and polygon )
The interleaved example is probably the way to go. (worked on here
mapdeck and/or spatialwidget should support colouring coordinates (or the segments between them
So colouring could
1:n_segments
colourssf
objectZ
orM
component ofsf
objectUse Cases
Implementation ideas
currently user specifies a column or a hex string. Need to know if the column is a list, and if so, it's the same length as the number of segments/vertices (or should the colours get recycled?)
If it's a list,
spatialwidget
will need to return a JSON array of hex strings for the colour.If it's a list of hex strings, we will assume the list will apply to the segments directly
How do we let the user specify to use the
sfc
column, and and/or theZ
/M
attribute?Maybe we could use a
add_segmented_path()
function, which will only accept list colours?TODO
The text was updated successfully, but these errors were encountered: