- C#
- Python
- NodeJS
Address Geocode – US C# Code Snippet
using System.Web;
namespace address_geocode_us_dot_net.REST
{
/// <summary>
/// Provides functionality to call the ServiceObjects Address Geocode US (AGUS) REST API's GetBestMatch_V4 endpoint,
/// retrieving geocoding info rmation (e.g., latitude, longitude, ZIP code) for a given US address with fallback to a backup endpoint
/// for reliability in live mode.
/// </summary>
public static class GetBestMatchV4Client
{
// Base URL constants: production, backup, and trial
private const string LiveBaseUrl = "https://sws.serviceobjects.com/GCR/api.svc/json/";
private const string BackupBaseUrl = "https://swsbackup.serviceobjects.com/GCR/api.svc/json/";
private const string TrialBaseUrl = "https://trial.serviceobjects.com/GCR/api.svc/json/";
/// <summary>
/// Synchronously calls the GetBestMatch_V4 REST endpoint to retrieve geocoding information,
/// attempting the primary endpoint first and falling back to the backup if the response is invalid
/// (Error.Number == "4") in live mode.
/// </summary>
/// <param name="input">The input parameters including address, city, state, postal code, and license key.</param>
/// <returns>Deserialized <see cref="GetBestMatchV4Response"/> containing geocoding data or an error.</returns>
public static GetBestMatchV4Response Invoke(GetBestMatchV4Input input)
{
//Use query string parameters so missing/options fields don't break
//the URL as path parameters would.
string url = BuildUrl(input, input.IsLive ? LiveBaseUrl : TrialBaseUrl);
GetBestMatchV4Response response = Helper.HttpGet<GetBestMatchV4Response>(url, input.TimeoutSeconds);
// Fallback on error in live mode
if (input.IsLive && !IsValid(response))
{
string fallbackUrl = BuildUrl(input, BackupBaseUrl);
GetBestMatchV4Response fallbackResponse = Helper.HttpGet<GetBestMatchV4Response>(fallbackUrl, input.TimeoutSeconds);
return fallbackResponse;
}
return response;
}
/// <summary>
/// Asynchronously calls the GetBestMatch_V4 REST endpoint to retrieve geocoding information,
/// attempting the primary endpoint first and falling back to the backup if the response is invalid
/// (Error.Number == "4") in live mode.
/// </summary>
/// <param name="input">The input parameters including address, city, state, postal code, and license key.</param>
/// <returns>Deserialized <see cref="GetBestMatchV4Response"/> containing geocoding data or an error.</returns>
public static async Task<GetBestMatchV4Response> InvokeAsync(GetBestMatchV4Input input)
{
//Use query string parameters so missing/options fields don't break
//the URL as path parameters would.
string url = BuildUrl(input, input.IsLive ? LiveBaseUrl : TrialBaseUrl);
GetBestMatchV4Response response = await Helper.HttpGetAsync<GetBestMatchV4Response>(url, input.TimeoutSeconds).ConfigureAwait(false);
// Fallback on error in live mode
if (input.IsLive && !IsValid(response))
{
string fallbackUrl = BuildUrl(input, BackupBaseUrl);
GetBestMatchV4Response fallbackResponse = await Helper.HttpGetAsync<GetBestMatchV4Response>(fallbackUrl, input.TimeoutSeconds).ConfigureAwait(false);
return fallbackResponse;
}
return response;
}
/// <summary>
/// Builds the full request URL for the GetBestMatch_V4 endpoint, including URL-encoded query string parameters.
/// </summary>
/// <param name="input">The input parameters for the API call.</param>
/// <param name="baseUrl">The base URL (live, backup, or trial).</param>
/// <returns>The complete URL with query string.</returns>
public static string BuildUrl(GetBestMatchV4Input input, string baseUrl)
{
// Construct query string with URL-encoded parameters
string qs = $"GetBestMatch_V4?" +
$"Address={HttpUtility.UrlEncode(input.Address)}" +
$"&City={HttpUtility.UrlEncode(input.City)}" +
$"&State={HttpUtility.UrlEncode(input.State)}" +
$"&PostalCode={HttpUtility.UrlEncode(input.PostalCode)}" +
$"&LicenseKey={HttpUtility.UrlEncode(input.LicenseKey)}";
return baseUrl + qs;
}
private static bool IsValid(GetBestMatchV4Response response) => response?.Error == null || response.Error.Number != "4";
/// <summary>
/// Input parameters for the GetBestMatch_V4 API call. Represents a US address to geocode
/// and returns latitude and longitude with cascading logic for partial matches.
/// </summary>
/// <param name="Address">Address line of the address to geocode (e.g., “123 Main Street”).</param>
/// <param name="City">The city of the address to geocode (e.g., “New York”). Optional if postal code is provided.</param>
/// <param name="State">The state of the address to geocode (e.g., “NY”). Optional if postal code is provided.</param>
/// <param name="PostalCode">The ZIP code of the address to geocode. Optional if city and state are provided.</param>
/// <param name="LicenseKey">The license key to authenticate the API request.</param>
/// <param name="IsLive">Indicates whether to use the live service (true) or trial service (false).</param>
/// <param name="TimeoutSeconds">Timeout duration for the API call, in seconds.</param>
public record GetBestMatchV4Input(
string Address = "",
string City = "",
string State = "",
string PostalCode = "",
string LicenseKey = "",
bool IsLive = true,
int TimeoutSeconds = 15
);
}
}
using System.Runtime.Serialization;
namespace address_geocode_us_dot_net.REST
{
/// <summary>
/// Response from GetBestMatch_V4 API
/// </summary>
[DataContract]
public class GetBestMatchV4Response
{
public string Level { get; set; }
public string LevelDescription { get; set; }
public string Latitude { get; set; }
public string Longitude { get; set; }
public string Zip { get; set; }
public InformationComponent[] InformationComponents { get; set; }
public Error Error { get; set; }
public override string ToString()
{
string infoComponentsString = InformationComponents != null
? string.Join(", ", InformationComponents.Select(ic => ic.ToString()))
: "null";
return $"Level: {Level}\n" +
$"LevelDescription: {LevelDescription}\n" +
$"Latitude: {Latitude}\n" +
$"Longitude: {Longitude}\n" +
$"Zip: {Zip}\n" +
$"InformationComponents: [{infoComponentsString}]\n" +
$"Error: {(Error != null ? Error.ToString() : "null")}";
}
}
/// <summary>
/// Information Component for GetBestMatch_V4
/// </summary>
[DataContract]
public class InformationComponent
{
public string Name { get; set; }
public string Value { get; set; }
public override string ToString()
{
return $"Name: {Name}, Value: {Value}";
}
}
/// <summary>
/// Response from GetDistanceToWater API, containing the estimated distance to the nearest saltwater
/// and the coordinates of the closest saltwater location.
/// </summary>
[DataContract]
public class GetDistanceToWaterResponse
{
public string DistanceToWater { get; set; }
public string Latitude { get; set; }
public string Longitude { get; set; }
public string WaterLat { get; set; }
public string WaterLon { get; set; }
public Error Error { get; set; }
public override string ToString()
{
return $"MilesToWater: {DistanceToWater}\n" +
$"Latitude: {Latitude}\n" +
$"Longitude: {Longitude}\n" +
$"ClosestWaterLatitude: {WaterLat}\n" +
$"ClosestWaterLongitude: {WaterLon}\n" +
$"Error: {(Error != null ? Error.ToString() : "null")}";
}
}
/// <summary>
/// Response from GetReverseLocation API, containing the estimated address, city, state, ZIP code,
/// and county for the given coordinates.
/// </summary>
[DataContract]
public class GetReverseLocationResponse
{
public string Address { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Zip { get; set; }
public string County { get; set; }
public Error Error { get; set; }
public override string ToString()
{
return $"Address: {Address}\n" +
$"City: {City}\n" +
$"State: {State}\n" +
$"Zip: {Zip}\n" +
$"County: {County}\n" +
$"Error: {(Error != null ? Error.ToString() : "null")}";
}
}
/// <summary>
/// Error object for API responses
/// </summary>
[DataContract]
public class Error
{
public string Desc { get; set; }
public string Number { get; set; }
public string Location { get; set; }
public override string ToString()
{
return $"Desc: {Desc}, TypeCode: {Number}, Location: {Location}";
}
}
}
using System.Text.Json;
using System.Web;
namespace address_geocode_us_dot_net.REST
{
public class Helper
{
public static T HttpGet<T>(string url, int timeoutSeconds)
{
using var httpClient = new HttpClient
{
Timeout = TimeSpan.FromSeconds(timeoutSeconds)
};
using var request = new HttpRequestMessage(HttpMethod.Get, url);
using HttpResponseMessage response = httpClient
.SendAsync(request)
.GetAwaiter()
.GetResult();
response.EnsureSuccessStatusCode();
using Stream responseStream = response.Content
.ReadAsStreamAsync()
.GetAwaiter()
.GetResult();
var options = new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
};
object? obj = JsonSerializer.Deserialize(responseStream, typeof(T), options);
T result = (T)obj!;
return result;
}
// Asynchronous HTTP GET and JSON deserialize
public static async Task<T> HttpGetAsync<T>(string url, int timeoutSeconds)
{
HttpClient HttpClient = new HttpClient();
HttpClient.Timeout = TimeSpan.FromSeconds(timeoutSeconds);
using var httpResponse = await HttpClient.GetAsync(url).ConfigureAwait(false);
httpResponse.EnsureSuccessStatusCode();
var stream = await httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false);
return JsonSerializer.Deserialize<T>(stream)!;
}
public static string UrlEncode(string value) => HttpUtility.UrlEncode(value ?? string.Empty);
}
}
Address Geocode – US Python Code Snippet
import requests
from agus_response import GetBestMatchV4Response, Error, InformationComponent
# Endpoint URLs for ServiceObjects Address Geocode US (AGUS) API
primary_url = "https://sws.serviceobjects.com/GCR/api.svc/json/GetBestMatch_V4?"
backup_url = "https://swsbackup.serviceobjects.com/GCR/api.svc/json/GetBestMatch_V4?"
trial_url = "https://trial.serviceobjects.com/GCR/api.svc/json/GetBestMatch_V4?"
def get_best_match_v4(
address: str,
city: str,
state: str,
postal_code: str,
license_key: str,
is_live: bool = True) -> GetBestMatchV4Response:
"""
Call ServiceObjects Address Geocode US (AGUS) API's GetBestMatch_V4 endpoint
to retrieve geocoding information (latitude, longitude, ZIP code, etc.).
Parameters:
address: Address line of the address to geocode (e.g., "123 Main Street").
city: The city of the address to geocode. For example, "New York".
state: The state of the address to geocode. For example, "NY".
postal_code: The postal code of the address to geocode. For example, "10001".
license_key: Your ServiceObjects license key.
is_live: Use live or trial servers.
Returns:
GetBestMatchV4Response: Parsed JSON response with geocoding results or error details.
Raises:
RuntimeError: If the API call fails on both primary and backup endpoints or if JSON parsing fails.
"""
params = {
"Address": address,
"City": city,
"State": state,
"PostalCode": postal_code,
"LicenseKey": license_key,
}
# Select the base URL: production vs trial
url = primary_url if is_live else trial_url
try:
# Attempt primary (or trial) endpoint
response = requests.get(url, params=params, timeout=10)
response.raise_for_status()
data = response.json()
# If API returned an error in JSON payload, trigger fallback
error = getattr(response, 'Error', None)
if not (error is None or getattr(error, 'Number', None) != "4"):
if is_live:
# Try backup URL
response = requests.get(backup_url, params=params, timeout=10)
data = response.json()
# If still error, propagate exception
if 'Error' in data:
raise RuntimeError(f"AGUS service error: {data['Error']}")
else:
# Trial mode error is terminal
raise RuntimeError(f"AGUS trial error: {data['Error']}")
# Convert JSON response to GetBestMatchV4Response for structured access
error = Error(**data.get("Error", {})) if data.get("Error") else None
return GetBestMatchV4Response(
Level=data.get("Level"),
LevelDescription=data.get("LevelDescription"),
Latitude=data.get("Latitude"),
Longitude=data.get("Longitude"),
Zip=data.get("Zip"),
InformationComponents=[
InformationComponent(Name=comp.get("Name"), Value=comp.get("Value"))
for comp in data.get("InformationComponents", [])
] if "InformationComponents" in data else [],
Error=error,
)
except requests.RequestException as req_exc:
# Network or HTTP-level error occurred
if is_live:
try:
# Fallback to backup URL
response = requests.get(backup_url, params=params, timeout=10)
response.raise_for_status()
data = response.json()
if "Error" in data:
raise RuntimeError(f"AGUS backup error: {data['Error']}") from req_exc
error = Error(**data.get("Error", {})) if data.get("Error") else None
return GetBestMatchV4Response(
Level=data.get("Level"),
LevelDescription=data.get("LevelDescription"),
Latitude=data.get("Latitude"),
Longitude=data.get("Longitude"),
Zip=data.get("Zip"),
InformationComponents=[
InformationComponent(Name=comp.get("Name"), Value=comp.get("Value"))
for comp in data.get("InformationComponents", [])
] if "InformationComponents" in data else [],
Error=error,
)
except Exception as backup_exc:
raise RuntimeError("AGUS service unreachable on both endpoints") from backup_exc
else:
raise RuntimeError(f"AGUS trial error: {str(req_exc)}") from req_exc
from dataclasses import dataclass
from typing import Optional, List
@dataclass
class GetDistanceToWaterInput:
Latitude: Optional[float] = None
Longitude: Optional[float] = None
LicenseKey: Optional[str] = None
IsLive: bool = True
TimeoutSeconds: int = 15
def __str__(self) -> str:
return (f"GetDistanceToWaterInput: Latitude={self.Latitude}, Longitude={self.Longitude}, "
f"LicenseKey={self.LicenseKey}, IsLive={self.IsLive}, TimeoutSeconds={self.TimeoutSeconds}")
@dataclass
class InformationComponent:
Name: Optional[str] = None
Value: Optional[str] = None
def __str__(self) -> str:
return f"InformationComponent: Name={self.Name}, Value={self.Value}"
@dataclass
class Error:
Desc: Optional[str] = None
Number: Optional[str] = None
Location: Optional[str] = None
def __str__(self) -> str:
return (f"Error: Desc={self.Desc}, Number={self.Number}, Location={self.Location}")
@dataclass
class GetBestMatchV4Response:
Level: Optional[str] = None
LevelDescription: Optional[str] = None
Latitude: Optional[float] = None
Longitude: Optional[float] = None
Zip: Optional[str] = None
InformationComponents: Optional[List['InformationComponent']] = None
Error: Optional['Error'] = None
def __post_init__(self):
if self.InformationComponents is None:
self.InformationComponents = []
def __str__(self) -> str:
components_string = ', '.join(str(component) for component in self.InformationComponents) if self.InformationComponents else 'None'
error = str(self.Error) if self.Error else 'None'
return (f"GetBestMatchV4Response: Level={self.Level}, LevelDescription={self.LevelDescription}, "
f"Latitude={self.Latitude}, Longitude={self.Longitude}, Zip={self.Zip}, "
f"InformationComponents=[{components_string}], Error={error}")
@dataclass
class GetDistanceToWaterResponse:
DistanceToWater: Optional[float] = None
Latitude: Optional[float] = None
Longitude: Optional[float] = None
WaterLat: Optional[float] = None
WaterLon: Optional[float] = None
Error: Optional['Error'] = None
def __str__(self) -> str:
error = str(self.Error) if self.Error else 'None'
return (f"GetDistanceToWaterResponse: DistanceToWater={self.DistanceToWater}, Latitude={self.Latitude}, "
f"Longitude={self.Longitude}, WaterLat={self.WaterLat}, WaterLon={self.WaterLon}, Error={error}")
@dataclass
class GetReverseLocationResponse:
Address: Optional[str] = None
City: Optional[str] = None
State: Optional[str] = None
Zip: Optional[str] = None
County: Optional[str] = None
Error: Optional['Error'] = None
def __str__(self) -> str:
error = str(self.Error) if self.Error else 'None'
return (f"GetReverseLocationResponse: Address={self.Address}, City={self.City}, State={self.State}, "
f"Zip={self.Zip}, County={self.County}, Error={error}")
Address GeoCoder NodeJS Code Snippet
import axios from 'axios';
import querystring from 'querystring';
import { GetBestMatchV4Response } from './agus_response.js';
/**
* @constant
* @type {string}
* @description The base URL for the live ServiceObjects Address Geocode US (AGUS) API service.
*/
const liveBaseUrl = 'https://sws.serviceobjects.com/GCR/api.svc/json/';
/**
* @constant
* @type {string}
* @description The base URL for the backup ServiceObjects Address Geocode US (AGUS) API service.
*/
const backupBaseUrl = 'https://swsbackup.serviceobjects.com/GCR/api.svc/json/';
/**
* @constant
* @type {string}
* @description The base URL for the trial ServiceObjects Address Geocode US (AGUS) API service.
*/
const trialBaseUrl = 'https://trial.serviceobjects.com/GCR/api.svc/json/';
/**
* <summary>
* Checks if a response from the API is valid by verifying that it either has no Error object
* or the Error.Number is not equal to '4'.
* </summary>
* <param name="response" type="Object">The API response object to validate.</param>
* <returns type="boolean">True if the response is valid, false otherwise.</returns>
*/
const isValid = (response) => !response?.Error || response.Error.Number !== '4';
/**
* <summary>
* Constructs a full URL for the GetBestMatch_V4 API endpoint by combining the base URL
* with query parameters derived from the input parameters.
* </summary>
* <param name="params" type="Object">An object containing all the input parameters.</param>
* <param name="baseUrl" type="string">The base URL for the API service (live, backup, or trial).</param>
* <returns type="string">The constructed URL with query parameters.</returns>
*/
const buildUrl = (params, baseUrl) =>
`${baseUrl}GetBestMatch_V4?${querystring.stringify(params)}`;
/**
* <summary>
* Performs an HTTP GET request to the specified URL with a given timeout.
* </summary>
* <param name="url" type="string">The URL to send the GET request to.</param>
* <param name="timeoutSeconds" type="number">The timeout duration in seconds for the request.</param>
* <returns type="Promise<GetBestMatchV4Response>">A promise that resolves to a GetBestMatchV4Response object containing the API response data.</returns>
* <exception cref="Error">Thrown if the HTTP request fails, with a message detailing the error.</exception>
*/
const httpGet = async (url, timeoutSeconds) => {
try {
const response = await axios.get(url, { timeout: timeoutSeconds * 1000 });
return new GetBestMatchV4Response(response.data);
} catch (error) {
throw new Error(`HTTP request failed: ${error.message}`);
}
};
/**
* <summary>
* Provides functionality to call the ServiceObjects Address Geocode US (AGUS) API's GetBestMatch_V4 endpoint,
* retrieving geocoding information (e.g., latitude, longitude, ZIP code) for a given US address with fallback to a backup endpoint for reliability in live mode.
* </summary>
*/
const GetBestMatchV4Client = {
/**
* <summary>
* Asynchronously invokes the GetBestMatch_V4 API endpoint, attempting the primary endpoint
* first and falling back to the backup if the response is invalid (Error.Number == '4') in live mode.
* </summary>
* @param {string} Address - Address line of the address to geocode (e.g., "123 Main Street").
* @param {string} City - The city of the address to geocode. For example, “New York”. The city isn’t required, but if one is not provided, the Zip code is required..
* @param {string} State - The state of the address to geocode. For example, “NY”. This does not need to be contracted, full state names will work as well. The state isn’t required, but if one is not provided, the Zip code is required..
* @param {string} PostalCode - The state of the address to geocode. For example, “NY”. This does not need to be contracted, full state names will work as well. The state isn’t required, but if one is not provided, the Zip code is required..
* @param {string} LicenseKey - Your license key to use the service.
* @param {boolean} isLive - Value to determine whether to use the live or trial servers.
* @param {number} timeoutSeconds - Timeout, in seconds, for the call to the service.
* @returns {Promise<GetBestMatchV4Response>} - A promise that resolves to a GetBestMatchV4Response object.
*/
async invokeAsync(Address, City, State, PostalCode, LicenseKey, isLive = true, timeoutSeconds = 15) {
const params = {
Address,
City,
State,
PostalCode,
LicenseKey
};
const url = buildUrl(params, isLive ? liveBaseUrl : trialBaseUrl);
let response = await httpGet(url, timeoutSeconds);
if (isLive && !isValid(response)) {
const fallbackUrl = buildUrl(params, backupBaseUrl);
const fallbackResponse = await httpGet(fallbackUrl, timeoutSeconds);
return fallbackResponse;
}
return response;
},
/**
* <summary>
* Synchronously invokes the GetBestMatch_V4 API endpoint by wrapping the async call
* and awaiting its result immediately.
* </summary>
* @param {string} Address - Address line of the address to geocode (e.g., "123 Main Street").
* @param {string} City - The city of the address to geocode. For example, “New York”. The city isn’t required, but if one is not provided, the Zip code is required..
* @param {string} State - The state of the address to geocode. For example, “NY”. This does not need to be contracted, full state names will work as well. The state isn’t required, but if one is not provided, the Zip code is required..
* @param {string} PostalCode - The state of the address to geocode. For example, “NY”. This does not need to be contracted, full state names will work as well. The state isn’t required, but if one is not provided, the Zip code is required..
* @param {string} LicenseKey - Your license key to use the service.
* @param {boolean} isLive - Value to determine whether to use the live or trial servers.
* @param {number} timeoutSeconds - Timeout, in seconds, for the call to the service.
* @returns {GetBestMatchV4Response} - A GetBestMatchV4Response object with geocoding details or an error.
*/
invoke(Address, City, State, PostalCode, LicenseKey, isLive = true, timeoutSeconds = 15) {
return (async () => await this.invokeAsync(
Address, City, State, PostalCode, LicenseKey, isLive, timeoutSeconds
))();
}
};
export { GetBestMatchV4Client, GetBestMatchV4Response };
export class GetDistanceToWaterInput {
constructor(data = {}) {
this.Latitude = data.Latitude;
this.Longitude = data.Longitude;
this.LicenseKey = data.LicenseKey;
this.IsLive = data.IsLive !== undefined ? data.IsLive : true;
this.TimeoutSeconds = data.TimeoutSeconds !== undefined ? data.TimeoutSeconds : 15;
}
toString() {
return `GetDistanceToWaterInput: Latitude = ${this.Latitude}, Longitude = ${this.Longitude}, LicenseKey = ${this.LicenseKey}, IsLive = ${this.IsLive}, TimeoutSeconds = ${this.TimeoutSeconds}`;
}
}
/**
* Information Component for API responses.
*/
export class InformationComponent {
constructor(data = {}) {
this.Name = data.Name;
this.Value = data.Value;
}
toString() {
return `Name = ${this.Name}, Value = ${this.Value}`;
}
}
/**
* Error object for API responses.
*/
export class Error {
constructor(data = {}) {
this.Desc = data.Desc;
this.Number = data.Number;
this.Location = data.Location;
}
toString() {
return `Error: Desc = ${this.Desc}, Number = ${this.Number}, Location = ${this.Location}`;
}
}
/**
* Response from GetBestMatch_V4 API.
*/
export class GetBestMatchV4Response {
constructor(data = {}) {
this.Level = data.Level;
this.LevelDescription = data.LevelDescription;
this.Latitude = data.Latitude;
this.Longitude = data.Longitude;
this.Zip = data.Zip;
this.InformationComponents = (data.InformationComponents || []).map(component => new InformationComponent(component));
this.Error = data.Error ? new Error(data.Error) : null;
}
toString() {
const componentsString = this.InformationComponents.length
? this.InformationComponents.map(component => component.toString()).join(', ')
: 'null';
return `GetBestMatchV4Response: Level = ${this.Level}, LevelDescription = ${this.LevelDescription}, Latitude = ${this.Latitude}, Longitude = ${this.Longitude}, Zip = ${this.Zip}, InformationComponents = [${componentsString}], Error = ${this.Error ? this.Error.toString() : 'null'}`;
}
}
/**
* Response from GetDistanceToWater API, containing the estimated distance to the nearest saltwater
* and the coordinates of the closest saltwater location.
*/
export class GetDistanceToWaterResponse {
constructor(data = {}) {
this.DistanceToWater = data.DistanceToWater;
this.Latitude = data.Latitude;
this.Longitude = data.Longitude;
this.WaterLat = data.WaterLat;
this.WaterLon = data.WaterLon;
this.Error = data.Error ? new Error(data.Error) : null;
}
toString() {
return `GetDistanceToWaterResponse: MilesToWater = ${this.DistanceToWater}, Latitude = ${this.Latitude}, Longitude = ${this.Longitude}, ClosestWaterLatitude = ${this.WaterLat}, ClosestWaterLongitude = ${this.WaterLon}, Error = ${this.Error ? this.Error.toString() : 'null'}`;
}
}
/**
* Response from GetReverseLocation API, containing the estimated address, city, state, ZIP code,
* and county for the given coordinates.
*/
export class GetReverseLocationResponse {
constructor(data = {}) {
this.Address = data.Address;
this.City = data.City;
this.State = data.State;
this.Zip = data.Zip;
this.County = data.County;
this.Error = data.Error ? new Error(data.Error) : null;
}
toString() {
return `GetReverseLocationResponse: Address = ${this.Address}, City = ${this.City}, State = ${this.State}, Zip = ${this.Zip}, County = ${this.County}, Error = ${this.Error ? this.Error.toString() : 'null'}`;
}
}
export default GetDistanceToWaterResponse;