Giter Club home page Giter Club logo

otp-react-redux's Introduction

Overview

Join the chat at https://gitter.im/opentripplanner/OpenTripPLanner Matrix codecov Commit activity Docker Pulls

OpenTripPlanner (OTP) is an open source multi-modal trip planner, focusing on travel by scheduled public transportation in combination with bicycling, walking, and mobility services including bike share and ride hailing. Its server component runs on any platform with a Java virtual machine ( including Linux, Mac, and Windows). It exposes GraphQL APIs that can be accessed by various clients including open source Javascript components and native mobile applications. It builds its representation of the transportation network from open data in open standard file formats (primarily GTFS and OpenStreetMap). It applies real-time updates and alerts with immediate visibility to clients, finding itineraries that account for disruptions and service changes.

Note that this branch contains OpenTripPlanner 2, the second major version of OTP, which has been under development since 2018. The latest version of OTP is v2.5.0, released in March 2024.

If you do not want to use this version, please switch to the final 1.x release tag v1.5.0 or the dev-1.x branch.

Performance Test

๐Ÿ“Š Dashboard

We run a speed test (included in the code) to measure the performance for every PR merged into OTP.

More information about how to set up and run it.

Repository layout

The main Java server code is in src/main/. OTP also includes a Javascript client based on the Leaflet mapping library in src/client/. This client is now primarily used for testing, with most major deployments building custom clients from reusable components. The Maven build produces a unified ("shaded") JAR file at target/otp-VERSION.jar containing all necessary code and dependencies to run OpenTripPlanner.

Additional information and instructions are available in the main documentation, including a quick introduction.

Development

OpenTripPlanner is a collaborative project incorporating code, translation, and documentation from contributors around the world. We welcome new contributions. Further development guidelines can be found in the documentation.

Development history

The OpenTripPlanner project was launched by Portland, Oregon's transport agency TriMet (http://trimet.org/) in July of 2009. As of this writing in Q3 2020, it has been in development for over ten years. See the main documentation for an overview of OTP history and a list of cities and regions using OTP around the world.

Getting in touch

The fastest way to get help is to use our Gitter chat room where most of the core developers are. Bug reports may be filed via the Github issue tracker. The OpenTripPlanner mailing list is used almost exclusively for project announcements. The mailing list and issue tracker are not intended for support questions or discussions. Please use the chat for this purpose. Other details of project governance can be found in the main documentation.

OTP Ecosystem

  • awesome-transit Community list of transit APIs, apps, datasets, research, and software.

otp-react-redux's People

Contributors

abyrd avatar adrianaceric avatar amy-corson-ibigroup avatar binh-dam-ibigroup avatar caleb-diehl-ibigroup avatar comradekingu avatar daniel-heppner-ibigroup avatar demory avatar dependabot[bot] avatar evansiroky avatar geopamplona avatar github-actions[bot] avatar josh-willis-arcadis avatar landonreed avatar miles-grant-ibigroup avatar mkemals avatar mvanlaar avatar philip-cline avatar pi-cla avatar reelman avatar robertgregg3 avatar tanayout avatar weblate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

otp-react-redux's Issues

Support service alert body content

Presently, if a GTFS-rt alert has a body value, it is not rendered in the UI. TriMet alerts do not have bodies, so the original UI was designed without a way to render this. Many other agencies do have alert bodies, so we need a way to display these.

Print button does nothing on certain mobile browsers

Clicking the Print button in PrintLayout does nothing, at least on Firefox for Android and Samsung Internet (Chromium-based) for Android. It seems to trigger and print prompt on Chrome for Android. You can still print using the browser menu.

This may or may not be related to #133.

image

hash-obj is not compatible with IE 11

I finally tracked down the root cause of the browser compatibility issues (or at least one of them). hash-obj is not transpiled for IE, so we should not be using it in otp-rr. There may have also been some issues with incorrect polyfills being included, but that should be resolved with the latest version of trimet-mod-otp. Thoughts on an alternative for this package, @evansiroky?

issue while using mobile view

Branch:Dev
Geocoder: nominatim
We are getting the error see attach, when click Plan Trip. In the same time desktop version working without issues.
Screenshot from 2019-04-12 21-41-03

Appreciate for any advce.

Pending Call Taker Issues

