gtfs_kit 2.0.0__tar.gz → 2.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gtfs-kit
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: A Python 3.6+ library for analyzing GTFS feeds.
5
5
  Home-page: https://github.com/mrcagney/gtfs_kit
6
6
  License: MIT
@@ -12,4 +12,4 @@ from .validators import *
12
12
  from .feed import *
13
13
 
14
14
 
15
- __version__ = "2.0.0"
15
+ __version__ = "2.1.0"
@@ -255,7 +255,10 @@ def aggregate_stops(
255
255
  nid_by_oid.update(d)
256
256
  i += 1
257
257
 
258
- stops["stop_id"] = stops.stop_id.map(lambda x: nid_by_oid[x])
258
+ stops["stop_id"] = stops.stop_id.map(nid_by_oid)
259
+ if "parent_station" in stops:
260
+ stops["parent_station"] = stops.parent_station.map(nid_by_oid)
261
+
259
262
  stops = stops.groupby(by).first().reset_index()
260
263
  feed.stops = stops
261
264
 
@@ -485,11 +485,15 @@ def map_trips(
485
485
  color_palette: List[str] = cs.COLORS_SET2,
486
486
  *,
487
487
  include_stops: bool = False,
488
+ include_arrows: bool = False,
488
489
  ):
489
490
  """
490
491
  Return a Folium map showing the given trips and (optionally)
491
492
  their stops.
492
493
  If any of the given trip IDs are not found in the feed, then raise a ValueError.
494
+ If ``include_arrows``, then use the Folium plugin PolyLineTextPath to draw arrows
495
+ on each trip polyline indicating its direction of travel; this fails to work in some
496
+ browsers, such as Brave 0.68.132.
493
497
  """
494
498
  # Initialize map
495
499
  my_map = fl.Map(tiles="cartodbpositron")
@@ -504,6 +508,7 @@ def map_trips(
504
508
  # Create a feature group for each route and add it to the map
505
509
  for i, trip_id in enumerate(trip_ids):
506
510
  collection = trips_to_geojson(feed, [trip_id], include_stops=include_stops)
511
+
507
512
  group = fl.FeatureGroup(name=f"Trip {trip_id}")
508
513
  color = colors[i]
509
514
 
@@ -524,26 +529,24 @@ def map_trips(
524
529
 
525
530
  # Add trip
526
531
  else:
527
- prop["color"] = color
528
- path = fl.GeoJson(
529
- f,
530
- name=trip_id,
531
- style_function=lambda x: {"color": x["properties"]["color"]},
532
+ path = fl.PolyLine(
533
+ [[x[1], x[0]] for x in f["geometry"]["coordinates"]],
534
+ color=color,
535
+ popup=hp.make_html(prop),
532
536
  )
533
- path.add_child(fl.Popup(hp.make_html(prop)))
537
+
534
538
  path.add_to(group)
535
539
  bboxes.append(sg.box(*sg.shape(f["geometry"]).bounds))
536
540
 
537
- # if include_arrows:
538
- # # Direction arrows, assuming, as GTFS does, that
539
- # # trip direction equals LineString direction
540
- # fp.PolyLineTextPath(
541
- # path,
542
- # " \u27A4 ",
543
- # repeat=True,
544
- # offset=5.5,
545
- # attributes={"fill": color, "font-size": "18"},
546
- # ).add_to(group)
541
+ # Direction arrows, assuming, as GTFS does, that
542
+ # trip direction equals LineString direction
543
+ fp.PolyLineTextPath(
544
+ path,
545
+ " \u27A4 ",
546
+ repeat=True,
547
+ offset=5.5,
548
+ attributes={"fill": color, "font-size": "18"},
549
+ ).add_to(group)
547
550
 
548
551
  group.add_to(my_map)
549
552
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "gtfs_kit"
3
- version = "2.0.0"
3
+ version = "2.1.0"
4
4
  description = "A Python 3.6+ library for analyzing GTFS feeds."
5
5
  authors = ["Alex Raichev <araichev@mrcagney.com>"]
6
6
  readme = "README.rst"
@@ -19,7 +19,7 @@ install_requires = \
19
19
 
20
20
  setup_kwargs = {
21
21
  'name': 'gtfs-kit',
22
- 'version': '2.0.0',
22
+ 'version': '2.1.0',
23
23
  'description': 'A Python 3.6+ library for analyzing GTFS feeds.',
24
24
  'long_description': 'GTFS Kit\n********\n.. image:: https://travis-ci.org/mrcagney/gtfs_kit.svg?branch=master\n :target: https://travis-ci.org/mrcagney/gtfs_kit\n\nGTFS Kit is a Python 3.6+ kit for analyzing `General Transit Feed Specification (GTFS) <https://en.wikipedia.org/wiki/GTFS>`_ data in memory without a database.\nIt uses Pandas and Shapely to do the heavy lifting.\n\nThis project supersedes `GTFSTK <https://github.com/mrcagney/gtfstk>`_.\n\n\nInstallation\n=============\n``pip install gtfs_kit``.\n\n\nExamples\n========\nYou can play with ``ipynb/examples.ipynb`` in a Jupyter notebook.\n\n\nAuthors\n=========\n- Alex Raichev, 2019-09\n\n\nDocumentation\n=============\nOn Github Pages `here <https://mrcagney.github.io/gtfs_kit_docs>`_.\n\n\nNotes\n=====\n- Development status is Alpha\n- This project uses semantic versioning\n- Thanks to `MRCagney <http://www.mrcagney.com/>`_ for donating to this project\n- Constructive feedback and code contributions welcome. Please issue pull requests into the ``develop`` branch and include tests.\n',
25
25
  'author': 'Alex Raichev',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes