Modern C++ library for accessing the OpenCage geocoder
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cpr
geocoder
CMakeLists.txt
LICENSE.txt
README.md

README.md

cpp-opencage-geocoder

A modern C++ library to access the OpenCage geocoder.

Geocoding and reverse geocoding all over the world, with options for bounding boxes, language, etc. Uses the OpenCage geocoding API.

Example usage shown in geocoder/example.cpp.

Installation

Build is via CMake, and requires a C++11-compatible compiler. The main dependency is the C++ Requests library, which ships with the project. C++ Requests depends upon libcurl – by default our build requires you to have libcurl present on your own system.

Default build process (libcurl already installed on your system, build without C++ Requests tests):

git clone https://github.com/karnival/cpp-opencage-geocoder.git

cd /path/to/build/
cmake /path/to/cpp-opencage-geocoder/
make

Usage

example.cpp shows a basic usage example. One important note: your API key can be set explicitly when you create a Geocoder() object, or can be read from the environment variable $OPENCAGE_API_KEY. If you want to use the environment variable approach, make sure to use export OPENCAGE_API_KEY='your-key-here' before execution.

TODO

Functionality

  • Implement geocoding.
  • Implement reverse geocoding.
  • Implement alternative output formats (XML).
  • Add more geocoding options.
  • Check and handle return code and headers.

Build

  • Make build backwards-compatible with older CMake versions.
  • Integrate C++ Requests submodule into project as a subtree.

License

cpp-opencage-geocoder is open-source software distributed under the MIT license – see LICENSE.txt for details.