Type: | Package |
Title: | An Interface to the 'AutoNavi Maps' API Geocoding Services |
Version: | 0.6.0 |
Description: | Getting and parsing data of location geocode/reverse-geocode and administrative regions from 'AutoNavi Maps'https://lbs.amap.com/api/webservice/summary API. |
License: | MIT + file LICENSE |
Depends: | R (≥ 3.5) |
Imports: | httr, jsonlite, magrittr, sjmisc, stats, xml2, data.table, furrr |
Suggests: | stringr, knitr, rmarkdown, testthat, spelling, covr |
VignetteBuilder: | knitr |
Encoding: | UTF-8 |
RoxygenNote: | 7.1.1 |
Language: | en-US |
URL: | https://github.com/womeimingzi11/amapGeocode |
BugReports: | https://github.com/womeimingzi11/amapGeocode/issues |
NeedsCompilation: | no |
Packaged: | 2021-04-19 07:05:41 UTC; chenhan |
Author: | Han Chen [aut, cre], Wanyanhan Jiang [ctb] |
Maintainer: | Han Chen <chenhan28@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2021-04-19 07:20:02 UTC |
Pipe operator
Description
See magrittr::%>%
for details.
Usage
lhs %>% rhs
Convert coordinate from different coordinate systems to AutoNavi system
Description
This function is a wrap of coordinate convert API of AutoNavi Map Service.
While how to input the origin coordinate is sill unstable and
95% sure that it will have a breaking change in the future.
Please consider carefully if introduced this function in product environment.
Usage
convertCoord(
locations,
key = NULL,
coordsys = NULL,
sig = NULL,
output = "data.table",
keep_bad_request = TRUE,
...
)
Arguments
locations |
Required. |
key |
Optional. |
coordsys |
Optional. |
sig |
Optional. |
output |
Optional. |
keep_bad_request |
Optional. |
... |
Optional. |
Value
Returns a JSON, XML or data.table of results containing detailed geocode information. See https://lbs.amap.com/api/webservice/guide/api/convert for more information.
See Also
Examples
## Not run:
library(amapGeocode)
# Before the `convertCoord()` is executed,
# the token should be set by `option(amap_key = 'key')`
# or set by key argument in `convertCoord()`
# get result of converted coordinate system as a data.table
convertCoord("116.481499,39.990475", coordsys = "gps")
# get result of converted coordinate system as a XML
convertCoord("116.481499,39.990475", coordsys = "gps", to_table = FALSE)
## End(Not run)
Convert an individual coordinate from different coordinate systems to AutoNavi system
Description
Convert an individual coordinate from different coordinate systems to AutoNavi system
Usage
convertCoord.individual(
locations,
key = NULL,
coordsys = NULL,
sig = NULL,
output = "data.table",
keep_bad_request = TRUE,
...
)
Arguments
locations |
Required. |
key |
Optional. |
coordsys |
Optional. |
sig |
Optional. |
output |
Optional. |
keep_bad_request |
Optional. |
... |
Optional. |
Value
Returns a JSON, XML or data.table of results containing detailed geocode information. See https://lbs.amap.com/api/webservice/guide/api/convert for more information.
Get Subordinate Administrative Region from getAdmin request Now, it only support extract the first layer of subordinate administrative region information.
Description
Get Subordinate Administrative Region from getAdmin request Now, it only support extract the first layer of subordinate administrative region information.
Usage
extractAdmin(res)
Arguments
res |
Response from getAdmin. |
Value
Returns a data.table which extracts detailed subordinate administrative region information from results of getCoord. See https://lbs.amap.com/api/webservice/guide/api/district for more information.
See Also
Examples
## Not run:
library(dplyr)
library(amapGeocode)
# Before the `getAdmin()` is executed,
# the token should be set by `option(amap_key = 'key')`
# or set by key argument in `getAdmin()`
# Get subordinate administrative regions as a XML
getAdmin("Sichuan Province", output = "XML") %>%
# extract subordinate administrative regions as a data.table
extractAdmin()
## End(Not run)
Extract converted coordinate points from convertCoord request
Description
Extract converted coordinate points from convertCoord request
Usage
extractConvertCoord(res)
Arguments
res |
Required. |
Value
Returns a data.table which extracts converted coordinate points from request of convertCoord. See https://lbs.amap.com/api/webservice/guide/api/convert for more information.
See Also
Examples
## Not run:
library(dplyr)
library(amapGeocode)
# Before the `convertCoord()` is executed,
# the token should be set by `option(amap_key = 'key')`
# or set by key argument in `convertCoord()`
# get result of converted coordinate system as a XML
convertCoord("116.481499,39.990475", coordsys = "gps", to_table = FALSE) %>%
# extract result of converted coordinate system as a data.table
extractConvertCoord()
## End(Not run)
Extract coordinate from location request
Description
Extract coordinate from location request
Usage
extractCoord(res)
Arguments
res |
Required. |
Value
Returns a data.table which extracts detailed coordinate information from results of getCoord. See https://lbs.amap.com/api/webservice/guide/api/georegeo for more information.
See Also
Examples
## Not run:
library(dplyr)
library(amapGeocode)
# Before the `getCoord()` is executed,
# the token should be set by `option(amap_key = 'key')`
# or set by key argument in `getCoord()`
# Get geocode as a XML
getCoord("IFS Chengdu", output = "XML") %>%
# extract geocode regions as a data.table
extractCoord()
## End(Not run)
Extract location from coordinate request
Description
Extract location from coordinate request
Usage
extractLocation(res)
Arguments
res |
Required. |
Value
Returns a data.table which extracts detailed location information from results of getLocation. See https://lbs.amap.com/api/webservice/guide/api/georegeo for more information.
See Also
Examples
## Not run:
library(dplyr)
library(amapGeocode)
# Before the `getLocation()` is executed,
# the token should be set by `option(amap_key = 'key')`
# or set by key argument in `getLocation()`
# Get reverse-geocode as a XML
getLocation(104.043284, 30.666864, output = "XML") %>%
# extract reverse-geocode regions as a table
extractLocation()
## End(Not run)
Get Subordinate Administrative Regions from location
Description
Get Subordinate Administrative Regions from location
Usage
getAdmin(
keywords,
key = NULL,
subdistrict = NULL,
page = NULL,
offset = NULL,
extensions = NULL,
filter = NULL,
callback = NULL,
output = "data.table",
keep_bad_request = TRUE,
...
)
Arguments
keywords |
Required. |
key |
Optional. |
subdistrict |
Optional. |
page |
Optional. |
offset |
Optional. |
extensions |
Optional. |
filter |
Optional. |
callback |
Optional. |
output |
Optional. |
keep_bad_request |
Optional. |
... |
Optional. |
Value
Returns a JSON or XML of results containing detailed subordinate administrative region information. See https://lbs.amap.com/api/webservice/guide/api/district for more information.
See Also
Examples
## Not run:
library(amapGeocode)
# Before the `getAdmin()` is executed,
# the token should be set by `option(amap_key = 'key')`
# or set by key argument in `getAdmin()`
# Get subordinate administrative regions as a data.table
getAdmin("Sichuan Province")
# Get subordinate administrative regions as a XML
getCoord("Sichuan Province", output = "XML")
## End(Not run)
Get an individual data.table of Subordinate Administrative Regions from location
Description
Get an individual data.table of Subordinate Administrative Regions from location
Usage
getAdmin.individual(
keywords,
key = NULL,
subdistrict = NULL,
page = NULL,
offset = NULL,
extensions = NULL,
filter = NULL,
callback = NULL,
output = "data.table",
keep_bad_request = TRUE,
...
)
Arguments
keywords |
Required. |
key |
Optional. |
subdistrict |
Optional. |
page |
Optional. |
offset |
Optional. |
extensions |
Optional. |
filter |
Optional. |
callback |
Optional. |
output |
Optional. |
keep_bad_request |
Optional. |
... |
Optional. |
Value
Returns a JSON or XML of results containing detailed subordinate administrative region information. See https://lbs.amap.com/api/webservice/guide/api/district for more information.
Get coordinate from location
Description
Get coordinate from location
Usage
getCoord(
address,
key = NULL,
city = NULL,
sig = NULL,
output = "data.table",
callback = NULL,
keep_bad_request = TRUE,
...
)
Arguments
address |
Required. |
key |
Optional. |
city |
Optional. |
sig |
Optional. |
output |
Optional. |
callback |
Optional. |
keep_bad_request |
Optional. |
... |
Optional. |
Value
Returns a JSON, XML or data.table of results containing detailed geocode information. See https://lbs.amap.com/api/webservice/guide/api/georegeo for more information.
See Also
Examples
## Not run:
library(amapGeocode)
# Before the `getCoord()` is executed,
# the token should be set by `option(amap_key = 'key')`
# or set by key argument in `getCoord()`
# Get geocode as a data.table
getCoord("IFS Chengdu")
# Get geocode as a XML
getCoord("IFS Chengdu", output = "XML")
## End(Not run)
Get an individual coordinate from location
Description
Get an individual coordinate from location
Usage
getCoord.individual(
address,
key = NULL,
city = NULL,
sig = NULL,
output = "data.table",
callback = NULL,
keep_bad_request = TRUE,
...
)
Arguments
address |
Required. |
key |
Optional. |
city |
Optional. |
sig |
Optional. |
output |
Optional. |
callback |
Optional. |
keep_bad_request |
Optional. |
... |
Optional. |
Value
Returns a JSON, XML or data.table of results containing detailed geocode information. See https://lbs.amap.com/api/webservice/guide/api/georegeo for more information.
Get location from coordinate
Description
Get location from coordinate
Usage
getLocation(
lng,
lat,
key = NULL,
poitype = NULL,
radius = NULL,
extensions = NULL,
roadlevel = NULL,
sig = NULL,
output = "data.table",
callback = NULL,
homeorcorp = 0,
keep_bad_request = TRUE,
...
)
Arguments
lng |
Required. |
lat |
Required. |
key |
Optional. |
poitype |
Optional. |
radius |
Optional. |
extensions |
Optional. |
roadlevel |
Optional. |
sig |
Optional. |
output |
Optional. |
callback |
Optional. |
homeorcorp |
Optional. |
keep_bad_request |
Optional. |
... |
Optional. |
Value
Returns a JSON, XML or data.table of results containing detailed reverse geocode information. See https://lbs.amap.com/api/webservice/guide/api/georegeo for more information.
See Also
Examples
## Not run:
library(amapGeocode)
# Before the `getLocation()` is executed,
# the token should be set by `option(amap_key = 'key')`
# or set by key argument in `getLocation()`
# Get reverse-geocode as a table
getLocation(104.043284, 30.666864)
# Get reverse-geocode as a XML
getLocation("104.043284, 30.666864", output = "XML")
## End(Not run)
Get an individual location from coordinate
Description
Get an individual location from coordinate
Usage
getLocation.individual(
lng,
lat,
key = NULL,
poitype = NULL,
radius = NULL,
extensions = NULL,
roadlevel = NULL,
sig = NULL,
output = "data.table",
callback = NULL,
homeorcorp = 0,
keep_bad_request = TRUE,
...
)
Arguments
lng |
Required. |
lat |
Required. |
key |
Optional. |
poitype |
Optional. |
radius |
Optional. |
extensions |
Optional. |
roadlevel |
Optional. |
sig |
Optional. |
output |
Optional. |
callback |
Optional. |
homeorcorp |
Optional. |
keep_bad_request |
Optional. |
... |
Optional. |
Value
Returns a JSON, XML or data.table of results containing detailed reverse geocode information. See https://lbs.amap.com/api/webservice/guide/api/georegeo for more information.
Take longitude and latitude from location string out.
Description
Take longitude and latitude from location string out.
Usage
num_coord_to_str_loc(lng, lat)
Arguments
lng |
Required. |
lat |
Required. |
Value
Comma binded coordinate string
Take longitude and latitude from location string out.
Description
Take longitude and latitude from location string out.
Usage
str_loc_to_num_coord(str_location)
Arguments
str_location |
Required. |
Value
vector contains Longitude and Latitude in numeric