geohost: IP address lookup

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/geoCoord.R

Description

geocodes an IP address using either freegeoip.net http://freegeoip.net or ipinfo.io http://ipinfo.io/developers IP lookup API.

Usage

1
geohost(ip = "", api = c("freegeoip.net", "ipinfo.io"))

Arguments

ip

a character vector specifying an IP (e.g., "12.215.42.19"). The default value is no IP is specified and the host IP is used.

api

use freegeoip.net or ipinfo.io IP lookup API. By default freegeoip.net is used.

Details

note that freegeoip.net API is allowed up to 10,000 queries per hour by default, ipinfo API is limited to 1,000 requests per day.

Value

a vector with information of ip, country_code, country_name, region_code, city, zip_code, time_zone, latitude, longitude and metro_code for freegeoip.net API, of ip, hostname, city, region, country, loc, org, postal and phone for ipinfo.io IP lookup API. If numerous IPs are inputted, a data.frame is returned.

Author(s)

Jun Cai (cai-j12@mails.tsinghua.edu.cn), PhD student from Center for Earth System Science, Tsinghua University

References

freegeoip.net IP lookup API at http://freegeoip.net#' ipinfo.io IP lookup API at http://ipinfo.io/developers

See Also

geocode, revgeocode.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
# geocode host IP
geohost()
geohost(api = "ipinfo.io")
# specify an IP for geocoding
geohost(ip = "12.215.42.19")
geohost(ip = "12.215.42.19", api = "ipinfo.io")
# geocode multiple IPs
geohost(ip = c("61.135.169.81", "12.215.42.19"))
geohost(ip = c("61.135.169.81", "12.215.42.19"), api = "ipinfo.io")

## End(Not run)

madlogos/recharts2 documentation built on May 21, 2019, 11:03 a.m.