Skip to content
Permalink
Browse files

Added support for OpenCage

  • Loading branch information...
nigelhorne committed Oct 9, 2019
1 parent 557b3ea commit f29ca956a3124fb85cb025f1a612be5a13b059dd
Showing with 14 additions and 4 deletions.
  1. +1 −0 Changes
  2. +2 −0 MANIFEST
  3. +2 −1 Makefile.PL
  4. +9 −3 lib/Geo/Coder/List.pm
@@ -2,6 +2,7 @@ Revision history for Geo-Coder-List

0.26
Fix reverse_coding of Canada
Added support for OpenCage

0.25 Sat 20 Apr 21:24:01 EDT 2019
Specify a minimum level of Perl
@@ -17,6 +17,7 @@ t/coverage.t
t/critic.t
t/cv.t
t/dist.t
t/free.t
t/geofarm.t
t/geonames.t
t/google.t
@@ -26,6 +27,7 @@ t/kwalitee.t
t/list.t
t/manifest.t
t/noplan.t
t/opencage.t
t/osm.t
t/ovi.t
t/pod-cm.t
@@ -34,6 +34,7 @@ if($online_tests) {
# $test_requires->{'Geo::Coder::Google::V3'} = 0.10;
$test_requires->{'Geo::Coder::OSM'} = 0;
$test_requires->{'Geo::Coder::CA'} = 0;
$test_requires->{'Geo::Coder::OpenCage'} = 0;
$test_requires->{'Geo::Coder::GeocodeFarm'} = 0;
$test_requires->{'Geo::Coder::Ovi'} = 0;
$test_requires->{'Geo::Coder::Postcodes'} = 0;
@@ -85,7 +86,7 @@ WriteMakefile(
sub are_online
{
my $s = IO::Socket::INET->new(
PeerAddr => 'geocode.xyz:443',
PeerAddr => 'openstreetmap.org:443',
Timeout => 10
);
if($s) {
@@ -306,9 +306,15 @@ sub geocode {
$l->{geometry}{location}{lat} = $l->{properties}{geoLatitude};
$l->{geometry}{location}{lng} = $l->{properties}{geoLongitude};
} elsif($l->{'results'}[0]->{'geometry'}) {
# DataScienceToolkit
$l->{'geometry'}{'location'}{'lat'} = $l->{'results'}[0]->{'geometry'}->{'location'}->{'lat'};
$l->{'geometry'}{'location'}{'lng'} = $l->{'results'}[0]->{'geometry'}->{'location'}->{'lng'};
if($l->{'results'}[0]->{'geometry'}->{'location'}) {
# DataScienceToolkit
$l->{'geometry'}{'location'}{'lat'} = $l->{'results'}[0]->{'geometry'}->{'location'}->{'lat'};
$l->{'geometry'}{'location'}{'lng'} = $l->{'results'}[0]->{'geometry'}->{'location'}->{'lng'};
} else {
# OpenCage
$l->{'geometry'}{'location'}{'lat'} = $l->{'results'}[0]->{'geometry'}->{'lat'};
$l->{'geometry'}{'location'}{'lng'} = $l->{'results'}[0]->{'geometry'}->{'lng'};
}
} elsif($l->{'RESULTS'}) {
# GeoCodeFarm
$l->{geometry}{location}{lat} = $l->{'RESULTS'}[0]{'COORDINATES'}{'latitude'};

0 comments on commit f29ca95

Please sign in to comment.
You can’t perform that action at this time.