Geocoding API: Configuring datasets (Java) - geo_addressing_sdk - 5.0

Geo Addressing SDK Developer Guide

Product type
Software
Portfolio
Locate
Product family
Geo Addressing
Product
Geo Addressing SDK
Version
5.0
Language
English
Product name
Geo Addressing SDK
Title
Geo Addressing SDK Developer Guide
Copyright
2023
First publish date
2007
Last updated
2024-09-12
Published on
2024-09-12T14:50:21.470801

Scenario

To configure data, there are two options:
  • extract and configure data programmatically
  • configure previously extracted data
Note: If you have more than one data path, use this syntax:
 withDataPath(Paths.get("{directory}/data"), Paths.get("{directory}/someOtherData"), ...) // this will only be used if resources location already does not contain any data info

Extract and configure data programmatically

public GeocodeWrapperWithDynamicConfiguration() throws GeocodingException {
  GeocodingAPI geocoder = new GeocoderBuilder()
      .withConfiguration(new ConfigurationBuilder()
          //path to ggs runtime resources, this will be located under ggs distribution
          .withResourcesPath(Paths.get("{directory}/ggs-dist-{version}/resources"))
          //path to ggs data directory, this can be extracted data or directory containg spd files
          .withDataPath(Paths.get("{directory}/data"))
          .withExtractorBuilder(new ExtractorConfiguration.Builder()
              //number of extractors that will be used for extracting data
              .withExtractorCount(4)
              //path to where data can be extracted, it will skip any data that has been previously extracted
              .withExtractPath(Paths.get("{directory}/data"))
              .build())
          .build())
      // default preferences, if none defined it will
      // use the defaults defined in {directory}/ggs-dist-{version}/resources/config/addressing.yamllocation
      .withPreferences(new GeocoderPreferences())
      .build();
}

Configure previously extracted data

public GeocodeWrapperWithConfiguration() throws GeocodingException {
            GeocodingAPI geocoder = new GeocoderBuilder()
            // ggs.home - "{directory}/ggs-dist-{version}"
            // ggs.resources.location - directory containsing GGS runtime resource "{directory}/ggs-dist-{version}/resources"
            // ggs.data.location - location where extracted data can be found i.e. "{directory}/data" from above extract command
            .withConfiguration(new ConfigurationBuilder()
            .withResourcesPath(Paths.get("{directory}/ggs-dist-{version}/resources"))
            .withDataPath(Paths.get("{directory}/data")) // this will only be used if resources location already does not conatin any data info
            .build())
            // default preferences, if none defined it will
            // use the defaults defined in {ggs.home}/resources/config/addressing.yamllocation
            .withPreferences(new GeocoderPreferences())
            .build();
            }