Below is a list of pending issues to resolve. Please edit the issue body directly to add any additional ones identified in PRs but not yet resolved.

  • please better style transit route numbers #165 (comment) (route numbers removed for now 54b1c4e)
  • please make itinerary cost factors and itinerary sort factors configurable #165 (comment) and #165 (comment) (added in 79c835d)
  • Have the settings and timing buttons do something in the batch-routing-panel file. #165 (comment)
  • Make save trip actually work in narrative-itineraries #165 (comment) (a68c3df)
  • Make addition/update/deletion of intermediate locations change map bounds #165 (comment) (5d2c55e)
  • Await fix for intermediate place parsing #165 (comment) (45d92ef)
  • other intermediate places enhancements
    • ability to drag the intermediate place map markers
    • ability to drag/drop the intermediate places to reorder them in the form
    • the reverse from/to button should probably just be removed if there is at least one intermediate place

Alert URL missing from alert in TransitLeg

When displaying an itinerary with alerts, the expanded alert does not render the alert URL. This prevents directing users of the trip planner to more information about the alert that may be contained on the agency website, which is especially useful if it contains dynamic or detailed instructions.

Current alert rendering

image

Alert data

image

Instead, we should add the URL with the hyperlinked More text

image

Example app doesn't start

I tried to use the example app and followed the instructions but I get the following error: TypeError: _toJS is undefined;\
Screenshot from 2019-07-04 14-34-29

(I'm on Firefox on Linux, if it matters.)

I've added the config.yaml file and it's contents are:

api:
  host: http://localhost
  path: /otp/routers/default
  port: 8080
# Add suggested locations to be shown as options in the form view.
# locations:
#   - id: 'airport'
#     icon: 'plane'
#     name: 'Portland International Airport (PDX)'
#     lat: 45.587579
#     lon: -122.593084
#   - id: 'zoo'
#     icon: building
#     lat: 45.51010444232195
#     lon: -122.71607145667079
#     name: Oregon Zoo, Portland, OR

### The persistence setting is used to enable the storage of places (home, work),
### recent searches/places, user overrides, and favorite stops. Currently the
### only strategy is localStorage (which is used by default). It also must be
### enabled to show the stored locations (see above).
### TODO: add another server-based strategy
persistence:
  enabled: true
  strategy: localStorage

map:
  initLat: 45.52
  initLon: -122.682
  baseLayers:
    - name: Streets
      url: //cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}@2x.png
      subdomains: 'abcd'
      attribution: 'Map tiles: &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, &copy; <a href="https://carto.com/attributions">CARTO</a>'
      maxZoom: 20
    - name: Stamen Toner Lite
      url: http://tile.stamen.com/toner-lite/{z}/{x}/{y}.png
      attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.'

geocoder:
  boundary:
    rect:
      minLon: -123.2034
      maxLon: -122.135
      minLat: 45.273
      maxLat: 45.7445
  MAPZEN_KEY: gAZxU6e1RamAot9wPp0_lA
  focusPoint:
    lat: 45.5223452
    lon: -122.6821804
  # Optional custom Pelias instance (defaults to Mapzen Search)
  # baseUrl: https://geocoder.example.com/pelias/v1

# Use this mode config for the enhanced Transit+ config
modes:
  transitModes:
    - mode: BUS
      label: Bus
    - mode: TRAM
      label: MAX & Streetcar
    - mode: RAIL
      label: WES
    - mode: GONDOLA
      label: Aerial Tram

  accessModes:
    - mode: BICYCLE
      label: Transit + Bike

  bicycleModes:
    - mode: BICYCLE
      label: Own Bike
      iconWidth: 18


routingTypes:
  - key: ITINERARY
    text: Exact Time

### Use this config for the standard mode selector
# modeGroups:
#   - name: Transit
#     modes:
#       - TRAM
#       - BUS
#   - name: Walk/Bike
#     modes:
#       - WALK
#       - BICYCLE

What am I doing wrong?

Deeplinking / react-router

Add routes to keep track of state of application.

  • plan query
  • mapState (lat/lon/zoom, layers, etc.)
  • active itinerary/leg/step

Route type comparator does not consider GTFS route types in long route response

OTP has two different response types in the transit index for routes: long and short.

The short response (which the route type comparator in otp-rr) currently handles contains a Route@mode field, which maps to the OTP transit mode enum values (e.g., BUS and RAIL). However, in the long response from OTP, the mode field is dropped in favor of route_type, which uses the int-based route types from GTFS. So, when a route is clicked in the otp-rr route viewer, the route object is replaced with the long response, and it drops the mode field. Originally, I thought the route was just disappearing from the list, but in fact it was dropping to the bottom of the list (in accordance with the route type comparator logic -- default to 9999).

case 'FERRY':
return 5
case 'CABLE_CAR':
return 6
case 'FUNICULAR':
return 7
case 'BUS':
return 8
default:
return 9999
}
}

