Skip to content

Commit

Permalink
it must be step-by-step
Browse files Browse the repository at this point in the history
  • Loading branch information
kauevestena committed Jan 17, 2024
1 parent 38a830e commit b75d7e0
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion generation/vec_tiles_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

1 change: 1 addition & 0 deletions other/empty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 2 additions & 1 deletion statistics_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def return_weblink(string_id,type='way'):
return f"<a href=https://www.openstreetmap.org/{type}/{string_id}>{string_id}</a>"

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']):

Expand Down
31 changes: 18 additions & 13 deletions statistics_generation.py
Original file line number Diff line number Diff line change
@@ -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 = {}
Expand Down Expand Up @@ -57,6 +61,7 @@
<a href="{node_homepage_url}" class="active">Home</a>
"""

print(generated_list_dict)

for category in generated_list_dict:
category_homepage = get_url(generated_list_dict[category][0])
Expand Down
6 changes: 5 additions & 1 deletion statistics_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit b75d7e0

Please sign in to comment.