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.
This commit is contained in:
Chris Hill-Scott
2021-08-03 18:46:30 +01:00
parent 6b52735dac
commit 6cb326f153
16 changed files with 99 additions and 80 deletions

View File

@@ -221,7 +221,8 @@ class BroadcastMessage(JSONModel):
polygons = Polygons(
list(itertools.chain(*(
getattr(area, area_attribute) for area in self.areas
)))
))),
utm_crs=self.areas[0].polygons.utm_polygons.utm_crs,
)
if area_attribute != 'polygons' and len(self.areas) > 1:
# Were combining simplified polygons from multiple areas so we