Handle ungeocoded from and to places when parsing query params

Some transit agencies have simple forms on their website that connect with Google Transit/Maps by sending the place names, time, and date. otp-react-redux should accommodate the same kind of thing, by simply attempting to geocode the incoming place names when parsing the query params.

Add routes for otp application

Add routes to keep track of state of application.

  • plan query
  • mapState (lat/lon/zoom, layers, etc.)
  • active itinerary/leg/step

Replace mastarm with webpack

Would the OTP team support a pull request to replace mastarm with webpack? Webpack is the standard and mastarm is implemented by Conveyal, which appears it's main feature to support AWS which doesn't apply to some OTP installations. Also, webpack is more universal and easier to customize. Perhaps mastarm2 could become a decorator around webpack to preserve the AWS features.

add support multi-language

Hello,
I will develop to allow the application to be multi language.

My question is whether this is raised in any way in the project?
How should I develop it following a guideline or using a especific library?
What library do you recommend to make the multilanguage app?
Is there any thread where this is talked about?

Thanks!

otp-rr example does not update itinerary on form changes

Changes made for the TriMet implementation added a Plan Trip button in the DefaultMainPanel component. However, this does not appear in the example.js file that is used on yarn start, so there is no way to test the UI or whether any components modified in recent otp-ui PRs are actually working.

ignoreRealtimeUpdates query param is incorrectly populated with true value

As currently designed, otp-react-redux will make two requests to the OTP server for a trip plan: one with realtime updates applied and one with them ignored. However, it appears to set ignoreRealtimeUpdates to true in the query parameters so that any trip that is reloaded from URL (or maybe even after any query parameter is changed after a trip has been planned) will have the updates ignored for BOTH requests.

Web page title from config doesn't appear until responsive webapp component updates

When loading the OTP web app in a browser, there is a moment where the original page title is visible before it is overridden in responsive webapp:

