diff options
author | Struan Donald <struan@exo.org.uk> | 2018-03-15 12:28:21 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2018-03-29 16:04:32 +0100 |
commit | 9e806177d239f20ce3b11bf220800b0623ebc075 (patch) | |
tree | 63a14f137c010cd6173e6c90ec6b47eb1a919b2f /perllib/Open311/GetServiceRequests.pm | |
parent | a540e87605871ffaa869cb987039d12c79f3b28c (diff) |
optionally convert from EPSG:27700 to WGS84 on report import
When pulling reports in over Open311 it's sometimes useful to be able to
accept reports with Easting/Northing rather than latitude/longitude.
This adds an option to GetServiceRequests to convert them as they
come in.
Diffstat (limited to 'perllib/Open311/GetServiceRequests.pm')
-rw-r--r-- | perllib/Open311/GetServiceRequests.pm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/perllib/Open311/GetServiceRequests.pm b/perllib/Open311/GetServiceRequests.pm index 2a82c64a1..df96df91e 100644 --- a/perllib/Open311/GetServiceRequests.pm +++ b/perllib/Open311/GetServiceRequests.pm @@ -11,6 +11,7 @@ has start_date => ( is => 'ro', default => sub { undef } ); has end_date => ( is => 'ro', default => sub { undef } ); has verbose => ( is => 'ro', default => 0 ); has schema => ( is =>'ro', lazy => 1, default => sub { FixMyStreet::DB->schema->connect } ); +has convert_latlong => ( is => 'rw', default => 0 ); sub fetch { my $self = shift; @@ -76,6 +77,10 @@ sub create_problems { if mySociety::Config::get('MAPIT_GENERATION'); my ($latitude, $longitude) = ( $request->{lat}, $request->{long} ); + + ($latitude, $longitude) = Utils::convert_en_to_latlon_truncated( $longitude, $latitude ) + if $self->convert_latlong; + my $all_areas = mySociety::MaPit::call( 'point', "4326/$longitude,$latitude", %params ); @@ -146,8 +151,8 @@ sub create_problems { state => $state, postcode => '', used_map => 1, - latitude => $request->{lat}, - longitude => $request->{long}, + latitude => $latitude, + longitude => $longitude, areas => ',' . $body->id . ',', bodies_str => $body->id, send_method_used => 'Open311', |