Coder Social home page Coder Social logo

GeoJSON about node-gtfs HOT 8 CLOSED

blinktaginc avatar blinktaginc commented on August 19, 2024
GeoJSON

from node-gtfs.

Comments (8)

brendannee avatar brendannee commented on August 19, 2024

Great idea. I'd live to have that implemented.

What functions do you think should return geojson?

from node-gtfs.

marcelino-m avatar marcelino-m commented on August 19, 2024

I think it makes sense for the following functions:

  • getStops
  • getStopsByRoute
  • getStopsByDistance
  • getShapesByRoute

Maybe the name could be something like funcNameAsGeoJson?

from node-gtfs.

brendannee avatar brendannee commented on August 19, 2024

Sounds good. Or, instead we could extend those functions to take an
additional optional parameter 'geojson' which can be true or false. Or it
could be called 'type' and take the argument 'geojson'.

What do you think?
On Sat, Nov 12, 2016 at 10:26 Marcelo Muñoz Araya [email protected]
wrote:

I think it makes sense for the following functions:

  • getStops
  • getStopsByRoute
  • getStopsByDistance
  • getShapesByRoute

Maybe the name could be something like funcName_AsGeoJson_?


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#66 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAF32SpERyxTVTLCP3n_4Lbm8E-9Ldd1ks5q9YZegaJpZM4KuUuq
.

from node-gtfs.

marcelino-m avatar marcelino-m commented on August 19, 2024

Ok! I agree, Let's try it that way.

2016-11-12 13:27 GMT-03:00 Brendan Nee [email protected]:

Sounds good. Or, instead we could extend those functions to take an
additional optional parameter 'geojson' which can be true or false. Or it
could be called 'type' and take the argument 'geojson'.

What do you think?
On Sat, Nov 12, 2016 at 10:26 Marcelo Muñoz Araya <
[email protected]>
wrote:

I think it makes sense for the following functions:

  • getStops
  • getStopsByRoute
  • getStopsByDistance
  • getShapesByRoute

Maybe the name could be something like funcName_AsGeoJson_?


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
<https://github.com/brendannee/node-gtfs/issues/
66#issuecomment-260111637>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAF32SpERyxTVTLCP3n_
4Lbm8E-9Ldd1ks5q9YZegaJpZM4KuUuq>
.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#66 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJuaz1NGEY1jMAzQkzSNZ4tKzs9j4HM5ks5q9ekFgaJpZM4KuUuq
.

from node-gtfs.

Sashenka avatar Sashenka commented on August 19, 2024

Hello, I'm kind of new at this so bear with me. I was also interested in an option to get an output in geoJSON. I added a geoJSON parameter which can be true or false (or anything really since I check only if it is there) which transform the result in a FeatureCollection of Points for getStops, getStopsByRoute and getStopsByDistance. You can look at it in my fork: ecaf6cd

I am not really satisfied on how I introduced the new parameter, since it is optional and there are other optional parameters I had to take into account that it can take the place of the other optional parameter. You already had some code for this case but only if there is only one optional parameter. It works but feels hacky. I would also maybe pass an options object just in case there are other optional parameters added down the line. To keep backward compatibility the optional parameters that still exist would have to stay outside the option object though.

Anyways, this is what I did so far. I'll start working on other functions like routes and maybe also try to tackle streams, this would be a nice addition though and I've been wanting to try them for a while.

from node-gtfs.

brendannee avatar brendannee commented on August 19, 2024

I like your idea of passing an options object to support other optional parameters, and for functions that already take optional parameters we could move these in. That would be part of a entirely new version of this library with breaking changes.

from node-gtfs.

brendannee avatar brendannee commented on August 19, 2024

I added some new routes to node-gtfs that are geoJSON specific. This ended up working better than adding options to the existing methods.

I added routes for getting stops and shapes from GTFS.

I also published a new package called gtfs-to-geojson that uses these routes in a handy command line tool to generate geoJSON and save it to a file.

https://github.com/brendannee/gtfs-to-geojson

Check it out and let me know what you think.

from node-gtfs.

Sashenka avatar Sashenka commented on August 19, 2024

New routes might be the better idea here to keep backward compatibility. The options object idea would be better off for a new version, as it is now it creates more problem than it solves.

Thanks by the way, this is nice work. I'm learning as I fiddle with your code :)

from node-gtfs.

Related Issues (20)

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.