Getting Started with the Java API
Requirements
- GGS distribution (ggs-dist-{version}.zip)
- Once unzipped, you'll need the GGS SDK CLI located in "{directory}/ggs-dist-{version}/cli"
- Dataset(s) in the Spectrum data format (*.spd)
- For additional detail, see System Requirements.
Placeholders
The following conventions are used as placeholders for some common items:- {directory} Any directory where you would like to install the resources for the SDK.
- {version} The version of the GGS SDK such as 4.0.2.
- {spd} Dataset in the Spectrum data format. For example, KGD082019.spd.
Open the Sample Code in IDE
- Extract the zipped Global Geocoding SDK (GGS) distribution to an empty
directory. For example: {directory}/ggs-dist-{version}. The following
directories will be created:
- cli – contains the command-line interface (CLI) Utility used to configure GGS. [About the Geocoding CLI Utility.]
- resources – contains runtime resources for the GGS API.
- sdk – contains resources for the JAVA API development, including addressing and geocoding sample code.
- webapp – contains the REST API distribution war file ‘Geocode-{version}.war' [About deploying a war file.]
- Open the sample project in
{directory}/ggs-dist-{version}/sdk/samples/ggs-javaapi-sample.
- Review the README.md for getting started with the sample project code.
- For additional detail, see the JAVA docs in {directory}/ggs-dist-{version}/sdk/javadoc.
Install and Configure Datasets
Before using a service, install and configure the data for the SDK. There are two options:
- Configure using the GGS CLI if you want your configuration to persist for future calls to the API.
- Configure programmatically if you want your configuration to apply only to that runtime. View examples.
Configure using the GGS CLI
- Create a location where datasets will be installed.
- Windows:
mkdir {directory}/data
- Linux:
mkdir
-p {directory}/data
- Windows:
- Run the GGS CLI. The command below starts the CLI in interactive mode.
Note:The GGS CLI can be run in interactive or batch mode. [About the CLI Batch Process.]
- Windows:
cd
{directory}/ggs
-dist
-{version}/
cli
cli
.cmd
- Linux:
cd {directory}/ggs-dist-{version}/cli cli.sh
- Windows:
- Locate .spd file(s) and extract the dataset(s). [About the Extract
command.]
extract --s "{spd}" --d "{directory}/data"
- Configure data for the SDK, based on the dataset location, by running this
command from within the interactive CLI. [About the Configure
command.]
configure --s "{directory}/data" --d "{directory}/ggs-dist-{version}/resources/config"
The "–d" parameter indicates the location of the configuration. It must be in the directory as specified in the above command. To test your configuration, copy this path and use it to build a geocoder.