Description Usage Arguments Value Author(s) References See Also Examples
geocodes an address using Google, Baidu or Gaode 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 |
address |
a character vector specifying the locations of interest (e.g., "Tsinghua Univeristy"). |
output |
character, either'latlng', 'latlngc', 'latlnga', 'all' or 'raw'. Default 'latlng'.
|
api |
character, the API to use ("google", "baidu" or "gaode"). Default 'google'. When using Baidu or Gaode Maps API, the address must be in Chinese. |
ocs |
output coordinate systems including 'WGS-84', 'GCJ-02' and 'BD-09', which are the GCSs of Google Earth, Google Map in China and Baidu Map, respectively. For address out of China, ocs is automatically set to 'WGS-84' and other values are igored. Default 'WGS-84'. |
messaging |
turn messaging on/off. Default FALSE. |
time |
the time interval to geocode, in seconds. Default value is zero. When you geocode multiple addresses, 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 |
idf |
logical, whether add an identifier column to the result . If
TRUE, |
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. |
... |
other arguments to pass to the function, dependent on
|
a data.frame with variables lat/lng or more info
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 guide:
https://developers.google.com/maps/documentation/geocoding/start?csw=1
Baidu Maps API guide:
http://lbsyun.baidu.com/index.php?title=webapi/guide/webservice-geocoding
Gaode (Amap) Map API guide: https://lbs.amap.com/api/webservice/guide/api/georegeo
revgeocode()
, set_api_key()
,
geohost()
, parse_geocodes()
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 28 29 30 31 32 | ## Not run:
aseskit::set_api_key(c("googlemap", "baidumap", "gaodemap"),
c(<GOOGLE MAPS API KEY>, <BAIDU MAPS API KEY>,
<GAODE MAPS API KEY>))
geocode('Tsinghua University', api='google', ocs='GCJ-02')
geocode('Tsinghua University', api='google', ocs='WGS-84',
messaging=TRUE)
geocode('Beijing railway station', output='latlngc', api='google',
ocs='WGS-84')
geocode('Beijing railway station', output='latlnga', api='google',
ocs='WGS-84')
geocode(c('Tsinghua University', 'Beijing railway station'), api='google',
ocs='GCJ-02')
geocode(c('Tsinghua University', 'Beijing railway station'),
output='latlngc', api='google', ocs='WGS-84', messaging=TRUE)
geocode(c('Tsinghua University', 'Beijing railway station'),
output='latlnga', api='google', ocs='WGS-84', messaging=TRUE)
geocode(c('Tsinghua University', 'Beijing railway station'),
output='latlngc', api='google', ocs='WGS-84', messaging=TRUE,
time=2)
geocode('Beijing railway station', api='baidu', ocs='BD-09')
geocode('Beijing railway station', api='baidu', ocs='GCJ-02',
messaging=TRUE)
geocode('Beijing railway station', output='latlngc', api='baidu',
ocs='BD-09')
geocode(c('Tsinghua University', 'Beijing railway station'), api='baidu',
ocs='BD-09')
geocode(c('Tsinghua University', 'Beijing railway station'),
output='latlngc', api='baidu', ocs='WGS-84')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.