Skip to content

Commit 8d10888

Browse files
committed
recreate shapes.txt
1 parent 416d521 commit 8d10888

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

network.qmd

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,33 @@ There are some nice R packages to read and manipulate GTFS data, such as:
156156
Be aware that they may share the same function names, so it is important to use of of them at the time.
157157
:::
158158

159+
#### Create `shapes.txt`
160+
161+
Some operators do not include the information, because this is not a mandatory file.
162+
163+
Anyway, you can create this file with some GIS operations, simplified by `GTFSwizard::read_gtfs()`
164+
165+
`GTFSwizard::get_shapes` reconstructs the shapes table using euclidean **approximation**, based on the coordinates and sequence of stops for each trip, and may not be accurate.
166+
167+
```{r}
168+
#| code-fold: true
169+
#| code-summary: "Install GTFSwizard"
170+
171+
remotes::install_github("hrbrmstr/hrbrthemes") # in 10.2025 this dependency was missing
172+
remotes::install_github('OPATP/GTFSwizard@main')
173+
```
174+
175+
```{r}
176+
gtfs_noshapes = GTFSwizard::read_gtfs("original/gtfs_without_shapes.zip") # it will recrreate shapes
177+
GTFSwizard::write_gtfs("data/r5r/gtfs_with_shapes.zip") # save the result
178+
```
179+
180+
::: {.callout-warning appearance="simple"}
181+
Sometimes, event this will not work because other information is missing in the `.zip`
182+
183+
Consider searching for another data source, or changing to another city.
184+
:::
185+
159186
#### Filter GTFS by area
160187

161188
Having a very large GTFS, as a nation-wide, instead of a city-wide one, can hold too much information not required.

0 commit comments

Comments
 (0)