componentDidUpdate (prevProps) {
const { currentPosition, location, query, title } = this.props
document.title = title

This was observed in the 511NY trip planner using the trimet-mod-otp library (see https://dz88fe1xr6gid.cloudfront.net/#/, where page title flashes a non-NY title before changing).

It appears that we need to update the page title in the constructor method as well.

ArcGis geocoder does not handle getting locations from 'search' query correctly.

The ArcGis geocoder adapter does not correctly handle getting the location from a search query. The response for this query type is simply a GeoJSON-style feature with geometry and properties (not the magicKey/text result that comes back from autocomplete). Currently ArcGISGeocoder#getLocationFromGeocodedFeature only handles the autocomplete style result:

/**
* Using the given magicKey and text, perform a search query to get detailed
* address and GPS data. Return data in an application-specific location
* format.
*/
getLocationFromGeocodedFeature (feature) {
return this.api.search({ magicKey: feature.magicKey, text: feature.text })
.then(response => {
const feature = response.features[0]
const location = lonlat.fromCoordinates(feature.geometry.coordinates)
location.name = feature.properties.label
return location
})
}

Premature optimization idea: cache route viewer data

In the current design of the route viewer as of 26b9a8a, the route polyline data is fetched anew each time a user clicks on a new route. In order to cut back on the number of API fetches for users that click back and forth between routes, we could store the response for certain routes in a in-browser cache and return that data to reduce the need for API requests.

Add route_type/agency filtering to route viewer

For feeds with large numbers of routes, especially when multiple feeds/agencies are present, we should provide controls to filter on route_type and agency.

After further team discussion on this:

  • The "filters" will just be standard dropdown selectors allowing the selection of either All Modes/Agencies or a single mode/agency.
  • For styling, we'll just use the dropdown selector from the otp-ui form (currently used for setting things like max walk distance)
    image

Desktop view

image

Mobile view

image

Setting from / to location via location search on mobile causes a white screen

Note: this issue is only detectable on a mobile device (using Chrome dev tools to simulate mobile on a desktop is not enough to trigger).

When a user sets the from and to locations via a geocoded result in the location search component, there is a fitBounds invocation in BaseMap that causes an error to be thrown resulting in a blank white screen.

// If no itinerary update but from/to locations are present, fit to those
} else if (newProps.query.from && newProps.query.to && (fromChanged || toChanged)) {
map.leafletElement.fitBounds([
[newProps.query.from.lat, newProps.query.from.lon],
[newProps.query.to.lat, newProps.query.to.lon]
], { padding })

The error logged in the console suggests an invalid latlng object, but adding a timeout or removing the fitBounds invocation on mobile both appear to be viable solutions. Attempting to set a timeout (with a value of 250 seconds), works, but the map doesn't actually appear to fit to the bounds of the from/to locations. So a better approach may be to just disable the fitBounds call on mobile devices.

Transitive rendering bug

There appears to be an issue with transitive rendering a specific itinerary from the City of Long Beach (NYSDOT).

  1. Go to: https://otp-test.511ny.org/#start/40.5885995/-73.6394705/11/City_of_Long_Beach_ea05fbd9-bfc6-413a-ab04-e777b95484dd
  2. Plan trip from
    414 Centre St, Long Beach, NY, 11561, USA
    to
    1092 W Beech St, Long Beach, NY, 11561, USA.
  3. White screen of death with error:
Uncaught TypeError: this.parent.getName is not a function
    at SegmentLabel.initText (label.js:36)
    at SegmentLabel.getText (label.js:30)
    at SegmentLabel.render (segmentlabel.js:65)
    at eval (default-renderer.js:117)
    at arrayEach (_arrayEach.js:15)
    at forEach (forEach.js:38)
    at DefaultRenderer.render (default-renderer.js:116)
    at Transitive.render (transitive.js:162)
    at TransitiveCanvasOverlay._updateBoundsAndRender (transitive-overlay.js:159)
    at TransitiveCanvasOverlay._updateBoundsAndRender (react-hot-loader.development.js:708)

Potential for shared logic between line-itin and printable itinerary

I'm worried that this block of code to determine the print label will be at risk of diverging from the block in PlaceRow:

if (leg.rentedBike) {
// FIXME: Special case for TriMet that needs to be refactored to
// incorporate actual company.
legModeLabel = 'Ride BIKETOWN bike'
} else if (leg.rentedCar) {
// Add extra information to printview that would otherwise clutter up
// other places that use the getLegModeLabel function
const companiesLabel = getCompaniesLabelFromNetworks(
leg.from.networks,
configCompanies
)
legModeLabel = `Drive ${companiesLabel} ${leg.from.name}`
} else if (leg.rentedVehicle) {
const companiesLabel = getCompaniesLabelFromNetworks(
leg.from.networks,
configCompanies
)
legModeLabel = `Ride ${companiesLabel} eScooter`
}

Even though they aren't returning the exact same label, there's some shared logic that I have a feeling we would want to co-locate:

let rentalDescription = 'Pick up'
if (leg.rentedBike) {
// TODO: Special case for TriMet may need to be refactored.
rentalDescription += ` shared bike`
} else {
// Add company and vehicle labels.
let vehicleName = ''
// TODO allow more flexibility in customizing these mode strings
let modeString = leg.rentedVehicle
? 'eScooter'
: leg.rentedBike
? 'bike'
: 'car'
// The networks attribute of the from data will only appear at the very
// beginning of the rental. It is possible that there will be some forced
// walking that occurs in the middle of the rental, so once the main mode
// resumes there won't be any network info. In that case we simply return
// that the rental is continuing.
if (leg.from.networks) {
const companiesLabel = getCompaniesLabelFromNetworks(
leg.from.networks,
configCompanies
)
rentalDescription += ` ${companiesLabel}`
// Only show vehicle name for car rentals. For bikes and eScooters, these
// IDs/names tend to be less relevant (or entirely useless) in this context.
if (leg.rentedCar && leg.from.name) {
vehicleName = leg.from.name
}
modeString = getModeForPlace(leg.from)
} else {
rentalDescription = 'Continue using rental'
}
rentalDescription += ` ${modeString} ${vehicleName}`
}

Case in point: I think the only reason this pull requests exists is because there is a significant split between the print and narrative itinerary components.

Originally posted by @landonreed in #100

PWA and lighthouse

Has anyone considered using OTPRR as a PWA? I ran a test site through lighthouse viewer. While there are a few optimizations needed, it could become one (eg. Does not register a service worker that controls page and start_url, font sizes, no meta description).

This would be fantastic bringing full screen, offline (maybe possible), home screen app icons, etc.

Unable to use LinkContainer

Revisit the use of LinkContainer. Earlier attempts have resulted in LinkContainer not being able to get the router info (does it have to do with the React router setup?)

Originally posted by @landonreed in #174

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.