mirror of
https://forge.chapril.org/tykayn/parking-land
synced 2025-06-20 01:44:42 +02:00
38 lines
1.6 KiB
Python
38 lines
1.6 KiB
Python
import json
|
|
from jinja2 import Environment, FileSystemLoader
|
|
|
|
def generate_html_from_json(json_file, output_html):
|
|
with open(json_file, 'r') as file:
|
|
data = json.load(file)
|
|
|
|
# Configuration de Jinja2
|
|
env = Environment(loader=FileSystemLoader('.'))
|
|
template = env.get_template('template.html')
|
|
|
|
# Rendu du template avec les données
|
|
html_content = template.render(
|
|
city_name=data.get("city_name", "la ville"),
|
|
longueur_route_km=data["longueur_route_km"],
|
|
road_cycleway_km=data["road_cycleway_km"],
|
|
compte_highways=data["compte_highways"],
|
|
surface_route_km2=data["surface_route_km2"],
|
|
compte_piste_cyclable=data["compte_piste_cyclable"],
|
|
roundabout_count=data["roundabout_count"],
|
|
mini_roundabout_count=data["mini_roundabout_count"],
|
|
building_count=data["building_count"],
|
|
building_area=data["building_area"],
|
|
surface_parking_km2=data["surface_parking_km2"],
|
|
surface_bicycle_parking_km2=data["surface_bicycle_parking_km2"],
|
|
car_parking_capacity_provided=data["car_parking_capacity_provided"],
|
|
building_size_counts=data["building_size_counts"],
|
|
charging_stations=data["charging_stations"],
|
|
charging_stations_with_capacity_count=data["charging_stations_with_capacity_count"],
|
|
charging_stations_capacity_provided=data["charging_stations_capacity_provided"],
|
|
charging_points=data["charging_points"]
|
|
)
|
|
|
|
with open(output_html, 'w') as html_file:
|
|
html_file.write(html_content)
|
|
|
|
if __name__ == "__main__":
|
|
generate_html_from_json('summary_results.json', 'summary_results.html')
|