Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ua.network.integrate_network drops transit_nodes.stop_names #32

Open
SKalt opened this issue Jul 2, 2017 · 3 comments
Open

ua.network.integrate_network drops transit_nodes.stop_names #32

SKalt opened this issue Jul 2, 2017 · 3 comments

Comments

@SKalt
Copy link

SKalt commented Jul 2, 2017

Description of the bug

calling with downloaded osm network data overwrites the network's transit_nodes.stop_names

GTFS feed or OSM data (optional)

While I think this issue is pandas-only, for the sake of testing, here's what I used:
bbox=(-72.720566,42.221907,-72.464134,42.441194)
{'gtfs_feeds': {'PVTA': 'http://www.gtfs-data-exchange.com/agency/pvta/latest.zip'}}

Environment

  • Operating system:
    Ubuntu 16.04
  • Python version:
    2.7
  • UrbanAccess version:
    0.1a
  • UrbanAccess required packages versions (optional):

Paste the code that reproduces the issue here:

# ripped nearly exactly from the demo
import urbanaccess as ua
from urbanaccess.config import settings
from urbanaccess.gtfsfeeds import feeds
from urbanaccess import gtfsfeeds
from urbanaccess.gtfs.gtfsfeeds_dataframe import gtfsfeeds_dfs
from urbanaccess.network import ua_network, load_network

settings.log_console = True
# main 
gtfsfeeds.search(search_text='Pioneer Valley',
                 search_field=None,
                 match='contains',
                 add_feed=True,
                 overwrite_feed=True)
gtfsfeeds.download()
validation = True
verbose = True
append_definitions = True
bbox=(-72.720566,42.221907,-72.464134,42.441194)

loaded_feeds = ua.gtfs.load.gtfsfeed_to_df(
    gtfsfeed_path=None,
    validation=validation,
    bbox=bbox,
    remove_stops_outsidebbox=True,
    verbose=verbose,
    append_definitions=append_definitions
)

ua.gtfs.network.create_transit_net(
    gtfsfeeds_dfs=loaded_feeds,
    day='monday',
    timerange=['07:00:00', '10:00:00'],
    calendar_dates_lookup=None
)
urbanaccess_net = ua.network.ua_network
nodes, edges = ua.osm.load.ua_network_from_bbox(
    bbox=bbox,
    remove_lcn=True
)
ua.osm.network.create_osm_net(
    osm_edges=edges,
    osm_nodes=nodes,
    travel_speed_mph=3
)
ua.gtfs.headways.headways(
    gtfsfeeds_df=loaded_feeds,
    headway_timerange=['07:00:00','10:00:00']
)
ua.network.integrate_network(
    urbanaccess_network=urbanaccess_net,
    headways=True,
    urbanaccess_gtfsfeeds_df=loaded_feeds,
    headway_statistic='mean'
)

Commenting ua.network.integrate_network(...) retains the stop_names in urbanaccess_net.transit_nodes. loaded_feeds retains stop_names.

@SKalt
Copy link
Author

SKalt commented Jul 2, 2017

I tried integrating the osm_net before integrating the headways, as in the demo.ipynb, but it yielded the same result. The deletion of stop_names still occurs at integrate_network with headways=True, urbanaccess_gtfsfeeds_df=loaded_feeds.
I've noticed the from and to columns in net_edges are now concatenations of the original stop ids and unique_route_ids.

@SKalt
Copy link
Author

SKalt commented Jul 3, 2017

I found the code at fault around network.py line 153, where transit_edges.from and .to, are overwritten, as is transit_nodes with _route_id_to_node. I'd recommend retaining the original node ids in separate column for joining on the feeds.stop_id.

@sablanchard
Copy link
Contributor

Thanks @SKalt we will look into making this change in the next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants