a-b-street / abstr Goto Github PK
View Code? Open in Web Editor NEWGenerate scenario files for A/B Street with the statistical programming language R
Home Page: https://a-b-street.github.io/abstr/
License: Other
Generate scenario files for A/B Street with the statistical programming language R
Home Page: https://a-b-street.github.io/abstr/
License: Other
Ideal command for this:
devtools::check_win_devel()
Heads-up @lucasccdias as discussed today. May be best to put the data in this repo. I can help with that but are you up for a first go? Perhaps based on examples with ~2 and ~20 agents in a single part of the city. I can provide support on getting the data into the package, based on this: https://r-pkgs.org/data.html
I'm hitting this issue when trying to generate a simple scenario. I guess it's a small mistake in my input. However, the error message could certainly be less cryptic:
# Notes for seminar
# Set-up ------------------------------------------------------------------
remotes::install_github("a-b-street/abstr")
#> Using github PAT from envvar GITHUB_PAT
#> Skipping install of 'abstr' from a github remote, the SHA1 (24baec9c) has not changed since last install.
#> Use `force = TRUE` to force installation
library(tidyverse)
library(tmap)
library(pct)
tmap_mode("view")
#> tmap mode set to interactive viewing
sf::sf_use_s2(FALSE)
#> Spherical geometry (s2) switched off
u = "https://github.com/ITSLeeds/TDS/raw/master/messages/leeds-north.geojson"
study_region = sf::read_sf(u)
pct_region = pct::pct_regions[study_region, ]
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> although coordinates are longitude/latitude, st_intersects assumes that they are planar
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
zones_all = pct::get_pct_zones(region = pct_region$region_name, geography = "msoa")
zones = zones_all[study_region, ]
#> although coordinates are longitude/latitude, st_intersects assumes that they are planar
plot(zones$geometry)
plot(study_region$geometry, add = TRUE, lwd = 5)
od_all = pct::get_od()
#> No region provided. Returning national OD data.
#> Rows: 2402201 Columns: 14
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (2): Area of residence, Area of workplace
#> dbl (12): All categories: Method of travel to work, Work mainly at or from h...
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> Rows: 7201 Columns: 6
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (2): MSOA11CD, MSOA11NM
#> dbl (4): BNGEAST, BNGNORTH, LONGITUDE, LATITUDE
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
od_study_region = od_all %>%
filter(geo_code1 %in% zones$geo_code) %>%
filter(geo_code2 %in% zones$geo_code)
nrow(od_study_region) # 254k od pairs
#> [1] 254
sum(od_study_region$all) # 22k
#> [1] 22224
osm_region = osmextract::oe_get(zones, boundary = zones, layer = "multipolygons")
#> although coordinates are longitude/latitude, st_contains assumes that they are planar
#> The input place was matched with West Yorkshire.
#> The chosen file was already detected in the download directory. Skip downloading.
#> Warning: The boundary is composed by more than one features. Selecting the
#> first.
#> Start with the vectortranslate operations on the input file!
#> 0...10...20...30...40...50...60...70...80...90...100 - done.
#> Finished the vectortranslate operations on the input file!
#> Reading layer `multipolygons' from data source
#> `/mnt/57982e2a-2874-4246-a6fe-115c199bc6bd/data/osm/geofabrik_west-yorkshire-latest.gpkg'
#> using driver `GPKG'
#> Simple feature collection with 5365 features and 25 fields
#> Geometry type: MULTIPOLYGON
#> Dimension: XY
#> Bounding box: xmin: -2.173294 ymin: 53.51973 xmax: -1.198814 ymax: 53.96315
#> Geodetic CRS: WGS 84
osm_region %>%
sample_n(100) %>%
qtm()
#> Linking to GEOS 3.10.1, GDAL 3.4.0, PROJ 8.2.0; sf_use_s2() is FALSE
desire_lines = od::od_to_sf(od_study_region, zones)
#> 0 origins with no match in zone ids
#> 0 destinations with no match in zone ids
#> points not in od data removed.
names(desire_lines)
#> [1] "geo_code1" "geo_code2" "all" "from_home"
#> [5] "light_rail" "train" "bus" "taxi"
#> [9] "motorbike" "car_driver" "car_passenger" "bicycle"
#> [13] "foot" "other" "geo_name1" "geo_name2"
#> [17] "la_1" "la_2" "geometry"
names(desire_lines_leeds)
#> [1] "area_of_residence" "area_of_workplace" "all"
#> [4] "home" "metro" "train"
#> [7] "bus" "taxi" "motorcycle"
#> [10] "drive" "passenger" "bicycle"
#> [13] "on_foot" "other" "geometry"
desire_lines = desire_lines %>%
select(geo_code1, geo_code2, Walk = foot, Bike = bicycle, Drive = car_driver, all)
desire_lines_small = desire_lines %>%
filter(geo_code1 != geo_code2) %>%
top_n(n = 10, wt = all)
plot(desire_lines_small)
sum(desire_lines_small$all)
#> [1] 7574
# A/B Street scenario -----------------------------------------------------
ablines = abstr::ab_scenario(od = desire_lines_small, zones = zones,
origin_buildings = osm_region,
destination_buildings = osm_region,
pop_var = "all")
#> Warning in st_centroid.sf(origin_buildings): st_centroid assumes attributes are
#> constant over geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in st_centroid.sf(destination_buildings): st_centroid assumes attributes
#> are constant over geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> 0 origins with no match in zone ids
#> 0 destinations with no match in zone ids
#> points not in od data removed.
#> although coordinates are longitude/latitude, st_intersects assumes that they are planar
#> although coordinates are longitude/latitude, st_intersects assumes that they are planar
#> Error in odc_new[od[[1]] == i, "ox"] <- sj_df$x[sel_sj_o]: replacement has length zero
Created on 2022-03-10 by the reprex package (v2.0.1)
That will get the message across: turn your R data frames into interactive transport simulations! You up for giving this a go @natesheehan ?
Albeit a small 1 hr one, 15th September at midday UK time.
I think one of the GIFs shown in #37 deserve to go into the docs, README being 1st port of call.
So the number of trips in each scenario is the same, further reducing the noisy nature of the examples shown in #7.
Heads-up @natesheehan, after #16 was merged I think the latest version of abstr
will no longer work with ActDev code. No big issue because we can use abstr
0.1.1: https://github.com/a-b-street/abstr/releases/tag/v0.1.1 with
remotes::install_github("a-b-street/abstr", ref = "v0.1.1")
Ideally the codebase of the latest version should work with our codebase but that will require allowing origin and destination zone arguments. The best way to fix that is upstream in ITSLeeds/od#33 I think. Let me know Nathanael/anyone if you fancy a coding challenge, this is a big one so just asking questions and testing things will help here.
URL fixes to make for cran rerelease
A more playful vignette detailing the range of scenarios you can build using abstr
.
Thoughts: it would be nice to have an example not from the UK or US
A big dependency, not sure how big a job it is...
I recently changed the scenario format to remove origin
on the person object, and include origin
on every single trip.
I think it's a simple code change:
Not essential but worth doing, e.g. with
usethis::use_github_release()
After #23 and #75 I'm pretty happy with how this is looking: https://a-b-street.github.io/abstr/articles/activity.html
It shows a simple example of someone travelling from home to work, and then walking for lunch and leisure, and then cycling back home again.
It imports great into A/B Street 🎉
But I think there are a few unfinished things with this vignette, e.g.:
ab_animate()
and ab_interactive()
functions, as discussed with @natesheehan and as touched on here: geocompx/geocompkg#29Currently the package has many dependencies. There are advantages of depending on fewer things so will aim to follow the 'tinyverse' principles: http://www.tinyverse.org/
First package on the hit list: dplyr
which is big, has many sub-dependencies and takes a long time to install.
Rebuild LCID example to show the versatility of abstr
Although these are relatively harmlessly warning of potential issues associated with geographic data on unprojected data they massively detract from the user experience and have no bearing on the operations being undertaken so suggest suppressing them.
Example from the docs:
remotes::install_github("a-b-street/abstr")
#> Using github PAT from envvar GITHUB_PAT
#> Skipping install of 'abstr' from a github remote, the SHA1 (060b8991) has not changed since last install.
#> Use `force = TRUE` to force installation
library(abstr)
dslines = leeds_desire_lines
ablines = ab_scenario(
leeds_houses,
leeds_buildings,
dslines,
leeds_zones,
output_format = "sf"
)
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in ab_scenario(leeds_houses, leeds_buildings, dslines, leeds_zones, :
#> Mismatch between n. trips and population. Check your data
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in ab_scenario(leeds_houses, leeds_buildings, dslines, leeds_zones, :
#> Mismatch between n. trips and population. Check your data
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in ab_scenario(leeds_houses, leeds_buildings, dslines, leeds_zones, :
#> Mismatch between n. trips and population. Check your data
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in ab_scenario(leeds_houses, leeds_buildings, dslines, leeds_zones, :
#> Mismatch between n. trips and population. Check your data
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in ab_scenario(leeds_houses, leeds_buildings, dslines, leeds_zones, :
#> Mismatch between n. trips and population. Check your data
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in ab_scenario(leeds_houses, leeds_buildings, dslines, leeds_zones, :
#> Mismatch between n. trips and population. Check your data
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in ab_scenario(leeds_houses, leeds_buildings, dslines, leeds_zones, :
#> Mismatch between n. trips and population. Check your data
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in ab_scenario(leeds_houses, leeds_buildings, dslines, leeds_zones, :
#> Mismatch between n. trips and population. Check your data
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in ab_scenario(leeds_houses, leeds_buildings, dslines, leeds_zones, :
#> Mismatch between n. trips and population. Check your data
ablines_dutch = ab_scenario(
leeds_houses,
leeds_buildings,
dslines,
leeds_zones,
scenario = "dutch",
output_format = "sf"
)
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in ab_scenario(leeds_houses, leeds_buildings, dslines, leeds_zones, :
#> Mismatch between n. trips and population. Check your data
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sf(.): st_centroid does not give correct centroids for
#> longitude/latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sf(.): st_centroid does not give correct centroids for
#> longitude/latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sf(.): st_centroid does not give correct centroids for
#> longitude/latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in ab_scenario(leeds_houses, leeds_buildings, dslines, leeds_zones, :
#> Mismatch between n. trips and population. Check your data
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in ab_scenario(leeds_houses, leeds_buildings, dslines, leeds_zones, :
#> Mismatch between n. trips and population. Check your data
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sf(.): st_centroid does not give correct centroids for
#> longitude/latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in ab_scenario(leeds_houses, leeds_buildings, dslines, leeds_zones, :
#> Mismatch between n. trips and population. Check your data
#> although coordinates are longitude/latitude, st_within assumes that they are planar
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in st_centroid.sf(.): st_centroid assumes attributes are constant over
#> geometries of x
#> Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
#> of_largest_polygon): st_centroid does not give correct centroids for longitude/
#> latitude data
#> Warning in ab_scenario(leeds_houses, leeds_buildings, dslines, leeds_zones, :
#> Mismatch between n. trips and population. Check your data
library(sf)
#> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 7.0.0
plot(ablines["mode_base"], key.pos = 1, reset = FALSE)
plot(dslines$geometry, lwd = dslines[[3]] / 30, add = TRUE)
plot(leeds_site_area$geometry, add = TRUE)
plot(leeds_buildings$geometry, add = TRUE)
plot(ablines_dutch["mode_dutch"], key.pos = 1)
Created on 2021-02-10 by the reprex package (v1.0.0)
Could be a good starter. Interested in taking a look @natesheehan?
The default place that you go to in the A/B Street sandbox is Montlake and Eastlake. I think it would be cool to have OD data from there in the reproducible demo so it's easy to see the translation from geographic desire lines in R/GIS to agents in A/B Street without custom maps like Leeds.
Only question: where to get OD data for the study area?
remotes::install_github("a-b-street/abstr")
#> Using github PAT from envvar GITHUB_PAT
#> Skipping install of 'abstr' from a github remote, the SHA1 (26af649c) has not changed since last install.
#> Use `force = TRUE` to force installation
library(abstr)
ablines = ab_scenario(
leeds_houses,
leeds_buildings,
leeds_desire_lines,
leeds_zones,
output_format = "sf"
)
ab_list = ab_sf_to_json(ablines, mode_column = "mode_base")
#> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 7.0.0
ab_list$scenario
#> [1] "base"
ab_list$people$trips[[1]]
#> # A tibble: 1 x 4
#> departure destination$Position$longitude destination$$latitude mode purpose
#> <dbl> <dbl> <dbl> <chr> <chr>
#> 1 30933 -1.57 53.8 Drive Shopping
dutch = ab_scenario(
leeds_houses,
leeds_buildings,
leeds_desire_lines,
leeds_zones,
scenario = "godutch",
output_format = "sf"
)
ab_list = ab_sf_to_json(dutch, mode_column = "mode_godutch")
ab_list$scenario
#> [1] "godutch"
str(ab_list$people$trips[[9]])
#> tibble [1 × 4] (S3: tbl_df/tbl/data.frame)
#> $ departure : num 29288
#> $ destination: tibble [1 × 1] (S3: tbl_df/tbl/data.frame)
#> ..$ Position:'data.frame': 1 obs. of 2 variables:
#> .. ..$ longitude: num -1.56
#> .. ..$ latitude : num 53.8
#> $ mode : chr "Walk"
#> $ purpose : chr "Shopping"
# add times
dutch$departure = ab_time_normal(hr = 1, sd = 0, n = nrow(dutch))
ab_list_times = ab_sf_to_json(dutch)
str(ab_list_times$people$trips[[9]])
#> tibble [1 × 4] (S3: tbl_df/tbl/data.frame)
#> $ departure : num 3600
#> $ destination: tibble [1 × 1] (S3: tbl_df/tbl/data.frame)
#> ..$ Position:'data.frame': 1 obs. of 2 variables:
#> .. ..$ longitude: num -1.56
#> .. ..$ latitude : num 53.8
#> $ mode : NULL
#> $ purpose : chr "Shopping"
Created on 2021-02-25 by the reprex package (v1.0.0)
Discussed today, it would be cool to work through the process of getting this in A/B Street: https://www.pct.bike/m/?r=isle-of-wight
Up for giving it a go, but probably not until late March or early April.
As suggested by Dustin here: #31 (comment)
Currently times are hardcoded: https://github.com/a-b-street/abstr/blob/main/R/ab_scenario.R#L174
Discussed with @Robinlovelace , since the great work by @tnederlof , we should update the README to include the latest example instead of Leeds.
As discussed here: #4
Currently only single desire lines to single trips are supported. You can work around this by creating multiple desire lines but would be good to be able to represent a full day of activity, e.g. home -> work -> lunch in a cafe -> work -> home in an sf
-> json
object. Not sure best way of implementing it but sure it's possible.
This could help generate useful error messages and reduce the chances of the package outputting incorrect results due to incorrect input data. See https://github.com/mllg/checkmate for details.
I see this as a nice to have rather than essential and time may be better spent on creating a formal class system for OD data as per ITSLeeds/od#20
As a followup to #19, we need to regenerate the scenario JSON files for actdev -- https://github.com/cyipt/actdev/blob/main/data-small/allerton-bywater/scenario_base.json and the others. Wasn't sure whether to file that issue here or in the actdev repo. Until then, the base & go active scenarios in A/B Street will disappear, because I also made an internal binary format change that requires me to regenerate from the actdev repo's JSON. (This won't affect the live actdev deployment, of course, but it blocks updating it.)
Heads-up @dabreegster, we have a working package!
Not ready yet but shouldn't take too much work and I'm up for porting it when it gets to a point that it could be useful for others.
From CRAN checks:
Non-standard file/directory found at top level:
'montlake_scenarios.json'
Solution:
file.remove("montlake_scenarios.json
or similar...
See comments in #52 for details.
Get abstr released to CRAN 🎉
R CMD check
and fix any issues@Robinlovelace anything else we should add to this checklist?
This seems to be a blocker on #90 https://win-builder.r-project.org/incoming_pretest/abstr_0.4.1_20211125_204344/Windows/00check.log
This issue is effecting cyipt/actdev#177 to rebuild abstreet json file from actdev.
It can be reporduced by the example method :
library(abstr)
ab_scenario_list = ab_scenario(
leeds_houses,
leeds_buildings,
leeds_desire_lines,
leeds_zones,
output_format = "json_list"
)
#> Error in `[.data.frame`(od, c(names(od)[1:2], modes)): undefined columns selected
Created on 2021-07-09 by the reprex package
Heads-up od_disaggregate()
now has the argument max_per_od
rather than the longer and less correct population_per_od
. Should have spent more thinking of argument names when I first came up with that one! See changes here: https://github.com/ITSLeeds/od/pull/36/files
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.