Closed dcooley closed 10 months ago
E.g, in this example the EMPTY LINESTRING is causing the colours of the other geometries to all be the same.
EMPTY LINESTRING
The work-around is to use sf[ !sf::st_is_empty(sf), ]
sf[ !sf::st_is_empty(sf), ]
sf <- structure(list(geometry = structure(list(structure(numeric(0), .Dim = c(0L, 2L), class = c("XY", "LINESTRING", "sfg")), structure(c(145.731228751551, 145.731231586859, 145.731204355808, 145.731206786105, 145.731179150066, -41.4328998049569, -41.4327542176547, -41.4327331146412, -41.4326083255228, -41.4326080206904), .Dim = c(5L, 2L), class = c("XY", "LINESTRING", "sfg"))), class = c("sfc_LINESTRING", "sfc"), precision = 0, bbox = structure(c(xmin = 145.731179150066, ymin = -41.4328998049569, xmax = 145.731231586859, ymax = -41.4326080206904 ), class = "bbox"), crs = structure(list(input = "EPSG:4326", wkt = "GEOGCRS[\"WGS 84\",\n ENSEMBLE[\"World Geodetic System 1984 ensemble\",\n MEMBER[\"World Geodetic System 1984 (Transit)\"],\n MEMBER[\"World Geodetic System 1984 (G730)\"],\n MEMBER[\"World Geodetic System 1984 (G873)\"],\n MEMBER[\"World Geodetic System 1984 (G1150)\"],\n MEMBER[\"World Geodetic System 1984 (G1674)\"],\n MEMBER[\"World Geodetic System 1984 (G1762)\"],\n MEMBER[\"World Geodetic System 1984 (G2139)\"],\n ELLIPSOID[\"WGS 84\",6378137,298.257223563,\n LENGTHUNIT[\"metre\",1]],\n ENSEMBLEACCURACY[2.0]],\n PRIMEM[\"Greenwich\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n CS[ellipsoidal,2],\n AXIS[\"geodetic latitude (Lat)\",north,\n ORDER[1],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n AXIS[\"geodetic longitude (Lon)\",east,\n ORDER[2],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n USAGE[\n SCOPE[\"Horizontal component of 3D system.\"],\n AREA[\"World.\"],\n BBOX[-90,-180,90,180]],\n ID[\"EPSG\",4326]]"), class = "crs"), n_empty = 1L), val = c("a", "a")), sf_column = "geometry", agr = structure(c(val = NA_integer_), .Label = c("constant", "aggregate", "identity"), class = "factor"), row.names = 1:2, class = c("sf", "data.frame")) mapdeck() %>% add_path( data = sf#[ !sf::st_is_empty(sf), ] , stroke_colour = "val" , stroke_width = 50 , layer_id = "flights" , legend = TRUE , palette = colourvalues::get_palette("viridis")[1:140,] )
solved in dcooley/interleave/issues/10
E.g, in this example the
EMPTY LINESTRING
is causing the colours of the other geometries to all be the same.The work-around is to use
sf[ !sf::st_is_empty(sf), ]