Description Usage Arguments Value Author(s) References See Also Examples
Reverse geocodes a lat/lng location using Google or Baidu Maps API. Note that in most cases by
using this function you are agreeing to the Google Maps API Terms of Service
at https://cloud.google.com/maps-platform/terms/, the Baidu Maps API Terms
of Use at http://lbsyun.baidu.com/index.php?title=open/question or the
Gaode Maps API Terms of Use at https://lbs.amap.com/faq/top/notice.
Note that geocoding service may cause charges. Take care of our app key and
check the quota carefully.
1 2 3 4 |
latlng |
a location in latitude/longitude format, either a vector, list, matrix or a data.frame. The function will automatically identify the inputs and convert it to a data.frame [lat, lng] to proceed on.
|
ics |
the coordinate system of inputing location, including 'WGS-84', 'GCJ-02' and 'BD-09', which are the GCSs of Google Earth, Google Map in China and Baidu Map, respectively. For location out of China, ics is automatically set to 'WGS-84' and other values are ignored. |
output |
character, either 'address', 'addressc', 'all' or 'raw'. Default 'address'.
|
api |
use 'google', 'baidu' or 'gaode' maps api |
messaging |
turn messaging on/off. The default value is FALSE. |
time |
the time interval to revgeocode, in seconds. Default value is zero. When you revgeocode multiple locations, set a proper time interval to avoid exceeding usage limits. For details see https://developers.google.com/maps/premium/usage-limits |
use_curl |
logical, whether use |
key |
an api key must be provided when calling the Maps APIs. Default NULL, which indicates that the function will search for cache. If no match is found, a GUI wizard will be launched to enter the api key. If the API does not call for a key, set it to NA. |
auto_fix_latlng |
logical, if the latlng data is of the opposite order, whether to let the function automatically fix it. Default TRUE. |
... |
other arguments to pass to the function, dependent on
|
a data.frame with variables address or detail address components
Create: Jun Cai (cai-j12@mails.tsinghua.edu.cn), PhD student from
Center for Earth System Science, Tsinghua University
Update: Yiying Wang (wangy@aetna.com)
Google Maps API at
https://developers.google.com/maps/documentation/geocoding/intro#ReverseGeocoding
Baidu Maps API at
http://lbsyun.baidu.com/index.php?title=webapi/guide/webservice-geocoding
Gaode Map API at https://lbs.amap.com/api/webservice/guide/api/georegeo
geocode()
, set_api_key()
, geohost()
.
Refer to transform_coord
function family to read the details about
argument y
, which is consistent with latlng
.
synthesize_googlemap_api()
, synthesize_baidumap_api()
,
synthesize_gaodemap_api()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## Not run:
set_api_key(c("googlemap", "baidumap", "gaodemap"),
c(<GOOGLE MAPS API KEY>, <BAIDU MAPS API KEY>,
<GAODE MAPS API KEY>))
# reverse geocode Beijing railway station
revgeocode(c(39.90105, 116.42079), ics = 'WGS-84', output = 'address',
api = 'google')
revgeocode(c(39.90245, 116.42703), ics = 'GCJ-02', output = 'address',
api = 'google', messaging = TRUE)
revgeocode(c(39.90851, 116.43351), ics = 'BD-09', output = 'addressc',
api = 'google',)
revgeocode(c(39.90851, 116.43351), ics = 'BD-09', output = 'address',
api = 'baidu')
revgeocode(c(39.90245, 116.42703), ics = 'GCJ-02', output = 'address',
api = 'baidu',messaging = TRUE)
revgeocode(c(39.90105, 116.42079), ics = 'WGS-84', output = 'addressc',
api = 'baidu')
# reverse geocode multiple locations
latlng = data.frame(lat = c(39.99837, 39.98565),
lng = c(116.3203, 116.2998))
revgeocode(latlng, ics = 'WGS-84', output = 'all', api = 'google')
revgeocode(latlng, ics = 'WGS-84', output = 'all', api = 'google',
time = 2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.