r - geocode result different from google maps -
i'm trying geocode different iata airport codes in italy, following (rudimentary) code in ggmap
(version 2.4)
#list of iata codes geo_apt <- c("aoi", "bgy", "blq", "bri", "cta", "fco", "lin", "mxp", "nap", "pmf", "psa", "psr", "rmi", "trn", "vce", "vrn") #preparing empty dataframe store geocodes apt_geo <- data.frame(iata=rep(na,16), lon=rep(na,16), lat=rep(na,16)) #geocoding codes (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 geocode
function of ggmap
works fine of these codes except "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've tried use revgeocode
, coordinates correspond following address:
revgeocode(as.numeric(apt_geo[12,2:3])) #information url : http://maps.googleapis.com/maps/api/geocode/json?latlng=33.948545,-81.1172588&sensor=false [1] "kentucky avenue, west columbia, sc 29170, usa"
on contrary, if go google maps, works fine:
does have clue on apparently strange phenomenon?
edit
following 1 suggestion in comments below, tried use geocode(italy psr airport)
on version 2.4 again , instead of throwing more accurate result or same result, warning got:
geocode("italy psr airport") lon lat 1 na na warning message: geocode failed status zero_results, location = "italy psr airport"
while attempt airport psr
coordinates different of psr airport
(at least time it's actual airport, although iata code lex instead of psr).
revgeocode(as.numeric(geocode("airport psr"))) information url : http://maps.googleapis.com/maps/api/geocode/json?latlng=38.0381454,-84.5970727&sensor=false [1] "3895 terminal drive, lexington, ky 40510, usa"
the whole question possible duplicate
nonetheless, don't reason api , google maps using different datasets...
Comments
Post a Comment