How to use API with a coordinate as input - geotax_sdk - 2.2

GeoTAX SDK Developer Guide

Product type
Software
Portfolio
Locate
Product family
Geo Addressing
Product
GeoTAX SDK
Version
2.2
Language
English
Product name
GeoTAX SDK
Title
GeoTAX SDK Developer Guide
Copyright
2024
First publish date
2023
Last updated
2024-08-30
Published on
2024-08-30T02:47:25.239000

In the code sample shows how to set a coordinate (latitude, longitude) to receive sales and use tax information such as total tax rate, state tax rate, and municipal tax rate.

TaxRateLookupConfiguration configuration
  = new TaxRateLookupConfigurationBuilder().withData(dataSourceList) 
                                           .withResources(Paths.get("/resources/taxing-resources")) 
                                           .build(); 
TaxRateLookup lookup  
  = new TaxRateLookupBuilder().withConfiguration(configuration) 
                              .register(new SDKTaxLookupFactory()) 
                              .build();

OutputPreference outputPreference = new OutputPreference(); 

outputPreference.setSalesTaxRateType("General"); 

GeocodingPreference geocodingPreference = new GeocodingPreference(); 
geocodingPreference.setUsePointData("Y"); 
geocodingPreference.setLatLongOffset("none"); 
geocodingPreference.setSqueeze("Y"); 
geocodingPreference.setLatLongAltFormat("NoDecimalSign"); 

Preferences preferences = new PreferencesBuilder().withOutputPreferences(outputPreference) 
                                                  .withGeocodingPreferences(geocodingPreference) 
                                                  .build();

Location location = new Location();
location.setGeometry(new Geometry()); 
location.getGeometry().setLatLongAltFmt("35218490,-79457302"); 

TaxResponse response = lookup.lookupByLocation(location, preferences); 

try { 
  lookup.close(); 
} catch (Exception e) { 
  e.printStackTrace(); 
}