Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


web / lib/services/geocoding/types

lib/services/geocoding/types

Defines the core TypeScript types, interfaces, and constants for the geocoding service.

This file serves as a central repository for the data structures and contracts used throughout the geocoding system. It ensures type safety and consistency across different modules, including the main service, provider manager, cache manager, and operations.

It defines:

  • The structure of a geocoding result.
  • The shape of batch geocoding results.
  • A custom GeocodingError class for standardized error handling.
  • Configuration interfaces for providers and the overall service settings.
  • Shared constants like collection slugs and default URLs.

Classes

GeocodingError

Extends

  • Error

Constructors

Constructor

new GeocodingError(message, code, retryable): GeocodingError

Parameters
message

string

code

string

retryable

boolean = false

Returns

GeocodingError

Overrides

Error.constructor

Properties

prepareStackTrace()?

static optional prepareStackTrace: (err, stackTraces) => any

Optional override for formatting stack traces

Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces 

Inherited from

Error.prepareStackTrace

stackTraceLimit

static stackTraceLimit: number

Inherited from

Error.stackTraceLimit

cause?

optional cause: unknown

Inherited from

Error.cause

name

name: string

Inherited from

Error.name

message

message: string

Inherited from

Error.message

stack?

optional stack: string

Inherited from

Error.stack

code

code: string

retryable

retryable: boolean = false

Methods

captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Create .stack property on a target object

Parameters
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

Error.captureStackTrace

Interfaces

GeocodingResult

Extends

  • Pick<LocationCache, "latitude" | "longitude" | "confidence" | "provider" | "normalizedAddress">

Properties

components

components: undefined | { streetNumber?: null | string; streetName?: null | string; city?: null | string; region?: null | string; postalCode?: null | string; country?: null | string; }

Type declaration

undefined

{ streetNumber?: null | string; streetName?: null | string; city?: null | string; region?: null | string; postalCode?: null | string; country?: null | string; }

streetNumber?

optional streetNumber: null | string

Street number

streetName?

optional streetName: null | string

Street name

city?

optional city: null | string

City name

region?

optional region: null | string

State/Region/Province

postalCode?

optional postalCode: null | string

Postal/ZIP code

country?

optional country: null | string

Country name

metadata

metadata: undefined | null | string | number | boolean | unknown[] | {[k: string]: unknown; }

fromCache?

optional fromCache: boolean

normalizedAddress

normalizedAddress: string

Normalized address for better matching

Inherited from

Pick.normalizedAddress

latitude

latitude: number

Latitude coordinate (WGS84)

Inherited from

Pick.latitude

longitude

longitude: number

Longitude coordinate (WGS84)

Inherited from

Pick.longitude

provider

provider: string

Name of the geocoding provider used

Inherited from

Pick.provider

confidence?

optional confidence: null | number

Confidence score (0-1)

Inherited from

Pick.confidence


BatchGeocodingResult

Properties

results

results: Map<string, GeocodingResult | GeocodingError>

summary

summary: object

total

total: number

successful

successful: number

failed

failed: number

cached

cached: number


ProviderConfig

Properties

name

name: string

geocoder

geocoder: Geocoder

priority

priority: number

enabled

enabled: boolean


GeocodingSettings

Properties

enabled

enabled: boolean

fallbackEnabled

fallbackEnabled: boolean

providerSelection

providerSelection: object

strategy

strategy: string

requiredTags

requiredTags: string[]

caching

caching: object

enabled

enabled: boolean

ttlDays

ttlDays: number

Variables

LOCATION_CACHE_COLLECTION

const LOCATION_CACHE_COLLECTION: "location-cache" = "location-cache"


NOMINATIM_BASE_URL

const NOMINATIM_BASE_URL: "https://nominatim.openstreetmap.org" = "https://nominatim.openstreetmap.org"


TIMETILES_USER_AGENT

const TIMETILES_USER_AGENT: "TimeTiles-Test/1.0" = "TimeTiles-Test/1.0"

Last updated on