Skip to content

Data overlay sandbox feature - #3760

Merged
leonardehrenfried merged 138 commits into
opentripplanner:dev-2.xfrom
megasense-development:data-overlay-sandbox-feature
Dec 22, 2021
Merged

Data overlay sandbox feature#3760
leonardehrenfried merged 138 commits into
opentripplanner:dev-2.xfrom
megasense-development:data-overlay-sandbox-feature

Conversation

@Daniilmass

@Daniilmass Daniilmass commented Nov 30, 2021

Copy link
Copy Markdown
Contributor

PR Instructions

otp-config.json file must have a feature enabled as follows:

{
    "otpFeatures" : {
        "DataOverlay" : true
    }
}

Then provide a data-overlay-config.json and a data file itself in a NetCDF (.nc, .nc3, .nc4) format.

Start the graph building process as usually. Your custom overlay data will populate the graph edges with values. You will also get custom /otp/routers/default/plan endpoint request parameters available (defined in the data-overlay-config.json).

Please scroll to the bottom for the data-overlay-config.json example.

Summary

PR adds a feature of a map grid data "overlay" or population. You could take i.e weather, air quality, traffic and e.t.c data in a NetCDF format and get the map populated by this data. Routing can be affected by this data if you use the custom request parameters defined in the data-overlay-config.json

Issue


Code style

Documentation

Changelog

The changelog file
is generated from the pull-request title, make sure the title describe the feature or issue fixed.
To exclude the PR from the changelog add [changelog skip] in the title.

Required data-overlay-config.json file example

{
  "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": "carbonMonoxide",
      "displayName": "Carbon monoxide",
      "variable": "cnc_CO_gas"
    }
  ],
  "requestParameters": [
    {
      "name": "harmful_micro_particles_PM2_5_threshold",
      "parameterType": "THRESHOLD",
      "variable": "harmfulMicroparticlesPM2_5"
    },
    {
      "name": "harmful_micro_particles_PM2_5_penalty",
      "parameterType": "PENALTY",
      "variable": "harmfulMicroparticlesPM2_5",
      "formula": "(VALUE + 1 - THRESHOLD) * PENALTY"
    },
    {
      "name": "carbon_monoxide_threshold",
      "parameterType": "THRESHOLD",
      "variable": "carbonMonoxide"
    },
    {
      "name": "carbon_monoxide_penalty",
      "parameterType": "PENALTY",
      "variable": "carbonMonoxide",
      "formula": "(VALUE + 1 - THRESHOLD) * PENALTY"
    }
  ]
}

platonovsimeon and others added 30 commits October 29, 2020 16:04
# Conflicts:
#	src/main/java/org/opentripplanner/graph_builder/GraphBuilderDataSources.java
#	src/test/java/org/opentripplanner/graph_builder/module/osm/TestOpenStreetMapGraphBuilder.java
…air quality parameters, removed unused files from AirQuality
…iltering during request building, settings.json parsing for the router). UNTESTED todo: add parameter data filtering logic
…son, penalty calculation from formula, null checks
fixed formatting and javadocs according to review
types, request parameters checks
…r airquality.nc file and which should be placed into "graphs" folder
added 3d and 4d netcdf array processing for number variables
added different date formats
Comment thread docs/sandbox/DataOverlay.md Outdated
Comment thread docs/sandbox/DataOverlay.md Outdated
{ "otpFeatures": { "DataOverlay" : true } }
```

TODO - Katja, please provide other instructions here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaeline Is this done? Can this TODO be removed?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leonardehrenfried Not done yet, I will add more detailed description of how to set the configuration for the data file

import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import org.opentripplanner.ext.dataoverlay.routing.DataOverlayContext;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import org.opentripplanner.ext.dataoverlay.routing.DataOverlayContext;

Comment thread src/main/java/org/opentripplanner/standalone/config/RouterConfig.java Outdated
Comment thread src/main/java/org/opentripplanner/standalone/config/RouterConfig.java Outdated
Comment thread src/main/java/org/opentripplanner/standalone/config/RouterConfig.java Outdated
Comment thread src/main/java/org/opentripplanner/standalone/config/RouterConfig.java Outdated
t2gran
t2gran previously approved these changes Dec 21, 2021
@kaeline
kaeline dismissed stale reviews from leonardehrenfried and t2gran via 846536c December 21, 2021 18:50
@Daniilmass

Copy link
Copy Markdown
Contributor Author

@t2gran @leonardehrenfried unfortunately we can not merge without write access to this repo. Could you do it?

@leonardehrenfried
leonardehrenfried merged commit 0f10c6e into opentripplanner:dev-2.x Dec 22, 2021
@leonardehrenfried

Copy link
Copy Markdown
Member

🍾

t2gran pushed a commit that referenced this pull request Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants