From 66e76b1befe86b137f9bea3d2fc6ebfce386c1ab Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 11 Feb 2025 08:28:33 +0000 Subject: [PATCH] [Bristol] Their WFS returns reversed co-ordinates. --- perllib/FixMyStreet/Cobrand/Bristol.pm | 1 + perllib/FixMyStreet/Cobrand/UKCouncils.pm | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/perllib/FixMyStreet/Cobrand/Bristol.pm b/perllib/FixMyStreet/Cobrand/Bristol.pm index a9ffd4add9..0da4d25e0c 100644 --- a/perllib/FixMyStreet/Cobrand/Bristol.pm +++ b/perllib/FixMyStreet/Cobrand/Bristol.pm @@ -198,6 +198,7 @@ sub lookup_site_code_config { version => '2.0.0', srsname => "urn:ogc:def:crs:EPSG::27700", accept_feature => sub { 1 }, + reversed_coordinates => 1, }; } diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm index 9b3b4a0ff1..d9f49ca5be 100644 --- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm +++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm @@ -513,6 +513,8 @@ _nearest_uses_latlon config key is set by lookup_site_code_config, in which case lat/lons (EPSG 4326) are used. Useful if the assets are served by e.g. Alloy, not Confirm. +Supply reversed_coordinates flag if the data from the WFS service returns +co-ordinates the wrong way round (N/E or lat/lon). =cut @@ -528,6 +530,9 @@ sub lookup_site_code { if ($cfg->{_nearest_uses_latlon}) { ($x, $y) = ($row->longitude, $row->latitude); } + if ($cfg->{reversed_coordinates}) { + ($x, $y) = ($y, $x); + } return $self->_nearest_feature($cfg, $x, $y, $features); }