getLocation: Get location from coordinate

View source: R/getLocation.R

getLocationR Documentation

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.
Longitude in decimal

lat

Required.
Latitude in decimal

key

Optional.
Amap Key.
Applied from 'AutoNavi' Map API official websitehttps://lbs.amap.com/dev/

poitype

Optional.
Return nearby POI types.
When 'extensions = all', this argument makes sense. For detailed poitype type, please referhttps://lbs.amap.com/api/webservice/download

radius

Optional.
Searching radius.
radius ranges from 0 to 3000, the default value is 1000, unit: meter.

extensions

Optional.
Return results controller.
'base': the default value, it only return base information about coordinate.
'all': it will return nearby POI, road information and cross information.

roadlevel

Optional.
Road levels.
When 'extensions = all', this argument makes sense.
'roadlevel=0', return all roads.
'roadlevel=1', only return main roads.

sig

Optional.
Digital Signature.
How to use this argument? Please check here https://lbs.amap.com/faq/account/key/72

output

Optional.
Output Data Structure.
Support JSON, XML and data.table. The default value is data.table.

callback

Optional.
Callback Function.
The value of callback is the customized function. Only available with JSON output. If you don't understand, it means you don't need it, just like me.

homeorcorp

Optional.
Optimize the order of returned POI or not.
When 'extensions = all', this argument makes sense.
'homeorcorp=0', do not optimize, by default.
'homeorcorp=1', home related POIs are first, by default.
'homeorcorp=2', corporation related POIs are first, by default.

keep_bad_request

Optional.
Keep Bad Request to avoid breaking a workflow, especially meaningful in a batch request

...

Optional.
For compatibility only

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

extractCoord

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)


womeimingzi11/amapGeocode documentation built on Nov. 5, 2023, 6:24 a.m.