trufi-core icon indicating copy to clipboard operation
trufi-core copied to clipboard

Which lines run near my position

Open annikabock opened this issue 5 years ago • 12 comments

As passenger, I want to know which lines are passing by my current place. Die Idee war so ein bißchen, dass man direkt nach dem Öffnen der App sieht, welche Linien grundsätzlich am Standort vorbeiführen.

annikabock avatar Sep 04 '18 07:09 annikabock

Check the index Api for routes and stops: http://trufiapp.westeurope.cloudapp.azure.com:8080/otp/routers/default/index/stops

annikabock avatar Sep 06 '18 07:09 annikabock

some doku http://dev.opentripplanner.org/apidoc/0.15.0/resource_IndexAPI.html

annikabock avatar Sep 06 '18 07:09 annikabock

@natalyablanco does this function help? This /routers/{routerId}/index/stops/{stopId}/routes

annikabock avatar Sep 10 '18 07:09 annikabock

yes! I saw that on Friday. I wanna integrate that endpoint today. The response is [{"id":"1:108","shortName":"104","longName":"E-Se (Taxi trufi)","mode":"BUS","color":"00FF66","agencyName":"Sindicato 1ro de mayo"},{"id":"1:107","shortName":"104","longName":"So-E (Taxi trufi)","mode":"BUS","color":"00FF66","agencyName":"Sindicato 1ro de mayo"}]

I assume we want to show the shortName, right?

natalyablanco avatar Sep 10 '18 07:09 natalyablanco

We discussed this feature before and decided to skip it in the mobile app because the added value for the user might not be high enough compared to the data volume and a more complicated interface.

aemkei avatar Sep 10 '18 07:09 aemkei

Also a hint: the link above refers to an older API. You might want to use 1.0 instead of 0.15:

http://dev.opentripplanner.org/apidoc/1.0.0/

aemkei avatar Sep 10 '18 08:09 aemkei

Thanks for the link! I agree, it seems to be too much to get such a simple information. Maybe with a cleaver design we could add this information later on. I'll keep the branch just in case. :)

natalyablanco avatar Sep 10 '18 09:09 natalyablanco

I thought about a map tiles overlay which shows the routes when no plan is loaded.

RaimundWege avatar Sep 10 '18 09:09 RaimundWege

I also have a GeoJSON and TopJSON file with all the lines:

trufi-lines.zip

You can drag this into http://geojson.io/ to see all the lines:

image

aemkei avatar Sep 10 '18 09:09 aemkei

Looks like /index/stops in combination with /index/routes will get us all the data that is needed. We could also generate a more condensed version daily and have the app download it alongside the search data.

mdoelker avatar Feb 16 '19 18:02 mdoelker

Hmm looked into it a bit more and its not easy to relate them with these endpoints. Having looked into graphql a bit lately I was able to extract the information from the graphql endpoint though pretty easily.

I have also added a script that would convert the data to GeoJSON. (Commit: https://gitlab.com/truffi/data/commit/4578dd1a60b3b0d82e6d8daba949548ea2cdc57c#350e8112e6566b11242ec308a403ff2cb16e747c)

The GraphQL query I used is:

  {
    routes {
      shortName,
      longName,
      color,
      agency {
        name
      },
      stops {
        lat, lon
      }
    }
  }

Details how to request the data in https://gitlab.com/truffi/data/blob/master/src/export-lines-geojson.js

This gave me a slightly updated map. I am excited to see it when we have the OSM routes as well :D image

I suggest we consume the endpoint from within the app and cache the result a while.

More info on how to get types & fields: https://graphql.org/learn/introspection/

mdoelker avatar Feb 16 '19 19:02 mdoelker

We have to query the lines in a way that returns them only for the area we look at though if we keep adding new cities. Will check if the graphql endpoint makes that possible.

mdoelker avatar Feb 19 '19 09:02 mdoelker

Closing this due to topic inactivity.

Internal future strategy: Attracting more women to work on technical tasks like @annikabock or @natalyablanco . Check reactivation of gender diversity.

ValorNaram avatar Jun 23 '23 15:06 ValorNaram