geoparser_q: Issue a geoparser query

Description Usage Arguments Details Value References Examples

View source: R/geoparser_query.R

Description

The function calls the geoparser.io API which identifies places mentioned in the input text (in English), disambiguates those places, and returns data about the places found in the text.

Usage

1
geoparser_q(text_input, key = geoparser_key())

Arguments

text_input

A vector of strings, where each size must be smaller than 8 KB. See nchar(text_input, type = "bytes").

key

Your geoparser.io key.

Details

To get an API key, you need to register at https://geoparser.io/pricing.html. With an hobbyist account, you can make up to 1,000 calls a month to the API. For ease of use, save your API key as an environment variable as described at https://stat545-ubc.github.io/bit003_api-key-env-var.html.

The package will conveniently look for your API key using Sys.getenv("GEOPARSER_KEY") so if your API key is an environment variable called "GEOPARSER_KEY" you don't need to input it manually.

Geoparser.io works best on complete sentences in English. If you have a very short text, such as a partial address like "Auckland New Zealand," you probably want to use a geocoder tool instead of a geoparser. In R, you can use the opencage package for geocoding!

Value

A list of 2 data.frames (dplyr::tbl_dfs). The first data.frame is called properties and contains:

The second data.frame contains the results and is called results. If there are no results it is totally empty, otherwise:

References

Geoparser.io documentation

Examples

1
2
3
4
5
6
## Not run: 
geoparser_q(text_input = "I was born in Vannes but I live in Barcelona.")
geoparser_q(text_input = c("I was born in Vannes but I live in Barcelona.",
"France is the most beautiful place in the world."))

## End(Not run)

Example output

The API call failed, the error message is Error in curl::curl_fetch_memory(url, handle = handle): Couldn't resolve host name

$results
NULL

$properties
NULL

The API call failed, the error message is Error in curl::curl_fetch_memory(url, handle = handle): Couldn't resolve host name

The API call failed, the error message is Error in curl::curl_fetch_memory(url, handle = handle): Couldn't resolve host name

$results
NULL

$properties
NULL

geoparser documentation built on May 30, 2017, 2:58 a.m.