Skip to content

Commit

Permalink
Merge remote-tracking branch 'otp/dev-2.x' into otp2_not_allowed_tran…
Browse files Browse the repository at this point in the history
…sfers
  • Loading branch information
t2gran committed Jan 14, 2022
2 parents 2a08080 + 10e407c commit 768117c
Show file tree
Hide file tree
Showing 266 changed files with 11,001 additions and 3,654 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/performance-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Performance test

on:
push:
branches:
- dev-2.x

jobs:
perf-test:
if: github.repository_owner == 'opentripplanner'
runs-on: performance-test
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.8.2

- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Cache graph input files
uses: actions/cache@v2
with:
path: |
graph/*.osm.pbf
graph/*.zip
key: graph

- name: Build jar
run: mvn -DskipTests --batch-mode package

- name: Download OSM & Netex data
run: |
mkdir -p graph
wget https://download.geofabrik.de/europe/norway-210101.osm.pbf -O graph/norway.osm.pbf --no-clobber -q --show-progress --progress=bar:force || true
wget https://leonard.io/otp/rb_norway-aggregated-netex-2021-12-11.zip -O graph/rb_norway-aggregated-netex.zip --no-clobber -q --show-progress --progress=bar:force || true
- name: Build Norway graph
run: |
cp test/ci-performance-test/build-config.json graph/build-config.json
cp target/otp-2.1.0-SNAPSHOT-shaded.jar otp.jar
java -Xmx32G -jar otp.jar --build --save graph
- name: Copy graph, run speed test
env:
PERFORMANCE_INFLUX_DB_PASSWORD: ${{ secrets.PERFORMANCE_INFLUX_DB_PASSWORD }}
MEASUREMENT_ENVIRONMENT: CI
run: |
mv graph/graph.obj test/ci-performance-test/
mvn exec:java -Dexec.mainClass="org.opentripplanner.transit.raptor.speed_test.SpeedTest" -Dexec.classpathScope=test -Dexec.args="--dir=test/ci-performance-test/ -p md -n 4"
- name: Archive travel results file
uses: actions/upload-artifact@v2
with:
name: travelSearch-results.csv
path: |
test/ci-performance-test/travelSearch-results.csv
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependency-reduced-pom.xml
interactive_otp_main.json
/otp
/otp-ui
Dockerfile

# Directories
.idea/
Expand All @@ -36,3 +37,6 @@ target/

# for local dev only
src/ext/resources/reportapi/report.csv

streetGraph.obj
graph.obj
8 changes: 8 additions & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@
- Remove hardcoded alighting/boarding on first/last stop [#3784](https://github.com/opentripplanner/OpenTripPlanner/pull/3784)
- Add support for include-file-directive in config files. [#3771](https://github.com/opentripplanner/OpenTripPlanner/pull/3771)
- Remove build parameter 'useTransfersTxt' [#3791](https://github.com/opentripplanner/OpenTripPlanner/pull/3791)
- Add cursor-based paging [#3759](https://github.com/opentripplanner/OpenTripPlanner/pull/3759)
- Data overlay sandbox feature [#3760](https://github.com/opentripplanner/OpenTripPlanner/pull/3760)
- Run automatic performance tests [#3783](https://github.com/opentripplanner/OpenTripPlanner/pull/3783)
- Add support for sandboxed realtime vehicle parking updaters [#3796](https://github.com/opentripplanner/OpenTripPlanner/pull/3796)
- Add reading and exposing of Netex submodes [#3793](https://github.com/opentripplanner/OpenTripPlanner/pull/3793)
- Fix: Account for wait-time in no-wait Raptor strategy [#3798](https://github.com/opentripplanner/OpenTripPlanner/pull/3798)
- Read in flex window from Netex feeds [#3800](https://github.com/opentripplanner/OpenTripPlanner/pull/3800)
- Fix NPE when routing on a graph without transit data. [#3804](https://github.com/opentripplanner/OpenTripPlanner/pull/3804)
[](AUTOMATIC_CHANGELOG_PLACEHOLDER_DO_NOT_REMOVE)


Expand Down
4 changes: 4 additions & 0 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,10 @@ or position relative to their scheduled stops.
Besides GTFS-RT transit data, OTP can also fetch real-time data about vehicle rental networks including the number
of bikes and free parking spaces at each station. We support vehicle rental systems from using GBFS feed format.

### Vehicle parking (sandbox feature)

Vehicle parking options and configuration is documented in its [sandbox documentation](sandbox/VehicleParking.md).

### Configuring real-time updaters

Real-time data can be provided using either a pull or push system. In a pull configuration, the GTFS-RT consumer polls the
Expand Down
2 changes: 2 additions & 0 deletions docs/SandboxExtension.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ nearby stops generated by routing via OSM data.
- [Mapbox Vector Tiles API](sandbox/MapboxVectorTilesApi.md) - Mapbox Vector Tiles API
- [Flex Routing](sandbox/Flex.md) - Flexible transit routing for GTFS and Netex data sources
- [Park and Ride API](sandbox/ParkAndRideApi.md) - Park and Ride API
- [Data Overlay](sandbox/DataOverlay.md) - StreetEdge grid data populating affecting the route planning
- [Vehicle Parking](sandbox/VehicleParking.md) - Vehicle Parking updaters


## Terminology
Expand Down
105 changes: 105 additions & 0 deletions docs/sandbox/DataOverlay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Data Overlay
Use grid data in NetCDF format to populate the graph. Also provides custom route endpoint parameters for the data "penalty" and "threshold". This allows route planning to be based on the custom data calculated penalties. Data examples: air quality, environmental, and other data types that are tied to certain geographical locations.


## Contact Info
Developed and maintained by <strong>Metatavu OY</strong>, Finland.

Developers:

<strong>Katja Danilova</strong> - [email protected]\
<strong>Simeon Platonov</strong> - [email protected]\
<strong>Daniil Smirnov</strong> - [email protected]

In case of any questions please contact any of the people above by emails. We would like to continue developing and improving this feature and would love to hear any ideas from the community.

Company email: [email protected]

## Changelog
- Initial version (December 2021)


## Documentation

We have been working with OTP since version 1 mainly for producing the Air Quality affected routing for the city of Helsinki, Finland. That project required us to modify the original OTP quite a lot so we didn't propose our efforts for the community.

With the OTP2 release we decided to create a dedicated layer on top of OTP2 which not only leaves the initial structure of the OpenTripPlanner intact, but also brings some additional features for those, who actually need them. This layer's main feature is populating the graph with a grid data (i.e air quality, temperature, humidity, pressure, wind speed and direction, and e.t.c). For this to work two files are required: the actual data file (i.e in NetCDF format) and a .json settings file which describes the contents of the data file. Please refer to the diagram for more information.

It is a sandbox feature.

Please see the configuration part for setup instructions and examples.

### Configuration

Enable the feature by including it to the ```otp-config.json```:

```json
// otp-config.json
{ "otpFeatures": { "DataOverlay" : true } }
```

Plugin configuration should explain the NetCDF data file and request parameters that use the data file.
* _fileName_ points to the data file
* _latitudeVariable_, _longitudeVariable_ and _timeVariable_ should be equal to the corresponding variable names of the data file
* _timeFormat_ options: MS_EPOCH, SECONDS, HOURS
* _indexVariables_ contain a list of variables of data file that will affect the routing.
* _name_ can have any value and exists to act as a reference for _requestPatameters_ (see below)
* _displayName_ is a variable name in human-readable form that should make it more understandable
* _variable_ is the actual name of the variable from data file
* _requestParameters_ contains the list of REST request parameters that affects the cost calculation.
* _name_ should be chosen from the list of enums: org.opentripplanner.ext.dataoverlay.api.ParameterName
* _variable_ should correspond to the _name_ of one of the entries from _indexVariables_ list and explain which data field this parameter corresponds to
* _formula_ should use the keywords VALUE and THRESHOLD and describe the way the penalty is calculated. Note: if the result of the formula is negative it is ignored.

Example of build-config.json that includes the dataOverlay plugin configuration:
```json
// build-config.json
{
"dataOverlay" :
{
"fileName": "graphs/data-file.nc4",
"latitudeVariable": "lat",
"longitudeVariable": "lon",
"timeVariable": "time",
"timeFormat": "HOURS",
"indexVariables": [
{
"name": "harmfulMicroparticlesPM2_5",
"displayName": "Harmful micro particles pm 2.5",
"variable": "cnc_PM2_5"
},
{
"name": "harmfulMicroparticlesPM10",
"displayName": "Harmful micro particles pm 10",
"variable": "cnc_PM10"
}
],
"requestParameters": [
{
"name": "PARTICULATE_MATTER_2_5",
"variable": "harmfulMicroparticlesPM2_5",
"formula": "(VALUE + 1 - THRESHOLD) * PENALTY"
},
{
"name": "PARTICULATE_MATTER_10",
"variable": "harmfulMicroparticlesPM10",
"formula": "(VALUE + 1 - THRESHOLD) * PENALTY"
}
]
}

}
```

Default values for Data overlay plugin can also be included in router-config instead of being sent with each request. If any Data overlay parameters are passed in user query, all the default values from router-config are ignored.
```json
// router-config.json
{
"routingDefaults": {
"dataOverlay" : {
"particulate_matter_10_threshold" : 100,
"particulate_matter_10_penalty" : 19
}
}
}
```
12 changes: 11 additions & 1 deletion docs/sandbox/MapboxVectorTilesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- 2021-05-12: Make expansion factor configurable
- 2021-09-07: Rename `BikeRental` to `VehicleRental`
- 2021-10-13: Correctly serialize the vehicle rental name [#3648](https://github.com/opentripplanner/OpenTripPlanner/pull/3648)
- 2022-01-03: Add support for VehicleParking entities

## Documentation

Expand Down Expand Up @@ -50,6 +51,15 @@ The feature must be configured in `router-config.json` as follows
"minZoom": 14,
"cacheMaxSeconds": 60,
"expansionFactor": 0.25
},
{
"name": "vehicleParking",
"type": "VehicleParking",
"mapper": "Digitransit",
"maxZoom": 20,
"minZoom": 14,
"cacheMaxSeconds": 60,
"expansionFactor": 0.25
}
]
}
Expand All @@ -58,7 +68,7 @@ The feature must be configured in `router-config.json` as follows
For each layer, the configuration includes:

- `name` which is used in the url to fetch tiles, and as the layer name in the vector tiles.
- `type` which tells the type of the layer. Currently `Stop`, `Station` and `BikeRental` are supported.
- `type` which tells the type of the layer. Currently `Stop`, `Station`, `VehicleRental` and `VehicleParking` are supported.
- `mapper` which describes the mapper converting the properties from the OTP model entities to the vector tile properties. Currently `Digitransit` is supported for all layer types.
- `minZoom` and `maxZoom` which describe the zoom levels the layer is active for.
- `cacheMaxSeconds` which sets the cache header in the response. The lowest value of the layers included is selected.
Expand Down
3 changes: 3 additions & 0 deletions docs/sandbox/TransmodelApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
- Allow filtering by a list of ids [#3738](https://github.com/opentripplanner/OpenTripPlanner/pull/3738)
- Don't filter out stops who don't have multimodal parents in the nearest query [#3752](https://github.com/opentripplanner/OpenTripPlanner/pull/3752)
- Restore ability to filter by private code [#3764](https://github.com/opentripplanner/OpenTripPlanner/pull/3764)
- Narrow down non-null types type [#3803](https://github.com/opentripplanner/OpenTripPlanner/pull/3803)
- Fix issue with fetching parent StopPlaces in nearest query in Transmodel API [#3807](https://github.com/opentripplanner/OpenTripPlanner/pull/3807)
- Fix invalid cast in situations resolver for line type [#3810](https://github.com/opentripplanner/OpenTripPlanner/pull/3810)

## Documentation

Expand Down
82 changes: 82 additions & 0 deletions docs/sandbox/VehicleParking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Vehicle Parking Updaters - OTP Sandbox Extension

## Contact Info
- For HSL Park and Ride updater: Digitransit team, HSL, Helsinki, Finland

## Changelog
- Create initial sandbox implementation (January 2022, https://github.com/opentripplanner/OpenTripPlanner/pull/3796)

## Documentation
This sandbox contains vehicle parking updaters. Unlike for some other sandbox features,
this is not enabled/disabled through `otp-config.json` but from `router-config.json` updaters.

Currently contains the following updaters:
- HSL Park and Ride (https://p.hsl.fi/docs/index.html)
- ParkAPI (https://github.com/offenesdresden/ParkAPI)
- KML (Keyhole Markup language) placemark parks. Use name as bike park name and point coordinates.

### Configuration
These sandboxed vehicle parking updaters can be enabled by editing the `updaters` section
in the `router-config.json` according to the following examples.

All updaters have the following parameters in common:
- `type`: this needs to be `"vehicle-parking"`
- `feedId`: this is used as a "prefix" for park ids, entrance ids and sometimes also for tags.

<b>To use HSL park updater:</b>
```
{
"type": "vehicle-parking",
"sourceType": "hsl-park",
"feedId": "hslpark",
"facilitiesFrequencySec": 3600,
"facilitiesUrl": "https://p.hsl.fi/api/v1/facilities.json?limit=-1",
"utilizationsFrequencySec": 600,
"utilizationsUrl": "https://p.hsl.fi/api/v1/utilizations.json?limit=-1"
}
```
- `sourceType`: needs to be `"hsl-park"`
- `facilitiesUrl`: URL that contains the basic information for the parks
- `facilitiesFrequencySec`: how often should the basic information for parks be refetched.
Should be more than `utilizationsFrequencySec` and if it's <= 0, parks are only fetched once. Default `600`.
- `utilizationsUrl`: URL that contains realtime updates to parks
- `utilizationsFrequencySec`: how often should the basic information for parks be refetched.
Should be less than `facilitiesFrequencySec` and if it's < 0,
realtime information is never refetched. Default `3600`.

<b>To use KML park updater:</b>
```
{
"type": "vehicle-parking",
"sourceType": "kml",
"feedId": "kml",
"frequencySec": 600,
"url": "https://foo.bar",
"namePrefix": "foo",
"zip": true
}
```
- `sourceType`: needs to be `"kml"`
- `url`: URL that contains the park data in KML format
- `frequencySec`: how often park data is refetched. Default `60`.
- `namePrefix`: Adds this prefix to park names
- `zip`: Tells if the data is zipped or not.

<b>To use ParkAPI updater:</b>
```
{
"type": "vehicle-parking",
"sourceType": "park-api",
"feedId": "parkapi",
"frequencySec": 600,
"url": "https://foo.bar",
"headers": {"Cache-Control": "max-age=604800"},
"tags": ["source:parkapi"]
}
```
- `sourceType`: needs to be `"park-api"` if car parks are fetched, `"bicycle-park-api"` if bicycle parks.
- `url`: URL that contains the park data in KML format
- `frequencySec`: how often park data is refetched. Default `60`.
- `headers`: Use these headers for requests
- `tags`: Add these tags to all parks.

2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ pages:
- Interactive OTP Launcher: 'sandbox/InteractiveOtpMain.md'
- Sandbox Extension Example: 'sandbox/Examples.md'
- Park and Ride API: 'sandbox/ParkAndRideApi.md'
- Data Overlay: 'sandbox/DataOverlay.md'
- Vehicle Parking Updaters: 'sandbox/VehicleParking.md'
Loading

0 comments on commit 768117c

Please sign in to comment.