From: Llewellyn Marshall Date: Thu, 14 Jul 2022 19:15:58 +0000 (-0400) Subject: LP1981746: add Geo::Coder::Bing to geosort application module X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=79b5e124d1956af43e9482260d0bd2d1393fd136;p=working%2FEvergreen.git LP1981746: add Geo::Coder::Bing to geosort application module Signed-off-by: Llewellyn Marshall Signed-off-by: Terran McCanna Signed-off-by: Jane Sandberg --- diff --git a/Open-ILS/src/extras/install/Makefile.debian-bullseye b/Open-ILS/src/extras/install/Makefile.debian-bullseye index 1274a6bfc6..b8da0991ac 100644 --- a/Open-ILS/src/extras/install/Makefile.debian-bullseye +++ b/Open-ILS/src/extras/install/Makefile.debian-bullseye @@ -102,6 +102,7 @@ export DEB_APACHE_DISCONF = \ export CPAN_MODULES = \ Geo::Coder::Google \ + Geo::Coder::Bing \ Business::OnlinePayment::PayPal \ String::KeyboardDistance \ Text::Levenshtein::Damerau::XS \ diff --git a/Open-ILS/src/extras/install/Makefile.debian-buster b/Open-ILS/src/extras/install/Makefile.debian-buster index 65c133373a..719eefdfc9 100644 --- a/Open-ILS/src/extras/install/Makefile.debian-buster +++ b/Open-ILS/src/extras/install/Makefile.debian-buster @@ -102,6 +102,7 @@ export DEB_APACHE_DISCONF = \ export CPAN_MODULES = \ Geo::Coder::Google \ + Geo::Coder::Bing \ Business::OnlinePayment::PayPal \ String::KeyboardDistance \ Test::MockModule \ diff --git a/Open-ILS/src/extras/install/Makefile.debian-stretch b/Open-ILS/src/extras/install/Makefile.debian-stretch index f1e46b34e3..3ba09fb927 100644 --- a/Open-ILS/src/extras/install/Makefile.debian-stretch +++ b/Open-ILS/src/extras/install/Makefile.debian-stretch @@ -101,6 +101,7 @@ export DEB_APACHE_DISCONF = \ export CPAN_MODULES = \ Geo::Coder::Google \ + Geo::Coder::Bing \ Business::OnlinePayment::PayPal \ String::KeyboardDistance \ Test::MockModule \ diff --git a/Open-ILS/src/extras/install/Makefile.fedora b/Open-ILS/src/extras/install/Makefile.fedora index 986e5b8aa2..54e1b292eb 100644 --- a/Open-ILS/src/extras/install/Makefile.fedora +++ b/Open-ILS/src/extras/install/Makefile.fedora @@ -78,6 +78,7 @@ FEDORA_RPMS = \ export CPAN_MODULES = \ Geo::Coder::OSM \ Geo::Coder::Google \ + Geo::Coder::Bing \ Excel::Writer::XLSX \ String::KeyboardDistance \ Text::Levenshtein::Damerau::XS \ diff --git a/Open-ILS/src/extras/install/Makefile.ubuntu-bionic b/Open-ILS/src/extras/install/Makefile.ubuntu-bionic index ab696f2543..0be03c4663 100644 --- a/Open-ILS/src/extras/install/Makefile.ubuntu-bionic +++ b/Open-ILS/src/extras/install/Makefile.ubuntu-bionic @@ -97,6 +97,7 @@ export DEB_APACHE_DISCONF = \ export CPAN_MODULES = \ Geo::Coder::Google \ + Geo::Coder::Bing \ Business::OnlinePayment::PayPal \ Email::Send \ MARC::Charset \ diff --git a/Open-ILS/src/extras/install/Makefile.ubuntu-focal b/Open-ILS/src/extras/install/Makefile.ubuntu-focal index 0190a05b1f..85da870669 100644 --- a/Open-ILS/src/extras/install/Makefile.ubuntu-focal +++ b/Open-ILS/src/extras/install/Makefile.ubuntu-focal @@ -98,6 +98,7 @@ export DEB_APACHE_DISCONF = \ export CPAN_MODULES = \ Geo::Coder::Google \ + Geo::Coder::Bing \ Business::OnlinePayment::PayPal \ Email::Send \ MARC::Charset \ diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Geo.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Geo.pm index 3f735e5547..173b9e692b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Geo.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Geo.pm @@ -23,6 +23,7 @@ my $have_geocoder_free = eval { }; use Geo::Coder::OSM; use Geo::Coder::Google; +use Geo::Coder::Bing; use Math::Trig qw(great_circle_distance deg2rad); use Digest::SHA qw(sha256_base64); @@ -178,6 +179,9 @@ sub retrieve_coordinates { # invoke 3rd party API for latitude/longitude lookup } elsif ($service->service_code eq 'Google') { $logger->debug("Using Geo::Coder::Google (service id $service_id)"); $geo_coder = Geo::Coder::Google->new(key => $service->api_key); + } elsif ($service->service_code eq 'Bing') { + $logger->debug("Using Geo::Coder::Bing (service id $service_id)"); + $geo_coder = Geo::Coder::Bing->new(key => $service->api_key); } else { $logger->debug("Using Geo::Coder::OSM (service id $service_id)"); $geo_coder = Geo::Coder::OSM->new(); @@ -204,6 +208,9 @@ sub retrieve_coordinates { # invoke 3rd party API for latitude/longitude lookup } elsif ($service->service_code eq 'Google') { $latitude = $location->{'geometry'}->{'location'}->{'lat'}; $longitude = $location->{'geometry'}->{'location'}->{'lng'}; + } elsif ($service->service_code eq 'Bing') { + $latitude = $location->{point}{coordinates}[0]; + $longitude = $location->{point}{coordinates}[1]; } else { $latitude = $location->{lat}; $longitude = $location->{lon};