locationiq-java-client

LocationIQ

  • API version: 1.0.0

LocationIQ provides flexible enterprise-grade location based solutions. We work with developers, startups and enterprises worldwide serving billions of requests everyday. This page provides an overview of the technical aspects of our API and will help you get started.

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.7+
  2. Maven/Gradle

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>com.locationiq</groupId>
  <artifactId>locationiq-java-client</artifactId>
  <version>1.0.0</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "com.locationiq:locationiq-java-client:1.0.0"

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/locationiq-java-client-1.0.0.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

import LocationIq.*;
import LocationIq.auth.*;
import com.locationiq.client.model.*;
import com.locationiq.client.api.BalanceApi;

import java.io.File;
import java.util.*;

public class BalanceApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        
        // Configure API key authorization: key
        ApiKeyAuth key = (ApiKeyAuth) defaultClient.getAuthentication("key");
        key.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //key.setApiKeyPrefix("Token");

        BalanceApi apiInstance = new BalanceApi();
        try {
            Balance result = apiInstance.balance();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling BalanceApi#balance");
            e.printStackTrace();
        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://eu1.locationiq.com/v1

Class Method HTTP request Description
BalanceApi balance GET /balance.php
ReverseApi reverse GET /reverse.php Reverse Geocoding
SearchApi search GET /search.php Forward Geocoding

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

key

  • Type: API key
  • API key parameter name: key
  • Location: URL query string

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author