mqAncientHistory / Lat-Epig

The Lat-Epig interface allows you to query the EDCS and save the search result in a TSV file and plot the results on a map of the Roman Empire without any prior knowledge of programming.
https://mybinder.org/v2/gh/mqAncientHistory/Lat-Epig/HEAD?urlpath=notebooks/EpigraphyScraper.ipynb
GNU General Public License v3.0
14 stars 0 forks source link

Mapper creates map only from the first scrape #17

Closed petrifiedvoices closed 2 years ago

petrifiedvoices commented 3 years ago

In second or any other scrape the following error message is gererated: `Starting Map Generation

No old maps to move from output_maps to old_maps. Rendering: output/2021-07-05-term1_tumulus-71.tsv 0m Making maps...

NameError Traceback (most recent call last) ~/map_interface.py in map_on_button_clicked(b) 49 50 with out: ---> 51 make_map.main() 52 datestring=datetime.datetime.now().strftime("%Y%m%d") 53 output_filename=f"epigraphy_scraper_mapsoutput{datestring}"

~/make_map.py in main() 226 for file in glob.glob(f"{DATA_DIR}/*.tsv"): 227 print(f"Rendering: {file}") --> 228 makeMap(file, roads_3857, provinces_3857, cities_geodataframe_3857) 229 makeMap(file, roads_3857, provinces_3857, cities_geodataframe_3857, cities=False, roads=False) 230 shutil.move(file, f"already_mapped_data/{file}")

/usr/local/lib/python3.8/dist-packages/yaspin/core.py in inner(*args, kwargs) 124 def inner(*args, *kwargs): 125 with self: --> 126 return fn(args, kwargs) 127 128 return inner

~/make_map.py in makeMap(data_file, roads_3857, provinces_3857, cities_geodataframe_3857, provinces, roads, cities) 126 @yaspin(text="Making maps...") 127 def makeMap(data_file, roads_3857, provinces_3857, cities_geodataframe_3857, provinces=True, roads=True, cities=True): --> 128 point_dataframe_3857 = makeDataframe(data_file) 129 130

~/make_map.py in makeDataframe(data_file, epsg) 106 # Handles multiline columns cleanly. 107 data_filename = os.path.basename(data_file) --> 108 print(f"Making {data_filename}\n\troads: {roads}\n\tprovinces: {provinces}\n\tcities: {cities}\n") 109 import_rows = extract(data_file) 110 import_dataframe = pandas.DataFrame(import_rows)

NameError: name 'roads' is not defined

Starting Map Generation

No old maps to move from output_maps to oldmaps. Rendering: output/2021-07-05-term1%+province_Aegyptus-1071.tsv 0m Making maps...

NameError Traceback (most recent call last) ~/map_interface.py in map_on_button_clicked(b) 49 50 with out: ---> 51 make_map.main() 52 datestring=datetime.datetime.now().strftime("%Y%m%d") 53 output_filename=f"epigraphy_scraper_mapsoutput{datestring}"

~/make_map.py in main() 226 for file in glob.glob(f"{DATA_DIR}/*.tsv"): 227 print(f"Rendering: {file}") --> 228 makeMap(file, roads_3857, provinces_3857, cities_geodataframe_3857) 229 makeMap(file, roads_3857, provinces_3857, cities_geodataframe_3857, cities=False, roads=False) 230 shutil.move(file, f"already_mapped_data/{file}")

/usr/local/lib/python3.8/dist-packages/yaspin/core.py in inner(*args, kwargs) 124 def inner(*args, *kwargs): 125 with self: --> 126 return fn(args, kwargs) 127 128 return inner

~/make_map.py in makeMap(data_file, roads_3857, provinces_3857, cities_geodataframe_3857, provinces, roads, cities) 126 @yaspin(text="Making maps...") 127 def makeMap(data_file, roads_3857, provinces_3857, cities_geodataframe_3857, provinces=True, roads=True, cities=True): --> 128 point_dataframe_3857 = makeDataframe(data_file) 129 130

~/make_map.py in makeDataframe(data_file, epsg) 106 # Handles multiline columns cleanly. 107 data_filename = os.path.basename(data_file) --> 108 print(f"Making {data_filename}\n\troads: {roads}\n\tprovinces: {provinces}\n\tcities: {cities}\n") 109 import_rows = extract(data_file) 110 import_dataframe = pandas.DataFrame(import_rows)

NameError: name 'roads' is not defined And If I hit the refresh button: --------------------------------------------------------------------------- AttributeError Traceback (most recent call last)

in 59 60 for file in glob.glob(f"{DATA_DIR}/*.tsv"): ---> 61 df = makeDataframe(file, epsg=4326) 62 #pprint(df) 63 map_xmin, map_ymin, map_xmax, map_ymax = df.total_bounds in makeDataframe(data_file, epsg) 48 point_geodataframe['Links'] = point_geodataframe['Links'].apply(linkify) 49 ---> 50 point_geodataframe['inscription'] = point_geodataframe['inscription'].apply(lambda x: textwrap.shorten(x, width=255)) 51 52 point_geodataframe_3857 = point_geodataframe.to_crs(epsg=epsg) /usr/local/lib/python3.8/dist-packages/pandas/core/series.py in apply(self, func, convert_dtype, args, **kwds) 4136 else: 4137 values = self.astype(object)._values -> 4138 mapped = lib.map_infer(values, f, convert=convert_dtype) 4139 4140 if len(mapped) and isinstance(mapped[0], Series): pandas/_libs/lib.pyx in pandas._libs.lib.map_infer() in (x) 48 point_geodataframe['Links'] = point_geodataframe['Links'].apply(linkify) 49 ---> 50 point_geodataframe['inscription'] = point_geodataframe['inscription'].apply(lambda x: textwrap.shorten(x, width=255)) 51 52 point_geodataframe_3857 = point_geodataframe.to_crs(epsg=epsg) /usr/lib/python3.8/textwrap.py in shorten(text, width, **kwargs) 404 """ 405 w = TextWrapper(width=width, max_lines=1, **kwargs) --> 406 return w.fill(' '.join(text.strip().split())) 407 408 AttributeError: 'NoneType' object has no attribute 'strip'`
Denubis commented 2 years ago

Resolved with today's work