def test_load_streets(self): bbox = self.ZurichBellvue() loader = StreetLoader() streets = loader.load_streets(bbox) self.assertTrue(len(streets) > 50) self.assertTrue(len(loader.crosswalks) > 16) for street in streets: self.assertEquals(len(street.nodes), 2)
def load_streets(self): self.status_printer.start_load_streets() if self.tile is None: print "Download tiles first" streetLoader = StreetLoader() self.streets = streetLoader.load_streets(self.bbox) self.osm_crosswalks = streetLoader.crosswalks shuffle(self.streets) self.status_printer.set_nb_streets(len(self.streets))
def from_bbox(cls, bbox): drawer = cls() drawer.bbox = bbox tileloader = TileLoader.from_bbox(bbox) drawer.tile = tileloader.load_tile() streetloader = StreetLoader() drawer.streets = streetloader.load_streets(drawer.tile.bbox) return drawer