import { FeatureCollection, Point } from "geojson"; import { GeocodeResponse, GetPlaceResponse, ReverseGeocodeResponse, SearchNearbyResponse, SearchTextResponse, SuggestResponse } from "@aws-sdk/client-geo-places"; /** * Base options for converting a GeoPlaces response to a GeoJSON FeatureCollection. * * @group GeoPlaces */ export interface BaseGeoPlacesOptions { /** * Controls the flattening of nested properties. * * If true, nested properties within the properties field on each Feature will be flattened into a single flat list. * This is required when using the properties in MapLibre expressions, as MapLibre doesn't support nested properties. * * @default true */ flattenProperties?: boolean; } /** * Options for converting a GetPlaceResponse to a GeoJSON FeatureCollection. * * @group GeoPlaces */ export interface GetPlaceResponseOptions extends BaseGeoPlacesOptions { } /** * Convert GetPlaceResponse responses from our standalone Places SDK to a FeatureCollection with a Point Feature. Each * Feature is given a locally-unique integer id for easier use with MapLibre. `Position` is extracted as the location * for the Point Feature. All other properties in the response are mapped into the Feature properties. * * If the result doesn't contain location information, the output will be an empty FeatureCollection. * * @example Drawing the result of GetPlaceCommand: * * ```js * // ... * const command = new amazonLocationClient.GetPlaceCommand(params); * * try { * const response = await client.send(command); * if (response.error) { * // error handling * } else { * const featureCollection = amazonLocationDataConverter.getPlaceResponseToFeatureCollection(response); * map.addSource("search-result", { type: "geojson", data: featureCollection }); * map.addLayer({ * id: "search-result", * type: "circle", * source: "search-result", * paint: { * "circle-radius": 6, * "circle-color": "#B42222", * }, * }); * } * } catch (error) {} * // ... * ``` * * @param response GetPlaceResponse from the GetPlace API. * @param options Options for flattening the properties. * @returns A GeoJSON FeatureCollection * @group GeoPlaces */ export declare function getPlaceResponseToFeatureCollection(response: GetPlaceResponse, options?: GetPlaceResponseOptions): FeatureCollection; /** Options for converting a GeocodeResponse to a GeoJSON FeatureCollection. */ export interface GeocodeResponseOptions extends BaseGeoPlacesOptions { } /** * Convert GeocodeResponse responses from our standalone Places SDK to a FeatureCollection with a Point Features. Each * item in the `ResultItems` list is extracted as its own feature. `Position` is extracted as the location for the Point * Feature. All other properties in the response are mapped into the Feature properties. * * If a result item doesn't contain location information, it will not appear in the FeatureCollection. * * @example Drawing the result of GeocodeCommand: * * ```js * // ... * const command = new amazonLocationClient.GeocodeCommand(params); * * try { * const response = await client.send(command); * if (response.error) { * // error handling * } else { * const featureCollection = amazonLocationDataConverter.geocodeResponseToFeatureCollection(response); * map.addSource("search-result", { type: "geojson", data: featureCollection }); * map.addLayer({ * id: "search-result", * type: "circle", * source: "search-result", * paint: { * "circle-radius": 6, * "circle-color": "#B42222", * }, * }); * } * } catch (error) {} * // ... * ``` * * @param response GeocodeResponse from the Geocode API. * @param options Options for flattening the properties. * @returns A GeoJSON FeatureCollection * @group GeoPlaces */ export declare function geocodeResponseToFeatureCollection(response: GeocodeResponse, options?: GeocodeResponseOptions): FeatureCollection; /** Options for converting a ReverseGeocodeResponse to a GeoJSON FeatureCollection. */ export interface ReverseGeocodeResponseOptions extends BaseGeoPlacesOptions { } /** * Convert ReverseGeocodeResponse responses from our standalone Places SDK to a FeatureCollection with a Point Features. * Each item in the `ResultItems` list is extracted as its own feature. `Position` is extracted as the location for the * Point Feature. All other properties in the response are mapped into the Feature properties. * * If a result item doesn't contain location information, it will not appear in the FeatureCollection. * * @example Drawing the result of ReverseGeocodeCommand: * * ```js * // ... * const command = new amazonLocationClient.ReverseGeocodeCommand(params); * * try { * const response = await client.send(command); * if (response.error) { * // error handling * } else { * const featureCollection = amazonLocationDataConverter.reverseGeocodeResponseToFeatureCollection(response); * map.addSource("search-result", { type: "geojson", data: featureCollection }); * map.addLayer({ * id: "search-result", * type: "circle", * source: "search-result", * paint: { * "circle-radius": 6, * "circle-color": "#B42222", * }, * }); * } * } catch (error) {} * // ... * ``` * * @param response ReverseGeocodeResponse from the ReverseGeocode API. * @param options Options for flattening the properties. * @returns A GeoJSON FeatureCollection * @group GeoPlaces */ export declare function reverseGeocodeResponseToFeatureCollection(response: ReverseGeocodeResponse, options?: ReverseGeocodeResponseOptions): FeatureCollection; /** Options for converting a GetPlaceResponse to a GeoJSON FeatureCollection. */ export interface SearchNearbyResponseOptions extends BaseGeoPlacesOptions { } /** * Convert SearchNearbyResponse responses from our standalone Places SDK to a FeatureCollection with a Point Features. * Each item in the `ResultItems` list is extracted as its own feature. `Position` is extracted as the location for the * Point Feature. All other properties in the response are mapped into the Feature properties. * * If a result item doesn't contain location information, it will not appear in the FeatureCollection. * * @example Drawing the result of SearchNearbyCommand: * * ```js * // ... * const command = new amazonLocationClient.SearchNearbyCommand(params); * * try { * const response = await client.send(command); * if (response.error) { * // error handling * } else { * const featureCollection = amazonLocationDataConverter.searchNearbyResponseToFeatureCollection(response); * map.addSource("search-result", { type: "geojson", data: featureCollection }); * map.addLayer({ * id: "search-result", * type: "circle", * source: "search-result", * paint: { * "circle-radius": 6, * "circle-color": "#B42222", * }, * }); * } * } catch (error) {} * // ... * ``` * * @param response SearchNearbyResponse from the SearchNearby API. * @param options Options for flattening the properties. * @returns A GeoJSON FeatureCollection * @group GeoPlaces */ export declare function searchNearbyResponseToFeatureCollection(response: SearchNearbyResponse, options?: SearchNearbyResponseOptions): FeatureCollection; /** Options for converting a GetPlaceResponse to a GeoJSON FeatureCollection. */ export interface SearchTextResponseOptions extends BaseGeoPlacesOptions { } /** * Convert SearchTextResponse responses from our standalone Places SDK to a FeatureCollection with a Point Features. * Each item in the `ResultItems` list is extracted as its own feature. `Position` is extracted as the location for the * Point Feature. All other properties in the response are mapped into the Feature properties. * * If a result item doesn't contain location information, it will not appear in the FeatureCollection. * * @example Drawing the result of SearchTextCommand: * * ```js * // ... * const command = new amazonLocationClient.SearchTextCommand(params); * * try { * const response = await client.send(command); * if (response.error) { * // error handling * } else { * const featureCollection = amazonLocationDataConverter.searchTextResponseToFeatureCollection(response); * map.addSource("search-result", { type: "geojson", data: featureCollection }); * map.addLayer({ * id: "search-result", * type: "circle", * source: "search-result", * paint: { * "circle-radius": 6, * "circle-color": "#B42222", * }, * }); * } * } catch (error) {} * // ... * ``` * * @param response SearchTextResponse from the SearchText API. * @param options Options for flattening the properties. * @returns A GeoJSON FeatureCollection * @group GeoPlaces */ export declare function searchTextResponseToFeatureCollection(response: SearchTextResponse, options?: SearchTextResponseOptions): FeatureCollection; /** Options for converting a GetPlaceResponse to a GeoJSON FeatureCollection. */ export interface SuggestResponseOptions extends BaseGeoPlacesOptions { } /** * Convert SuggestResponse responses from our standalone Places SDK to a FeatureCollection with a Point Features. Each * item in the `ResultItems` list is extracted as its own feature. `Place.Position` is extracted as the location for the * Point Feature. All other properties in the response are mapped into the Feature properties. * * If a result item doesn't contain location information, it will not appear in the FeatureCollection. * * @example Drawing the result of SuggestCommand: * * ```js * // ... * const command = new amazonLocationClient.SuggestCommand(params); * * try { * const response = await client.send(command); * if (response.error) { * // error handling * } else { * const featureCollection = amazonLocationDataConverter.suggestResponseToFeatureCollection(response); * map.addSource("search-result", { type: "geojson", data: featureCollection }); * map.addLayer({ * id: "search-result", * type: "circle", * source: "search-result", * paint: { * "circle-radius": 6, * "circle-color": "#B42222", * }, * }); * } * } catch (error) {} * // ... * ``` * * @param response SuggestResponse from the SearchText API. * @param options Options for flattening the properties. * @returns A GeoJSON FeatureCollection * @group GeoPlaces */ export declare function suggestResponseToFeatureCollection(response: SuggestResponse, options?: SuggestResponseOptions): FeatureCollection;