HSLdevcom / OpenTripPlanner

An open source multi-modal trip planner
http://www.opentripplanner.org
Other
33 stars 31 forks source link

DCW-10: add elevation data to the schema #205

Closed jolkkola closed 6 years ago

jolkkola commented 6 years ago

The purpose of this pull request is to add support for returning elevation data through the GraphQL API. This data can be used to e.g. plot an elevation profile for an itinerary in a client application.

The functionality was already available on the REST API. It is now partly replicated, with field elevation being called elevationProfile and fields first and second being called distance and elevation, respectively. Each field has also been documented on the API.

Note that retrieving the steps and their elevationProfiles for an itinerary increases the response size quite a bit. This information is mainly relevant for bicycle and walk routes.

The new fields and their types are:

itinerary {
  ...
  elevationLost: GraphQLFloat,
  elevationGained: GraphQLFloat,
  legs: [{
    ...
    steps: [{
      distance: GraphQLFloat,
      lat: GraphQLFloat,
      lon: GraphQLFloat,
      elevationProfile: [{        // called "elevation" on the REST API
        distance: GraphQLFloat,   // called "first" on the REST API
        elevation: GraphQLFloat   // called "second" on the REST API 
      }]
    }]
  }]
}