UrbanAnalyst / gtfsrouter

Routing and analysis engine for GTFS (General Transit Feed Specification) data
https://urbananalyst.github.io/gtfsrouter/
82 stars 17 forks source link

add "include_ids" parameter to gtfs_isochrone (similar to gtfs_route) #29

Closed AlexandraKapp closed 4 years ago

AlexandraKapp commented 4 years ago

add option to return stop_ids with gtfs_isochrone response additionally to the stop names.

mpadge commented 4 years ago

Thanks Alexandra. That commits just adds them all, because they are likely to be generally useful for isochrone analyses:

library(gtfsrouter)
gtfs <- extract_gtfs ("vbb.zip")
gtfs <- gtfs_timetable (gtfs)
#> Day not specified; extracting timetable for Friday
stn <- "Berlin, Rohrdammbrücke"
start_time <- 3600
end_time <- start_time + 600
gtfs_isochrone (gtfs, from = stn, start_time = start_time, end_time = end_time)
#> Loading required namespace: geodist
#> Loading required namespace: lwgeom
#> Registered S3 method overwritten by 'spatstat':
#>   method     from
#>   print.boxx cli
#> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
#> $start_point
#> Simple feature collection with 1 feature and 2 fields
#> geometry type:  POINT
#> dimension:      XY
#> bbox:           xmin: 13.26979 ymin: 52.5285 xmax: 13.26979 ymax: 52.5285
#> geographic CRS: WGS 84
#>                stop_name      stop_id                 geometry
#> 1 Berlin, Rohrdammbrücke 070101000309 POINT (13.26979 52.5285)
#> 
#> $mid_points
#> Simple feature collection with 28 features and 2 fields
#> geometry type:  POINT
#> dimension:      XY
#> bbox:           xmin: 13.27298 ymin: 52.50645 xmax: 13.29137 ymax: 52.52447
#> geographic CRS: WGS 84
#> First 10 features:
#>                                       stop_name      stop_id
#> 1          Berlin, Friedhöfe Fürstenbrunner Weg 070101000310
#> 2                    Berlin, Fürstenbrunner Weg 070101001983
#> 3  Berlin, Königin-Elisabeth-Str/Spandauer Damm 070101000371
#> 4                      Berlin, Knobelsdorffstr. 070101000372
#> 5                         U Kaiserdamm (Berlin) 070101000373
#> 6                         U Kaiserdamm (Berlin) 070201024401
#> 7                 Berlin, U Theodor-Heuss-Platz 070201024501
#> 8          Berlin, Friedhöfe Fürstenbrunner Weg 070101000310
#> 9                    Berlin, Fürstenbrunner Weg 070101001983
#> 10 Berlin, Königin-Elisabeth-Str/Spandauer Damm 070101000371
#>                     geometry
#> 1   POINT (13.2793 52.52447)
#> 2  POINT (13.27993 52.52096)
#> 3   POINT (13.2803 52.51835)
#> 4  POINT (13.28143 52.51283)
#> 5  POINT (13.28169 52.50999)
#> 6  POINT (13.28169 52.50999)
#> 7   POINT (13.27298 52.5098)
#> 8   POINT (13.2793 52.52447)
#> 9  POINT (13.27993 52.52096)
#> 10  POINT (13.2803 52.51835)
#> 
#> $end_points
#> Simple feature collection with 4 features and 2 fields
#> geometry type:  POINT
#> dimension:      XY
#> bbox:           xmin: 13.25991 ymin: 52.50645 xmax: 13.29595 ymax: 52.51926
#> geographic CRS: WGS 84
#>                        stop_name      stop_id                  geometry
#> 1         U Neu-Westend (Berlin) 070201024601 POINT (13.25991 52.51641)
#> 2      Berlin, Kuno-Fischer-Str. 070101000317 POINT (13.28978 52.50661)
#> 3 Berlin, Schloss Charlottenburg 070101002615 POINT (13.29595 52.51926)
#> 4      S Messe Nord/ICC (Berlin) 070101000345 POINT (13.28304 52.50645)
#> 
#> $routes
#> Geometry set for 4 features 
#> geometry type:  LINESTRING
#> dimension:      XY
#> bbox:           xmin: 13.25991 ymin: 52.50645 xmax: 13.29595 ymax: 52.5285
#> geographic CRS: WGS 84
#> LINESTRING (13.28304 52.50645, 13.28978 52.50661)
#> LINESTRING (13.28169 52.50999, 13.27298 52.5098...
#> LINESTRING (13.2803 52.51835, 13.28424 52.51861...
#> LINESTRING (13.26979 52.5285, 13.2793 52.52447,...
#> 
#> $hull
#> Simple feature collection with 1 feature and 2 fields
#> geometry type:  POLYGON
#> dimension:      XY
#> bbox:           xmin: 13.25991 ymin: 52.50645 xmax: 13.29595 ymax: 52.5285
#> geographic CRS: WGS 84
#>            area elongation                       geometry
#> 1 3490196 [m^2]  0.5540544 POLYGON ((13.25991 52.51641...
#> 
#> $start_time
#> [1] 20820
#> 
#> $end_time
#> [1] 21420
#> 
#> attr(,"class")
#> [1] "gtfs_isochrone" "list"

Created on 2020-06-19 by the reprex package (v0.3.0)

Feel free to re-open if that's not sufficient, or if you'd like any other modifications.