GithubHelp home page GithubHelp logo

transitjson's Introduction

This is a WIP concept. Please contribute ideas and help it evolve.

TransitJSON

TransitJSON is a flavor of GeoJSON for transit data. It aims to be an abstraction over GTFS, enabling easy visualization and large scale editing of transit networks without worrying about the specifics of individual trips.

The two main simplifications over GTFS:

  • Routes shapes and stops are combined into a single GeoJSON MultiLineString, where each stop is the final point in a LineString. Stop names and metadata are dropped.
  • Trip times and stop times are generalized to service windows, headways, and speed.

Example

{
  "type": "FeatureCollection",
  "properties": {
    "agency": {
      "id": "SFMTA",
      "key": "san-francisco-municipal-transportation-agency",
      "name": "San Francisco Municipal Transportation Agency",
      "url": "http://www.sfmta.com",
      "timezone": "America/Los_Angeles",
      "lang": "en"
    }
  },
  "features": [
    {
      "type": "Feature",
      "properties": {
        "id": "1006",
        "shortName": "6 ",
        "longName": "PARNASSUS",
        "type": "3",
        "serviceWindows": [
          {
            "name": "AM Peak",
            "from": "07:00:00",
            "to": "10:00:00",
            "headway": "12"
          },
          {
            "name": "Midday",
            "from": "10:00:00",
            "to": "16:00:00",
            "headway": "20"
          },
          {
            "name": "PM Peak",
            "from": "16:00:00",
            "to": "20:00:00",
            "headway": "12"
          },
          {
            "name": "Evening",
            "from": "20:00:00",
            "to": "23:00:00",
            "headway": "30"
          }
        ],
        "speed": 12
      },
      "geometry": {
        "type": "GeometryCollection",
        "geometries":[
          { 
            "type": "MultiLineString",
            "coordinates": [[[-122.394149,37.794052],[-122.394756,37.794472],[-122.395628,37.793776],[-122.396305,37.79325],[-122.396511,37.793089],[-122.397394,37.792403],[-122.398266,37.791707],[-122.399149,37.791012],[-122.399482,37.790735],[-122.400067,37.790298]],[[-122.400067,37.790298],[-122.401386,37.789255],[-122.402074,37.788711],[-122.402911,37.788078],[-122.403439,37.787632],[-122.404586,37.786722],[-122.405836,37.785741],[-122.408072,37.783984],[-122.408955,37.783279],[-122.410297,37.782227],[-122.411627,37.781183]],[[-122.411627,37.781183],[-122.411982,37.780898],[-122.412521,37.78047],[-122.414746,37.778713],[-122.415927,37.777785],[-122.416294,37.777491],[-122.417509,37.776536],[-122.41869,37.775582],[-122.419263,37.775145],[-122.420261,37.774351],[-122.420708,37.774003]],[[-122.420708,37.774003],[-122.421017,37.773771],[-122.421293,37.773548],[-122.421946,37.773031],[-122.422118,37.773165],[-122.422232,37.773147],[-122.423871,37.772933],[-122.425522,37.772728],[-122.427161,37.772523],[-122.428811,37.772309],[-122.430439,37.772104]],[[-122.430439,37.772104],[-122.432101,37.77189],[-122.43374,37.771685],[-122.435379,37.771471],[-122.437052,37.771258],[-122.438714,37.771052],[-122.440364,37.770838],[-122.442003,37.770633],[-122.443321,37.770464],[-122.443654,37.770419],[-122.44535,37.770214]],[[-122.44535,37.770214],[-122.445178,37.76934],[-122.445109,37.769286],[-122.444731,37.76743],[-122.445545,37.767323],[-122.44637,37.767225],[-122.447206,37.767118],[-122.44802,37.767011],[-122.447825,37.766074],[-122.447642,37.765146],[-122.448433,37.765039]],[[-122.448433,37.765039],[-122.449762,37.764869],[-122.451206,37.764682],[-122.452558,37.764513],[-122.453509,37.764396],[-122.454208,37.764316],[-122.455458,37.764164],[-122.455778,37.764075],[-122.456661,37.763816],[-122.457818,37.763486],[-122.459789,37.762933]],[[-122.459789,37.762933],[-122.460832,37.762629],[-122.461898,37.76237],[-122.462963,37.762317],[-122.464041,37.762272],[-122.465106,37.762227],[-122.466172,37.762174],[-122.466045,37.760318],[-122.465919,37.758444],[-122.465781,37.756588],[-122.465655,37.754714]],[[-122.465655,37.754714],[-122.465528,37.75285],[-122.466594,37.752805],[-122.466467,37.75094],[-122.466329,37.749075],[-122.467372,37.74903],[-122.468025,37.749004],[-122.468472,37.74895],[-122.468552,37.748941],[-122.469537,37.748905],[-122.470591,37.748869]]]
          },
          {
            "type": "MultiLineString",
            "coordinates": [[[-122.418541,37.77551],[-122.41869,37.775582],[-122.417509,37.776536],[-122.416294,37.777491],[-122.415927,37.777785],[-122.414746,37.778713],[-122.412521,37.78047],[-122.411982,37.780898],[-122.411627,37.781183],[-122.410297,37.782227]],[[-122.410297,37.782227],[-122.408955,37.783279],[-122.408072,37.783984],[-122.405836,37.785741],[-122.404586,37.786722],[-122.403439,37.787632],[-122.402911,37.788078],[-122.402074,37.788711],[-122.401386,37.789255],[-122.400067,37.790298],[-122.399482,37.790735]],[[-122.399482,37.790735],[-122.399149,37.791012],[-122.398266,37.791707],[-122.397394,37.792403],[-122.396511,37.793089],[-122.396305,37.79325],[-122.395628,37.793776],[-122.39407,37.792535],[-122.393186,37.793222],[-122.394114,37.794043]]]
          },
          {
            "type":"MultiLineString",
            "coordinates": [[[-122.470591,37.748869],[-122.469537,37.748905],[-122.468552,37.748941],[-122.468472,37.74895],[-122.468025,37.749004],[-122.467372,37.74903],[-122.466329,37.749075],[-122.466467,37.75094],[-122.466594,37.752805],[-122.465528,37.75285]],[[-122.465528,37.75285],[-122.465655,37.754714],[-122.465781,37.756588],[-122.465919,37.758444],[-122.466045,37.760318],[-122.466172,37.762174],[-122.465106,37.762227],[-122.464041,37.762272],[-122.462963,37.762317],[-122.461898,37.76237],[-122.460832,37.762629]],[[-122.460832,37.762629],[-122.459789,37.762933],[-122.457818,37.763486],[-122.456661,37.763816],[-122.455778,37.764075],[-122.455458,37.764164],[-122.454208,37.764316],[-122.453509,37.764396],[-122.452558,37.764513],[-122.451206,37.764682],[-122.449762,37.764869]],[[-122.449762,37.764869],[-122.448433,37.765039],[-122.447642,37.765146],[-122.447825,37.766074],[-122.44802,37.767011],[-122.447206,37.767118],[-122.44637,37.767225],[-122.445545,37.767323],[-122.444731,37.76743],[-122.445109,37.769286],[-122.445178,37.76934]],[[-122.445178,37.76934],[-122.44535,37.770214],[-122.443654,37.770419],[-122.443321,37.770464],[-122.442003,37.770633],[-122.440364,37.770838],[-122.438714,37.771052],[-122.437052,37.771258],[-122.435379,37.771471],[-122.43374,37.771685],[-122.432101,37.77189]],[[-122.432101,37.77189],[-122.430439,37.772104],[-122.428811,37.772309],[-122.427161,37.772523],[-122.425522,37.772728],[-122.425614,37.773192],[-122.425705,37.773656],[-122.424066,37.77387],[-122.422416,37.774075],[-122.420765,37.774289],[-122.420261,37.774351]],[[-122.420261,37.774351],[-122.419263,37.775145]]]
          },
          {
            "type":"MultiLineString",
            "coordinates": [[[-122.470591,37.748869],[-122.469537,37.748905],[-122.468552,37.748941],[-122.468472,37.74895],[-122.468025,37.749004],[-122.467372,37.74903],[-122.466329,37.749075],[-122.466467,37.75094],[-122.466594,37.752805],[-122.465528,37.75285]],[[-122.465528,37.75285],[-122.465655,37.754714],[-122.465781,37.756588],[-122.465919,37.758444],[-122.466045,37.760318],[-122.466172,37.762174],[-122.465106,37.762227],[-122.464041,37.762272],[-122.462963,37.762317],[-122.461898,37.76237],[-122.460832,37.762629]],[[-122.460832,37.762629],[-122.459789,37.762933],[-122.457818,37.763486],[-122.456661,37.763816],[-122.455778,37.764075],[-122.455458,37.764164],[-122.454208,37.764316],[-122.453509,37.764396],[-122.452558,37.764513],[-122.451206,37.764682],[-122.449762,37.764869]],[[-122.449762,37.764869],[-122.448433,37.765039],[-122.447642,37.765146],[-122.447825,37.766074],[-122.44802,37.767011],[-122.447206,37.767118],[-122.44637,37.767225],[-122.445545,37.767323],[-122.444731,37.76743],[-122.445109,37.769286],[-122.445178,37.76934]],[[-122.445178,37.76934],[-122.44535,37.770214],[-122.443654,37.770419],[-122.443321,37.770464],[-122.442003,37.770633],[-122.440364,37.770838],[-122.438714,37.771052],[-122.437052,37.771258],[-122.435379,37.771471],[-122.43374,37.771685],[-122.432101,37.77189]],[[-122.432101,37.77189],[-122.430439,37.772104],[-122.428811,37.772309],[-122.427161,37.772523],[-122.425522,37.772728],[-122.425614,37.773192],[-122.425705,37.773656],[-122.424066,37.77387],[-122.422416,37.774075],[-122.420765,37.774289],[-122.420261,37.774351]],[[-122.420261,37.774351],[-122.419263,37.775145],[-122.41869,37.775582],[-122.417509,37.776536],[-122.416294,37.777491],[-122.415927,37.777785],[-122.414746,37.778713],[-122.412521,37.78047],[-122.411982,37.780898],[-122.411627,37.781183],[-122.410297,37.782227]],[[-122.410297,37.782227],[-122.408955,37.783279],[-122.408072,37.783984],[-122.405836,37.785741],[-122.404586,37.786722],[-122.403439,37.787632],[-122.402911,37.788078],[-122.402074,37.788711],[-122.401386,37.789255],[-122.400067,37.790298],[-122.399482,37.790735]],[[-122.399482,37.790735],[-122.399149,37.791012],[-122.398266,37.791707],[-122.397394,37.792403],[-122.396511,37.793089],[-122.396305,37.79325],[-122.395628,37.793776],[-122.39407,37.792535],[-122.393186,37.793222],[-122.394114,37.794043]]]},
          {
            "type":"MultiLineString",
            "coordinates": [[[-122.430439,37.772104],[-122.432101,37.77189],[-122.43374,37.771685],[-122.435379,37.771471],[-122.437052,37.771258],[-122.438714,37.771052],[-122.440364,37.770838],[-122.442003,37.770633],[-122.443321,37.770464],[-122.443654,37.770419]],[[-122.443654,37.770419],[-122.44535,37.770214],[-122.445178,37.76934],[-122.445109,37.769286],[-122.444731,37.76743],[-122.445545,37.767323],[-122.44637,37.767225],[-122.447206,37.767118],[-122.44802,37.767011],[-122.447825,37.766074],[-122.447642,37.765146]],[[-122.447642,37.765146],[-122.448433,37.765039],[-122.449762,37.764869],[-122.451206,37.764682],[-122.452558,37.764513],[-122.453509,37.764396],[-122.454208,37.764316],[-122.455458,37.764164],[-122.455778,37.764075],[-122.456661,37.763816],[-122.457818,37.763486]],[[-122.457818,37.763486],[-122.459789,37.762933],[-122.460832,37.762629],[-122.461898,37.76237],[-122.462963,37.762317],[-122.464041,37.762272],[-122.465106,37.762227],[-122.466172,37.762174],[-122.466045,37.760318],[-122.465919,37.758444],[-122.465781,37.756588]],[[-122.465781,37.756588],[-122.465655,37.754714],[-122.465528,37.75285],[-122.466594,37.752805],[-122.466467,37.75094],[-122.466329,37.749075],[-122.467372,37.74903],[-122.468025,37.749004],[-122.468472,37.74895],[-122.468552,37.748941],[-122.469537,37.748905]],[[-122.469537,37.748905],[-122.470591,37.748869]]]},{"type":"MultiLineString","coordinates":[[[-122.394149,37.794052],[-122.394756,37.794472],[-122.395628,37.793776],[-122.396305,37.79325],[-122.396511,37.793089],[-122.397394,37.792403],[-122.398266,37.791707],[-122.399149,37.791012],[-122.399482,37.790735],[-122.400067,37.790298]],[[-122.400067,37.790298],[-122.401386,37.789255],[-122.402074,37.788711],[-122.402911,37.788078],[-122.403439,37.787632],[-122.404586,37.786722],[-122.405836,37.785741],[-122.408072,37.783984],[-122.408955,37.783279],[-122.410297,37.782227],[-122.411627,37.781183]],[[-122.411627,37.781183],[-122.411982,37.780898],[-122.412521,37.78047],[-122.414746,37.778713],[-122.415927,37.777785],[-122.416294,37.777491],[-122.417509,37.776536],[-122.41869,37.775582]]]
          }
        ]
      }
    }
  ]
}

See the example.sfmta.geojson file for a more complete example.

Details

  • A TransitJSON file is a GeoJSON file with a top-level FeatureCollection that corresponds to a single Agency. Agency metadata corresponding to GTFS are provided under properties.agency.
  • Each route in that agency is a Feature of type GeometryCollection. Route metadata is provided under properties. A route must include serviceWindows and speed properties.
  • Every route pattern (shape + stops) is provided as a MultiLineString under that GeometryCollection. Each LineString's last point should correspond to a transit stop. If serviceWindows or speed properties are provided, they will supersede the higher level values.

Todo

  • Talk to lots of people with experience, get feedback
  • Figure out how calendar data fits into the format
  • How do we represent varying speeds?
  • Build transformations between TransitJSON and GTFS, and vice versa
  • Lots more...

transitjson's People

Contributors

samhashemi avatar

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.