-
Notifications
You must be signed in to change notification settings - Fork 7
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
path data example #1
Comments
@mdsumner @tim-salabim in reality looks like
|
Perfect! We can have mapview methods for space-time data classes now. |
@tim-salabim @mdsumner I pushed
|
Hey thanks! Here's a realistic-ish example with a set of elephant seal tracks, it works nicely - brings up the issue of needing lag-settings, but also shows that short enough segments make for pretty compelling time-continuous approximations. Is Date required? (we can't have POSIXct for start/end) library(sf)
library(trip)
library(leaftime)
## set of elephant seal track data
u <- "https://github.com/Trackage/animal-tracks/raw/master/ellie_IMOS.RDS"
if (!file.exists(basename(u))) curl::curl_download(u, basename(u))
dd <- readRDS(basename(u))
## take a subset
dd <- dplyr::filter(dd, as.Date(date) >= as.Date("2015-01-01"))
## create a trip because ...
tr <- trip(dplyr::select(dd, lon, lat, date, id, lc, trip))
## ...it's the easiest way to bust into segments
dt <- sf::st_as_sf(explode(tr))
bbox <- as.vector(st_bbox(dt))
## rename POSIXct to Date start/end
dt$start <- as.Date(dt$starttime)
dt$end <- as.Date(dt$endtime)
leaflet() %>%
fitBounds(bbox[1],bbox[2],bbox[3],bbox[4]) %>%
addTimeline(
geojsonio::geojson_json(dt),
timelineOpts = timelineOptions(
styleOptions = styleOptions(fillColor = "purple", color = "white")
)
)
FWIW, in terms of time-continuous, and controlling lag with a time-slider the best I've seen is KML in GE, you can do that with the #trip::write_track_kml(tr, kml_file= "my_file.kmz") Then open that in GE (it doesn't work in he browser). The time slider pops up with play, and lag, and speed etc. |
@timelyportfolio First want to say this is an awesome package! But I wanted to ask whether it is possible to have 2 timelines in one map, eg points and polygons, operating at the same time scale? The goal is just to have my polygons, that are already plotted to begin with, change colors at certain dates, while the points are moving around in the normal timeline manner. UPDATE: After some digging, this may involve the onchange argument. |
@gabezuckerman yes, this is possible, and now I just need to find a little bit of time to demonstrate. Sorry for the delay and thanks for the interest and use of |
@timelyportfolio thanks for getting back to me! Looking forward to seeing the demonstration when you get the chance. |
@gabezuckerman this became way more complicated than I intended. Please let me know if you would like me to explain or clarify any of this code.
|
@timelyportfolio This works great when using mapview. However, I have a shiny app in which I am using a leaflet based map. When I change this
to this
the play button no longer works, the colors of the polygon don't change, and when I slide the slider only the dots move. This may be from my lack of understanding the nuances of the array bisection in the on change function. Thanks again for the help! |
@gabezuckerman Sorry, I should have taken a little more time to explain.
|
Hi, I would like to know why the [1:224] is needed. Is there any way to show more possible positions for the slider? |
After some Twitter feedback, I thought an example with path data might be helpful.
... but I discovered that we lose most ability to customize with path data. For instance, we can no longer control styling of the path.
The text was updated successfully, but these errors were encountered: