def setUp(self): # this_dir = os.path.dirname(os.path.realpath(__file__)) # IN_FILE = os.path.join(this_dir, 'test_data', 'mastermap-itn_417209_0_brixton_sample.gml') self.test_data = read_gml(TEST_DATA_FILE) self.itn_net = ITNStreetNet.from_data_structure(self.test_data)
def load_network_and_pickle(): # test dataset is in a directory in the data directory called 'network_data' this_dir = os.path.join(settings.DATA_DIR, 'network_data') IN_FILE = os.path.join(this_dir, 'mastermap-itn_544003_0_camden_buff2000.gml') test_data = read_gml(IN_FILE) itn_net = ITNStreetNet.from_data_structure(test_data) camden = camden_boundary() itn_net_reduced = itn_net.within_boundary(camden.buffer(100)) outdir = os.path.join(IN_DIR, 'networks') itn_net.save(os.path.join(outdir, 'camden.net')) itn_net_reduced.save(os.path.join(outdir, 'camden_clipped.net'))
def setUp(self): self.test_data = read_gml(TEST_DATA_FILE) self.itn_net = ITNStreetNet.from_data_structure(self.test_data)
def load_test_network(): # load some toy network data test_data = read_gml(TEST_DATA_FILE) return ITNStreetNet.from_data_structure(test_data)
def test_fixed_distance_walk(self): net = toy_network() pt = NetPoint.from_cartesian(net, 2.5, 0) if __name__ == "__main__": b_plot = False # mini test dataset # test dataset is in a directory in the same path as this module called 'test_data' this_dir = os.path.dirname(os.path.realpath(__file__)) IN_FILE = os.path.join(this_dir, 'test_data', 'mastermap-itn_417209_0_brixton_sample.gml') test_data = read_gml(IN_FILE) itn_net = ITNStreetNet.from_data_structure(test_data) # buffered Camden dataset from raw data # test dataset is in a directory in the data directory called 'network_data' # this_dir = os.path.join(settings.DATA_DIR, 'network_data') # IN_FILE = os.path.join(this_dir, 'mastermap-itn_544003_0_camden_buff2000.gml') # test_data = read_gml(IN_FILE) # itn_net = ITNStreetNet.from_data_structure(test_data) # buffered Camden dataset from pickle # this_dir = os.path.dirname(os.path.realpath(__file__)) # IN_FILE = os.path.join(this_dir, 'test_data', 'mastermap-itn_544003_0_camden_buff2000.pickle') # itn_net = ITNStreetNet.from_pickle(IN_FILE) # get the spatial extent of the network
def net_data_reader(raw_filename): return itn.read_gml(raw_filename)