Beispiel #1
0
def test_modal_subset(network):
    gdfs = gngeojson.generate_geodataframes(network.graph)
    nodes, links = gdfs['nodes'], gdfs['links']
    car = links[links.apply(lambda x: gngeojson.modal_subset(x, {'car'}), axis=1)]

    assert len(car) == 1
    assert car.loc['link_0', 'modes'] == ['car', 'walk']
Beispiel #2
0
 def modal_links_geodataframe(self, modes):
     """
     Subsets the links geodataframe on modes
     :param modes: str or set of str
     :return:
     """
     if isinstance(modes, str):
         modes = {modes}
     return self.links[self.links.apply(
         lambda x: gngeojson.modal_subset(x, modes), axis=1)]
Beispiel #3
0
 def modal_links_geodataframe(self, modes):
     """
     Subsets the links geodataframe on modes
     :param modes: str or set of str
     :return:
     """
     if isinstance(modes, str):
         modes = {modes}
     _df = self.links[self.links.apply(lambda x: gngeojson.modal_subset(x, modes), axis=1)]
     if _df.empty:
         raise EmptySpatialTree(f'No links found satisfying modes: {modes}')
     return _df