zone.stefan.dev:geocode

The official Java SDK for the GeoCode Routing API.

License

License

Categories

Categories

Geo Business Logic Libraries Geospatial
GroupId

GroupId

zone.stefan.dev
ArtifactId

ArtifactId

geocode
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

zone.stefan.dev:geocode
The official Java SDK for the GeoCode Routing API.
Project URL

Project URL

https://geocode.dev.stefan.zone
Source Code Management

Source Code Management

https://github.com/stefanzone/geocode-sdk-for-java/tree/main

Download geocode

How to add to project

<!-- https://jarcasting.com/artifacts/zone.stefan.dev/geocode/ -->
<dependency>
    <groupId>zone.stefan.dev</groupId>
    <artifactId>geocode</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/zone.stefan.dev/geocode/
implementation 'zone.stefan.dev:geocode:1.0.1'
// https://jarcasting.com/artifacts/zone.stefan.dev/geocode/
implementation ("zone.stefan.dev:geocode:1.0.1")
'zone.stefan.dev:geocode:jar:1.0.1'
<dependency org="zone.stefan.dev" name="geocode" rev="1.0.1">
  <artifact name="geocode" type="jar" />
</dependency>
@Grapes(
@Grab(group='zone.stefan.dev', module='geocode', version='1.0.1')
)
libraryDependencies += "zone.stefan.dev" % "geocode" % "1.0.1"
[zone.stefan.dev/geocode "1.0.1"]

Dependencies

compile (2)

Group / Artifact Type Version
com.google.code.gson : gson jar 2.8.6
org.apache.httpcomponents : httpclient jar 4.5.13

Project Modules

There are no modules declared in this project.

Java SDK for the GeoCode Routing API

Java CI with Maven Maven Central Release Version Badge GitHub issues

The GeoCode Routing API SDK for Java enables Java developers to easily work with the GeoCode Routing API in Java.

Installation

Maven

In order to use the GeoCode Routing API SDK for Java in your project, please include the following Maven Central Repository dependency in your pom.xml.

<dependency>
  <groupId>zone.stefan.dev</groupId>
  <artifactId>geocode</artifactId>
  <version>1.0.1</version>
</dependency>

From Git

The Java SDK for the GeoCode Routing API can be installed via Git. Run this command from your terminal.

git clone https://github.com/stefanzone/geocode-sdk-for-java.git

Download as ZIP archive

Download the latest version from here.

Usage

Note: The GeoCode Routing API SDK for Java requires OpenJDK version 11.

Parse the GeoCodeEndpoint for Address MetaData.

final GeoCodeEndpoint geoCodeEndpoint = GeoCode.getAddress(
      "Lothstraße 34"
);

// Information about the address.
System.out.println("Street: " + geoCodeEndpoint.getAddress().getStreet());
System.out.println("House Number: " + geoCodeEndpoint.getAddress().getNumber());
System.out.println("City: " + geoCodeEndpoint.getAddress().getCity());
System.out.println("State: " + geoCodeEndpoint.getAddress().getState());
System.out.println("Post Code " + geoCodeEndpoint.getAddress().getPostCode());
System.out.println("Country: " + geoCodeEndpoint.getAddress().getCountry());
System.out.println("Country Code: " + geoCodeEndpoint.getAddress().getCountryCode());
System.out.println("Formatted: " + geoCodeEndpoint.getAddress().getFormatted());

// Informationen zur GeoPosition.
System.out.println("Latitude: " + geoCodeEndpoint.getPosition().getLat());
System.out.println("Longitude: " + geoCodeEndpoint.getPosition().getLon());

Parse the RoutingEndpoint for Routing MetaData.

final RoutingEndpoint routingEndpoint = GeoCode.getRoute(
      "Lothstraße 34",
      "Lindwurmstraße",
      "transit" // Use of public transport.
);

// Information about the origin and destination address.
System.out.println("Origin Address: " + routingEndpoint.getSummary().getLocation().getOrigin());
System.out.println("Destination Address: " + routingEndpoint.getSummary().getLocation().getDestination());

// Textual summary of the route.
System.out.println("Summary: " + routingEndpoint.getSummary().getText());

// Travel time information.
System.out.println("Duration in Seconds: " + routingEndpoint.getSummary().getDuration().getSeconds());
System.out.println("Duration in Words: " + routingEndpoint.getSummary().getDuration().getText());

// Distance information.
System.out.println("Distance in Meters: " + routingEndpoint.getSummary().getDistance().getMeters());
System.out.println("Distance in Words: " + routingEndpoint.getSummary().getDistance().getText());

// All steps of the calculated route.
for (Step step : routingEndpoint.getRoute()) {
      System.out.println("Instruction: " + step.getInstruction());
}

Contributing

Please see CONTRIBUTING for details.

License

© 2021 Stefan Kühnel, All Rights reserved.

Versions

Version
1.0.1
1.0.0