geonamesr
is an R package developed using
Rcpp, integrated with the Lucene++
project, designed to
allow users to index and search data from
Geonames locally. This package contains not
only R functions as a standard package but also provides a
Plumber REST API, making data more
accessible and discoverable for R users.
Note: This is a hobby project created to learn more about Rcpp and Plumber.
You can install the development version of geonamesr
from
GitHub with:
# install.packages("devtools")
devtools::install_github("M3nin0/geonamesr")
You must have the Lucene++ installed in your environment. To learn more, check the Lucene++ build documentation.
For ease of use, geonamesr
is also available as a Docker container.
The provided Dockerfile simplifies deployment, and a docker-compose file
is available for quick setup.
docker-compose up -d
This command starts the geonamesr
service, making it accessible via
the plumber REST API at the /geonames
route.
Below is a basic example of how to use geonamesr
to index and search
Geonames data.
library(geonamesr)
# Indexing data
index("allCountries.txt")
# Searching indexed data
search("asciiname:switzerland", size = 1)
The plumber REST API exposes the /geonames
route for searching indexed
data.
Search Endpoint: http://localhost:5050/geonames?q=<search-query>
The OpenAPI documentation is available under the /__docs__
route,
providing detailed information about the API endpoints, parameters, and
responses.