/jopencage

OpenCage geocoding client for Java

Primary LanguageJavaApache License 2.0Apache-2.0

JOpenCage Download Travis Twitter Follow

This api provides a java client to the OpenCage geocoding service. https://opencagedata.com/api

Show your appreciation

If you like the project please star it on Github.

I you find a bug of have a question ask it in a kind and reproducable way. I do this mostly in my spare time and for fun.

If you want to buy me a beer :), here is my paypal link.

Usage

Follow me on Twitter Follow to be notified about new releases.

Download

Download

Maven

Repository

<repositories>
  <!-- ... other repository elements ... -->
  <repository>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
    <id>central</id>
    <name>bintray</name>
    <url>http://jcenter.bintray.com</url>
  </repository>
</repositories>

Dependency

<dependencies>
  <!-- ... other dependency elements ... -->
  <dependency>
    <groupId>com.byteowls</groupId>
    <artifactId>jopencage</artifactId>
    <version>replace.with.version</version>
  </dependency>
</dependencies>

Gradle

Repository

repositories {
  jcenter()
}
// or 
repositories {
  maven {
    url  "http://jcenter.bintray.com" 
  }
}

Dependency

dependencies {
  compile ("com.byteowls:jopencage:replace.with.version")
}

Example

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);

Libraries

  • JDK 7+
  • Apache Http Client
  • FasterXml Jackson
  • slf4j

Missing something?

Contribute

Setup Eclipse

  1. Fork repo
  2. Open command line
  3. Clone your fork git@github.com:USERNAME/jopencage.git
  4. cd jopencage
  5. Build eclipse meta data ./gradlew cleanEclipse eclipse
  6. Open Eclipse
  7. File -> Import... -> General -> Existing Projects into Workspace
  8. Browse to your git repository
  9. Check the option "Search for nested projects"
  10. Press finish

This should take not more than 1-2 minutes. You does not need to use any gradle eclipse plugins.

Fix a bug or create a new feature

Please do not mix more than one issue in a feature branch. Each feature/bugfix should have its own branch and its own Pull Request (PR).

  1. Create a issue and describe what you want to do at Issue Tracker
  2. Create your feature branch (git checkout -b feature/my-feature or git checkout -b bugfix/my-bugfix)
  3. Test your changes to the best of your ability.
  4. Add a demo view to the demo application
  5. Commit your changes (git commit -m 'Describe feature or bug')
  6. Push to the branch (git push origin feature/my-feature)
  7. Create a Github Pull Request

Testing

For running the tests you have to use your own OpenCage API Key.

  • OPENCAGE_API_KEY ... Provide your own opencage api key using env variables. e.g. -DOPENCAGE_API_KEY=YourKey

License

Apache 2.0. Please see LICENSE.