Files
notifications-admin/app/templates/views/broadcast/macros/area-map.html
Chris Hill-Scott 6cb326f153 Update utils to do linear transformation of polygons
Brings in https://github.com/alphagov/notifications-utils/pull/889/files

At the moment, we are not doing any transformation of features before
applying geometric algorithms to them. This is, in effect, assuming that
the earth is flat.

This new version of utils implements the transformation of our polygons
to a Cartesian plane. In other words, it converts them from being
defined in spherical degrees to metres.

For the admin app this means we need to convert places where the code
expects things to be measured in degrees to work in metres instead.
2021-12-01 14:10:54 +00:00

41 lines
2.2 KiB
HTML

{% macro map(broadcast_message) %}
<div id="area-list-map"></div>
<p class="area-list-key area-list-key--certain">
<svg class="area-list-key__icon" width="50" height="50" viewbox="0 0 50 50" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="100%" height="100%" fill="#FFFFFF" />
<polygon points="25 5, 45 25, 25 45, 5 25" stroke="#0B0B0C" stroke-width="2" fill="#96C6E2" />
</svg>
<span class="govuk-visually-hidden">
An area of {{ (broadcast_message.simple_polygons.estimated_area)|square_metres_to_square_miles|round_to_significant_figures(1)|format_thousands }} square miles&nbsp;
</span>
Will get
<span class="govuk-visually-hidden">
the
</span>
alert
</p>
<p class="area-list-key area-list-key--likely">
<svg class="area-list-key__icon" width="50" height="50" viewbox="0 0 50 50" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="100%" height="100%" fill="#FFFFFF" />
<polygon points="25 5, 45 25, 25 45, 5 25" stroke="#005ea5" stroke-opacity="1" stroke-width="2" stroke-linecap="square" stroke-linejoin="round" stroke-dasharray="4,7.5,5,7.5,8,8,5,8,7.5,8,5,8,7,8,5,8,4" fill="#2B8CC4" fill-opacity="0.15" />
</svg>
<span class="govuk-visually-hidden">
An extra area of {{ (broadcast_message.simple_polygons_with_bleed.estimated_area - broadcast_message.simple_polygons.estimated_area)|square_metres_to_square_miles|round_to_significant_figures(1)|format_thousands }} square miles is&nbsp;
</span>
Likely to get
<span class="govuk-visually-hidden">
the
</span>
alert
</p>
<p class="area-list-key area-list-key--phone-estimate">
{% if broadcast_message.count_of_phones == 0 %}
Unknown number of phones
{% elif broadcast_message.count_of_phones == broadcast_message.count_of_phones_likely %}
{{ broadcast_message.count_of_phones|format_thousands }} phones estimated
{% else %}
{{ broadcast_message.count_of_phones|format_thousands }} to {{ broadcast_message.count_of_phones_likely|format_thousands }} phones
{% endif %}
</p>
{% endmacro %}