Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

More columns and table style tweaks

Russ Garrettc1fba317f256
diff --git a/main.py b/main.py
index e71c6ce..f60c401 100644
--- a/main.py
+++ b/main.py
@@ -102,6 +102,7 @@ async def plants_country(request, country):
plants = await database.fetch_all(
query="""SELECT osm_id, name, tags->'name:en' AS name_en, tags->'wikidata' AS wikidata,
+ tags->'plant:method' AS method, tags->'operator' AS operator,
convert_power(output) AS output,
source, ST_GeometryType(geometry) AS geom_type
FROM power_plant
diff --git a/static/main.css b/static/main.css
index 5755046..62ee096 100644
--- a/static/main.css
+++ b/static/main.css
@@ -39,7 +39,7 @@ h1 a, h2 a {
margin: 0px auto;
margin-bottom: 20px;
padding: 0px 10px;
- max-width: 1000px;
+ max-width: 1100px;
flex: 1 0 auto;
}
@@ -67,7 +67,6 @@ table {
font-size: 0.9em;
margin-top: 8px;
width: 100%;
- min-width: 600px;
table-layout: fixed;
border-collapse: collapse;
border: 1px solid #eee;
diff --git a/template_functions.py b/template_functions.py
index b5758d0..4ca747b 100644
--- a/template_functions.py
+++ b/template_functions.py
@@ -1,15 +1,16 @@
from decimal import Decimal
+from jinja2 import Markup
def format_power(val):
if val is None:
return ""
elif val >= 50e6:
- return "{:,.0f} MW".format(val / Decimal(1e6))
+ return Markup("{:,.0f} MW".format(val / Decimal(1e6)))
elif val >= 1e6:
- return "{:.2f} MW".format(val / Decimal(1e6))
+ return Markup("{:.2f} MW".format(val / Decimal(1e6)))
else:
- return "{:.0f} kW".format(val / Decimal(1e3))
+ return Markup("{:.0f} kW".format(val / Decimal(1e3)))
def osm_link(osm_id, geom_type):
diff --git a/templates/country.html b/templates/country.html
index eb7821a..8b11d1b 100644
--- a/templates/country.html
+++ b/templates/country.html
@@ -12,8 +12,8 @@ Statistics on the electricity network in {{country|country_name}} from OpenStree
<thead>
<tr>
<th>Source</th>
- <th width="150px">Output</th>
- <th width="100px">Count</th>
+ <th>Output</th>
+ <th>Count</th>
<tr>
</thead>
<tbody>
diff --git a/templates/plants_country.html b/templates/plants_country.html
index 494424f..67883bd 100644
--- a/templates/plants_country.html
+++ b/templates/plants_country.html
@@ -23,13 +23,17 @@
<caption>All {{plants|length}} {% if pretty_source %}{{pretty_source}} {% endif %}power plants in {{country|country_name}}</caption>
<thead>
<tr>
- <th>Name</th>
+ <th style="width: 300px">Name</th>
{% if english_name %}
<th>English Name</th>
{% endif %}
- <th style="width: 100px">Output</th>
- <th style="width: 150px">Source</th>
- <th style="width: 100px">Wikidata</th>
+ <th>Operator</th>
+ <th>Output</th>
+ {% if not pretty_source %}
+ <th>Source</th>
+ {% endif %}
+ <th>Method</th>
+ <th>Wikidata</th>
</tr>
</thead>
<tbody>
@@ -40,8 +44,12 @@
{% if english_name %}
<td>{{plant.name_en or ''}}</td>
{% endif %}
+ <td>{{plant.operator or ''}}</td>
<td>{{plant.output|power}}</td>
+ {% if not pretty_source %}
<td>{{plant.source}}</td>
+ {% endif %}
+ <td>{{plant.method or ''}}</td>
<td>
{% if plant.wikidata %}
<a href="https://www.wikidata.org/wiki/{{plant.wikidata}}" target="_blank">{{plant.wikidata}}</a>