/// import { MigrationLatLng } from "../common"; import { MigrationPlacesService } from "../places"; import * as turf from "@turf/turf"; import { UnitSystem } from "./defines"; import { CalculateRouteMatrixRequest, CalculateRoutesRequest, OptimizeWaypointsRequest, RoutePedestrianTravelStep, RouteVehicleTravelStep } from "@aws-sdk/client-geo-routes"; import { GeoPlacesClient } from "@aws-sdk/client-geo-places"; import { CountryGeoJSON } from "./country_geojson/countryType"; type TurfPolygon = ReturnType; export interface ParseOrFindLocationResponse { locationLatLng: MigrationLatLng; position: [number, number]; } export declare function parseOrFindLocations(locationInputs: (string | google.maps.LatLng | MigrationLatLng | google.maps.LatLngLiteral | google.maps.Place)[], placesService: MigrationPlacesService, findPlaceFromQueryFields: string[]): Promise; export declare function parseOrFindLocation(locationInput: any, placesService: MigrationPlacesService, findPlaceFromQueryFields: string[]): Promise; export declare function formatSecondsAsGoogleDurationText(seconds: any): string; /** * Populates avoidance options for Amazon Location Service routes based on Google Maps API request. * * This function takes a Google Maps Distance Matrix or Directions request and populates the corresponding Amazon * Location Service avoidance options in the input object. * * Avoidance options include: * * - Toll roads and transponders (if avoidTolls is true) * - Ferries (if avoidFerries is true) * - Controlled access highways (if avoidHighways is true) * * The function modifies the input object in-place, adding or updating the Avoid property. * * @param request - Google Maps API request object (DistanceMatrix or Directions) * @param input - Amazon Location Service request object to be populated */ export declare function populateAvoidOptions(request: google.maps.DistanceMatrixRequest | google.maps.DirectionsRequest, input: CalculateRouteMatrixRequest | CalculateRoutesRequest | OptimizeWaypointsRequest): void; /** * Populates the TravelMode option in the Amazon Location Service request based on the travelMode specified in the * Google Maps request. * * @param options - The Google Maps request containing the travelMode option * @param input - The Amazon Location Service request to be populated */ export declare function populateTravelModeOption(options: google.maps.DirectionsRequest | google.maps.DistanceMatrixRequest, input: CalculateRoutesRequest | CalculateRouteMatrixRequest | OptimizeWaypointsRequest): void; /** * Gets formatted addresses for an array of coordinate positions using reverse geocoding. * * @param client - GeoPlacesClient instance for reverse geocoding * @param positions - Array of [longitude, latitude] coordinates * @param callback - Function to receive the array of formatted addresses */ export declare function getReverseGeocodedAddresses(client: GeoPlacesClient, positions: number[][], callback: (addresses: string[]) => void): void; /** * Creates Turf.js polygons from GeoJSON feature collection, handling both Polygon and MultiPolygon * * @param geojson - GeoJSON FeatureCollection containing country boundaries * @returns Array of Turf.js polygon features */ export declare function createPolygons(geojson: CountryGeoJSON): TurfPolygon[]; /** * Determines if a point is within any polygon in the given array * * @param point - Turf.js point feature * @param polygons - Array of Turf.js polygon features * @returns Boolean indicating if point is within any polygon */ export declare function isPointInPolygons(point: number[], polygons: TurfPolygon[]): boolean; /** * Determines the appropriate unit system based on the country of the provided coordinates. Returns UnitSystem.IMPERIAL * for addresses in US, Liberia, and Myanmar, and UnitSystem.METRIC for all other countries. * * @param options - Object containing unitSystem preference * @param originPoint - LatLong values as number[] containing location information * @returns UnitSystem.IMPERIAL if location is in USA, Myanmar, or Liberia; UnitSystem.METRIC otherwise */ export declare function getUnitSystem(options: google.maps.DirectionsRequest | google.maps.DistanceMatrixRequest, originPoint: number[]): UnitSystem; /** * Determines if a point is within any of the imperial unit system countries * * @param coordinates - [longitude, latitude] array * @returns Boolean indicating if point is within an imperial unit system country */ export declare function isPointInImperialCountry(coordinates: number[]): boolean; /** * Formats a distance value based on the specified unit system (metric or imperial). * * Metric formatting rules: * * 1. < 1 km: Format in meters, rounded to nearest meter ("750 m") * 2. 1 km to 999 km: Format in km with one decimal place ("12.5 km", "542.0 km") * 3. > = 1000 km: Format in km with no decimal places and thousands separator ("1,234 km") * * Imperial formatting rules: * * 1. < 0.1 miles: Format in feet, rounded to nearest foot ("528 ft") * 2. 0.1 miles to 999 miles: Format in miles with one decimal place ("0.5 mi", "12.0 mi", "542.0 mi") * 3. > = 1000 miles: Format in miles with no decimal places and thousands separator ("1,234 mi") * * @param meters - The distance in meters * @param unitSystem - UnitSystem preference * @returns Formatted distance string with unit suffix */ export declare function formatDistanceBasedOnUnitSystem(meters: number, unitSystem: UnitSystem): string; export declare const numberFormatter: Intl.NumberFormat; export declare const largeNumberFormatter: Intl.NumberFormat; /** * Use a RouteVehicleTravelStep or RoutePedestrianTravelStep to get a corresponding maneuver response field in Google's * google.maps.DirectionsStep. * * Our Amazon Location steps have StepDetails for different step types (e.g. turn, keep, exit, etc...) * * Examples of maneuver response field in google.maps.DirectionsStep are things like: keep-left, turn-right, ramp-left, * etc... * * @param step - The Amazon Location route step (RouteVehicleTravelStep | RoutePedestrianTravelStep) * @returns Formatted string describing maneuver */ export declare const getManeuver: (step: RouteVehicleTravelStep | RoutePedestrianTravelStep) => string; export {};