diff --git a/generation/vec_tiles_gen.py b/generation/vec_tiles_gen.py index 3b77846..14b2e0f 100644 --- a/generation/vec_tiles_gen.py +++ b/generation/vec_tiles_gen.py @@ -18,5 +18,5 @@ runstring = f'docker run --rm -v ./data:/data {docker_img} ogr2ogr -f PMTiles {outpath} {layers_dict[layername]} -dsco MINZOOM={TILES_MIN_ZOOM} -dsco MAXZOOM={TILES_MAX_ZOOM} -progress' - print(runstring) + subprocess.run(runstring,shell=True) diff --git a/other/empty.json b/other/empty.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/other/empty.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/statistics_funcs.py b/statistics_funcs.py index da6b491..31934f5 100644 --- a/statistics_funcs.py +++ b/statistics_funcs.py @@ -60,7 +60,8 @@ def return_weblink(string_id,type='way'): return f"{string_id}" def get_year_surveydate(featuredate): - return featuredate.split('-')[0] + if featuredate: + return featuredate.split('-')[0] def double_scatter_bar(input_df,title,xs='surface',ys='smoothness',scolor=None,xh='count()',yh1='surface',yh2='smoothness',hcolor=None,fontsize=24,tooltip_fields=['element_type','id']): diff --git a/statistics_generation.py b/statistics_generation.py index 60c6859..c7bd6d8 100644 --- a/statistics_generation.py +++ b/statistics_generation.py @@ -1,30 +1,34 @@ from statistics_specs import * # reading data: +exit('Suspended Temporarily') + for category in paths_dict['data']: + if category != 'other_footways': #TODO: remove this to include this category also + print('Adaptations for:',category) - # creating additional fields + # creating additional fields - if geom_type_dict[category] == 'LineString': - create_length_field(gdfs_dict[category]) - create_weblink_field(gdfs_dict[category]) - elif geom_type_dict[category] == 'Point': - create_weblink_field(gdfs_dict[category],'Point') + if geom_type_dict[category] == 'LineString': + create_length_field(gdfs_dict[category]) + create_weblink_field(gdfs_dict[category]) + elif geom_type_dict[category] == 'Point': + create_weblink_field(gdfs_dict[category],'Point') - if 'survey:date' in gdfs_dict[category].columns: + if 'survey:date' in gdfs_dict[category].columns: - gdfs_dict[category]['Year of Survey'] = gdfs_dict[category]['survey:date'].apply(get_year_surveydate) + gdfs_dict[category]['Year of Survey'] = gdfs_dict[category]['survey:date'].apply(get_year_surveydate) - create_folder_if_not_exists(os.path.join('statistics',category)) + create_folder_if_not_exists(os.path.join('statistics',category)) - # updating info: - updating_dicts[category]['month_year'] = updating_dicts[category]['rev_month'].map("{:02d}".format) + '_' + updating_dicts[category]['rev_year'].astype(str) + # updating info: + updating_dicts[category]['month_year'] = updating_dicts[category]['rev_month'].map("{:02d}".format) + '_' + updating_dicts[category]['rev_year'].astype(str) - updating_dicts[category]['year_month'] = updating_dicts[category]['rev_year'].astype(str) + "_" + updating_dicts[category]['rev_month'].map("{:02d}".format) + updating_dicts[category]['year_month'] = updating_dicts[category]['rev_year'].astype(str) + "_" + updating_dicts[category]['rev_month'].map("{:02d}".format) - updating_dicts[category].sort_values('year_month',inplace=True) + updating_dicts[category].sort_values('year_month',inplace=True) generated_list_dict = {} charts_titles = {} @@ -57,6 +61,7 @@ Home """ +print(generated_list_dict) for category in generated_list_dict: category_homepage = get_url(generated_list_dict[category][0]) diff --git a/statistics_specs.py b/statistics_specs.py index a42169b..b16a13a 100644 --- a/statistics_specs.py +++ b/statistics_specs.py @@ -7,7 +7,11 @@ for category in paths_dict['data']: gdfs_dict[category] = gpd.read_parquet(paths_dict['data'][category]) - updating_dicts[category] = pd.read_json(paths_dict['versioning'][category]) + if os.path.exists(paths_dict['versioning'].get(category)): + updating_dicts[category] = pd.read_json(paths_dict['versioning'][category]) + else: + updating_dicts[category] = pd.DataFrame() + charts_specs = {