Title: | An Interface to the 'AutoNavi Maps' API Geocoding Services |
---|---|
Description: | Getting and parsing data of location geocode/reverse-geocode and administrative regions from 'AutoNavi Maps'<https://lbs.amap.com/api/webservice/summary> API. |
Authors: | Han Chen [aut, cre], Wanyanhan Jiang [ctb] |
Maintainer: | Han Chen <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.7.0 |
Built: | 2025-02-22 03:39:59 UTC |
Source: | https://github.com/womeimingzi11/amapgeocode |
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.
convertCoord( locations, key = NULL, coordsys = NULL, sig = NULL, output = "data.table", keep_bad_request = TRUE, ... )
convertCoord( locations, key = NULL, coordsys = NULL, sig = NULL, output = "data.table", keep_bad_request = TRUE, ... )
locations |
Required. |
key |
Optional. |
coordsys |
Optional. |
sig |
Optional. |
output |
Optional. |
keep_bad_request |
Optional. |
... |
Optional. |
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.
## 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)
## 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
convertCoord.individual( locations, key = NULL, coordsys = NULL, sig = NULL, output = "data.table", keep_bad_request = TRUE, ... )
convertCoord.individual( locations, key = NULL, coordsys = NULL, sig = NULL, output = "data.table", keep_bad_request = TRUE, ... )
locations |
Required. |
key |
Optional. |
coordsys |
Optional. |
sig |
Optional. |
output |
Optional. |
keep_bad_request |
Optional. |
... |
Optional. |
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.
extractAdmin(res)
extractAdmin(res)
res |
Response from getAdmin. |
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.
## 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)
## 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
extractConvertCoord(res)
extractConvertCoord(res)
res |
Required. |
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.
## 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)
## 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
extractCoord(res)
extractCoord(res)
res |
Required. |
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.
## 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)
## 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
extractLocation(res)
extractLocation(res)
res |
Required. |
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.
## 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)
## 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
getAdmin( keywords, key = NULL, subdistrict = NULL, page = NULL, offset = NULL, extensions = NULL, filter = NULL, callback = NULL, output = "data.table", keep_bad_request = TRUE, ... )
getAdmin( keywords, key = NULL, subdistrict = NULL, page = NULL, offset = NULL, extensions = NULL, filter = NULL, callback = NULL, output = "data.table", keep_bad_request = TRUE, ... )
keywords |
Required. |
key |
Optional. |
subdistrict |
Optional. |
page |
Optional. |
offset |
Optional. |
extensions |
Optional. |
filter |
Optional. |
callback |
Optional. |
output |
Optional. |
keep_bad_request |
Optional. |
... |
Optional. |
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.
## 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)
## 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
getAdmin.individual( keywords, key = NULL, subdistrict = NULL, page = NULL, offset = NULL, extensions = NULL, filter = NULL, callback = NULL, output = "data.table", keep_bad_request = TRUE, ... )
getAdmin.individual( keywords, key = NULL, subdistrict = NULL, page = NULL, offset = NULL, extensions = NULL, filter = NULL, callback = NULL, output = "data.table", keep_bad_request = TRUE, ... )
keywords |
Required. |
key |
Optional. |
subdistrict |
Optional. |
page |
Optional. |
offset |
Optional. |
extensions |
Optional. |
filter |
Optional. |
callback |
Optional. |
output |
Optional. |
keep_bad_request |
Optional. |
... |
Optional. |
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
getCoord( address, key = NULL, city = NULL, sig = NULL, output = "data.table", callback = NULL, keep_bad_request = TRUE, ... )
getCoord( address, key = NULL, city = NULL, sig = NULL, output = "data.table", callback = NULL, keep_bad_request = TRUE, ... )
address |
Required. |
key |
Optional. |
city |
Optional. |
sig |
Optional. |
output |
Optional. |
callback |
Optional. |
keep_bad_request |
Optional. |
... |
Optional. |
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.
## 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)
## 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
getCoord.individual( address, key = NULL, city = NULL, sig = NULL, output = "data.table", callback = NULL, keep_bad_request = TRUE, ... )
getCoord.individual( address, key = NULL, city = NULL, sig = NULL, output = "data.table", callback = NULL, keep_bad_request = TRUE, ... )
address |
Required. |
key |
Optional. |
city |
Optional. |
sig |
Optional. |
output |
Optional. |
callback |
Optional. |
keep_bad_request |
Optional. |
... |
Optional. |
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
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, ... )
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, ... )
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. |
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.
## 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)
## 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
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, ... )
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, ... )
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. |
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.
num_coord_to_str_loc(lng, lat)
num_coord_to_str_loc(lng, lat)
lng |
Required. |
lat |
Required. |
Comma binded coordinate string
Take longitude and latitude from location string out.
str_loc_to_num_coord(str_location)
str_loc_to_num_coord(str_location)
str_location |
Required. |
vector contains Longitude and Latitude in numeric