This api provides a java client to the OpenCage geocoding service. https://opencagedata.com/api
This repository reached its end of life, please refer to https://github.com/OpenCageData/jopencage for up-to-date releases.
Maven
<dependency>
<groupId>com.byteowls</groupId>
<artifactId>jopencage</artifactId>
<version>replace.with.version</version>
</dependency>
Gradle
implementation "com.byteowls:jopencage:REPLACE.WITH.VERSION"
Forward
// In real live application the JOpenCageGeocoder should be a Singleton
JOpenCageGeocoder jOpenCageGeocoder = new JOpenCageGeocoder(YOUR_API_KEY);
JOpenCageForwardRequest request = new JOpenCageForwardRequest("Graz");
request.setMinConfidence(1);
request.setNoAnnotations(false);
request.setNoDedupe(true);
JOpenCageResponse response = jOpenCageGeocoder.forward(request);
Reverse
// In real live application the JOpenCageGeocoder should be a Singleton
JOpenCageGeocoder jOpenCageGeocoder = new JOpenCageGeocoder(YOUR_API_KEY);
JOpenCageReverseRequest request = new JOpenCageReverseRequest(-22.6792, 14.5272);
request.setNoAnnotations(true);
JOpenCageResponse response = jOpenCageGeocoder.reverse(request);
- JDK 8+
- Apache Http Client
- FasterXml Jackson
- Slf4j
For running the tests you have to use your OWN OpenCage API Key. Get a free trial key at https://opencagedata.com/dashboard#api-keys
./gradlew -DOPENCAGE_API_KEY=<your apikey> test
./gradlew wrapper --gradle-version 6.8.3
See CHANGELOG.
Apache 2.0. Please see LICENSE.
We have no business relation to OpenCage.