Geocoding result is different from Google maps

I am trying to geocode various IATA airport codes in Italy with the following (rudimentary) code in ggmap

(version 2.4)

#list of all IATA codes
geo_apt <- c("AOI", "BGY", "BLQ", "BRI", "CTA", "FCO", "LIN", "MXP", "NAP", 
"PMF", "PSA", "PSR", "RMI", "TRN", "VCE", "VRN")

#preparing an empty dataframe to store the geocodes
apt_geo <- data.frame(IATA=rep(NA,16), lon=rep(NA,16), lat=rep(NA,16))

#geocoding the codes
for (i in seq_along(geo_apt)) {
  apt_geo[i,1] <- geo_apt[i]
  apt_geo[i,2] <- (geocode(paste(geo_apt[i],"airport")))[1]
  apt_geo[i,3] <- (geocode(paste(geo_apt[i],"airport")))[2]
}

      

and the function geocode

ggmap

works fine with all these codes, except for "PSR"

   IATA        lon      lat
1   AOI  13.363752 43.61654
2   BGY   9.703631 45.66957
3   BLQ  11.287859 44.53452
4   BRI  16.765202 41.13751
5   CTA  15.065775 37.46730
6   FCO  12.246238 41.79989
7   LIN   9.276308 45.45218
8   MXP   8.725531 45.63006
9   NAP  14.286579 40.88299
10  PMF  10.295935 44.82326
11  PSA  10.397884 43.68908
12  PSR -81.117259 33.94855  #<- doens't work
13  RMI  12.618819 44.02289
14  TRN   7.647867 45.19654
15  VCE  12.339771 45.50506
16  VRN  10.890141 45.40000

      

I tried to use revgeocode

and these coordinates correspond to the following address:

revgeocode(as.numeric(apt_geo[12,2:3]))
#Information from URL : http://maps.googleapis.com/maps/api/geocode/json?latlng=33.948545,-81.1172588&sensor=false
[1] "Kentucky Avenue, West Columbia, SC 29170, USA" 

      

Conversely, if I go to google maps, it works great:

Pescara airport map

Does anyone have a clue to this apparently strange phenomenon?

EDIT

Following one suggestion in the comments below, I tried to use again geocode(italy PSR airport)

in version 2.4 and instead of throwing a more accurate result or even the same result, this is the warning I got:

geocode("italy PSR airport")
  lon lat
1  NA  NA
Warning message:
geocode failed with status ZERO_RESULTS, location = "italy PSR airport" 

      

and when trying, the airport PSR

coordinates even differ from the coordinates PSR airport

(at least this time it is the actual airport, although its code is IATA LEX instead of PSR).

revgeocode(as.numeric(geocode("airport PSR")))
Information from URL : http://maps.googleapis.com/maps/api/geocode/json?latlng=38.0381454,-84.5970727&sensor=false
[1] "3895 Terminal Drive, Lexington, KY 40510, USA"

      

+3


source to share


1 answer


The whole question is a possible duplicate



However, I have no reason why API maps and google maps use different datasets ...

0


source







All Articles