Pelias Client Library

A Java client library for the Pelias geocoder

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

edu.usf.cutr
ArtifactId

ArtifactId

pelias-client-library
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Pelias Client Library
A Java client library for the Pelias geocoder
Project URL

Project URL

https://github.com/CUTR-at-USF/pelias-client-library
Source Code Management

Source Code Management

http://github.com/CUTR-at-USF/pelias-client-library

Download pelias-client-library

How to add to project

<!-- https://jarcasting.com/artifacts/edu.usf.cutr/pelias-client-library/ -->
<dependency>
    <groupId>edu.usf.cutr</groupId>
    <artifactId>pelias-client-library</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/edu.usf.cutr/pelias-client-library/
implementation 'edu.usf.cutr:pelias-client-library:1.0.1'
// https://jarcasting.com/artifacts/edu.usf.cutr/pelias-client-library/
implementation ("edu.usf.cutr:pelias-client-library:1.0.1")
'edu.usf.cutr:pelias-client-library:jar:1.0.1'
<dependency org="edu.usf.cutr" name="pelias-client-library" rev="1.0.1">
  <artifact name="pelias-client-library" type="jar" />
</dependency>
@Grapes(
@Grab(group='edu.usf.cutr', module='pelias-client-library', version='1.0.1')
)
libraryDependencies += "edu.usf.cutr" % "pelias-client-library" % "1.0.1"
[edu.usf.cutr/pelias-client-library "1.0.1"]

Dependencies

compile (4)

Group / Artifact Type Version
com.fasterxml.jackson.core : jackson-core jar 2.7.3
com.fasterxml.jackson.core : jackson-databind jar 2.7.3
com.fasterxml.jackson.core : jackson-annotations jar 2.7.3
de.grundid.opendatalab : geojson-jackson jar 1.6

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

pelias-client-library Build Status Download

A Java library that makes it easy to call the Pelias Search and Autocomplete APIs

Requirements

You'll need JDK 7 or higher.

Including this library in your application

See the pelias-client-library-demo project for an example of how to use this library.

To add this library to your project using Maven, add the following to your pom.xml file:

<dependencies>
  <!-- Pelias Client Library -->
  <dependency>
      <groupId>edu.usf.cutr</groupId>    
      <artifactId>pelias-client-library</artifactId>    
      <version>1.1.0</version>
  </dependency>
</dependencies>

If you're using Gradle and Android Studio, here's what your build.gradle should look like:

...
repositories {
    jcenter()
}

android {
    ...

    // http://stackoverflow.com/questions/20673625/gradle-0-7-0-duplicate-files-during-packaging-of-apk
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/services/com.fasterxml.jackson.core.JsonFactory'
        exclude 'META-INF/services/com.fasterxml.jackson.core.ObjectCodec'
    }
...

dependencies {
    ...
    // Pelias Client library
    compile 'edu.usf.cutr:pelias-client-library:1.1.0'
}

Usage

The below example shows how to call the Pelias Search API.

String apiKey = "YourKeyHere";
String text = "London";
PeliasResponse response = new SearchRequest.Builder(apiKey, text).build().call();
System.out.println(response.toString());
PeliasResponse response = new AutocompleteRequest.Builder(apiKey, text).build().call();
System.out.println(response.toString());

Compiling the code yourself

Setting up your environment

This project was created in IntelliJ. You can also compile it from the command line using Maven.

Getting the code

To get started with this project, use a Git client to clone this repository to your local computer. Then, in IntelliJ import the project as a Maven project.

Dependencies

Managed via Maven:

Build the project

  • IntelliJ - Clean and build the project
  • Maven - mvn install

CUTR Release Process

Snapshots

We've set up a Maven repository to hold the snapshot artifacts from this project in a Github project - cutr-mvn-repo.

At CUTR, we should run the following at the command-line to create a new artifact:

mvn -DaltDeploymentRepository=cutr-snapshots::default::file:"/Git Projects/cutr-mvn-repo/snapshots" clean deploy

Then commit using Git and push new artifacts to Github.

If you want to include snapshot releases in your project, you'll need to add the following to the pom.xml of the project you want to use it in:

<!-- CUTR SNAPSHOTs/RELEASES -->
<repositories>
    <repository>
        <id>cutr-snapshots</id>
        <url>https://raw.githubusercontent.com/CUTR-at-USF/cutr-mvn-repo/master/snapshots</url>
    </repository>        
</repositories>

Releases

We're hosting releases on JCenter via Bintray.

These are the steps for publishing the pelias-client-library on jcenter repository.

1 - Create an account on Bintray.
2 - Setup your pom.xml

We need to specify the URL from which to distribute your project.

    <distributionManagement>
        <repository>
            <id>jCenter</id>
            <url>https://api.bintray.com/maven/cutr-at-usf/cutr-mvn-repo/pelias-client-library/;publish=1</url>
        </repository>
    </distributionManagement>
3 - Setup your setting.xml

We need to provide Bintray username and API Key to the Maven settings.xml file. This may be under your Maven installation directory (e.g., C:\Program Files\Apache Software Foundation\apache-maven-3.2.5\conf).

<server>
  <id>jCenter</id>
  <username>yourjcenteraccount</username>
  <password>***youraccount-secret-api-key***</password>
</server>

You'll need to import the CUTR secret key if it's a new machine (first time only):

gpg --import C:\xxxxx\CUTR\Maven\private.key

To sign the application (required for distribution to Maven Central), you need to add the following block as well (after importing the CUTR key):

<profile>
    <id>ossrh</id>
    <activation>
        <activeByDefault>true</activeByDefault>
    </activation>
    <properties>
        <gpg.executable>gpg</gpg.executable>
        <gpg.passphrase>the_pass_phrase</gpg.passphrase>
    </properties>
</profile>
4 - Run maven deploy

Finally, we can run mvn deploy to complete publishing.

edu.usf.cutr

Center for Urban Transportation Research @ USF

Versions

Version
1.0.1
1.0.0