@maptiler/geocoding-control
Version:
The Javascript & TypeScript Map Control component for MapTiler Geocoding service. Easy to be integrated into any JavaScript mapping application.
94 lines (93 loc) • 4.49 kB
TypeScript
import { AnimationOptions, FitOptions } from 'ol/View';
import { Options } from 'ol/control/Control';
import { StyleFunction, StyleLike } from 'ol/style/Style';
import { FlatStyleLike } from 'ol/style/flat';
import { MaptilerGeocoderOptions } from '../geocoder/geocoder-options';
import { FlyToFeatures, PickedResultStyle } from '../types';
export type OpenLayersGeocodingControlOptions = Omit<MaptilerGeocoderOptions, "fetchFullGeometryOnPick"> & {
/**
* Marker to be added to the map at the location of the user-selected result.
*
* Default value is `true`.
*/
marker?: boolean;
/**
* Displays a marker on the selected feature from the result list. `marker` must be also enabled for this to display.
*
* Default: `true`.
*/
markerOnSelected?: boolean;
/**
* Marker be added to the map at the location the geocoding results.
*
* Default value is `true`.
*/
showResultMarkers?: boolean;
/**
* Animation to picked feature on the map.
*
* - If `false` or `null` then animating the map to a selected result is disabled.
* - If `true` or `undefined` then animating the map will use the default animation parameters.
* - If the value is [AnimationOptions](https://openlayers.org/en/latest/apidoc/module-ol_View.html#~AnimationOptions)
* and [FitOptions](https://openlayers.org/en/latest/apidoc/module-ol_View.html#~FitOptions)
* then it will be passed as options to the map's view [animate](https://openlayers.org/en/latest/apidoc/module-ol_View-View.html#animate)
* or [fit](https://openlayers.org/en/latest/apidoc/module-ol_View-View.html#fit) method providing control over the animation of the transition.
*
* Default value is `true`.
*/
flyTo?: null | boolean | (AnimationOptions & FitOptions);
/**
* Specifies if found features (shown in result list) should be also animated to on the map. `flyTo` muset be enabled in any way for this to have any effect.
*
* - If `false` or `"never"` then animating the map to found features is disabled.
* - If `true` or `"always"` then animating the map to found features is enabled.
* - If `"external"` then animating the map to found features is enabled only when explicitly calling `setQuery` or `submitQuery` methods.
*
* Default: `"external"`.
*/
flyToFeatures?: boolean | FlyToFeatures;
/**
* Specifies if selected (not picked) feature should be also animated to on the map.
*
* Default: `false`.
*/
flyToSelected?: boolean;
/**
* Style for full feature geometry GeoJSON.
*
* - If `false` or `null` then no full geometry is drawn.
* - If `true` or `undefined` then default-styled full geometry is drawn.
* - If the value is [StyleLike](https://openlayers.org/en/latest/apidoc/module-ol_style_Style.html#~StyleLike)
* or [FlatStyleLike](https://openlayers.org/en/latest/apidoc/module-ol_style_flat.html#~FlatStyleLike)
* then it must represent the style and will be used to style the full geometry.
*
* Default is the default style.
*/
fullGeometryStyle?: null | boolean | StyleLike | FlatStyleLike;
/**
* Opens the Geocoder result list above the query input instead of below. Used when positioned near the bottom of a map.
*
* Default: `false`.
*/
openListOnTop?: boolean;
/**
* Style of the picked result on the map:
* - `"marker-only"`: Show only a marker at the center of the feature.
* - `"full-geometry"`: Display the full feature geometry.
* - `"full-geometry-including-polygon-center-marker"`: Display full geometry with a marker at the polygon center.
*
* Default: `"full-geometry"`.
*/
pickedResultStyle?: PickedResultStyle;
/**
* Specifies the zoom level to animate the map to for a geocoded result when no bounding box is present or when the result is a point.
* If a bounding box is present and not a point, the map will fit to the bounding box.
*
* Values are key-value pairs where the key is a `<type>` or `<type>.<category>` and the value is the zoom level.
*
* Default: `ZOOM_DEFAULTS`.
*/
zoom?: Record<string, number>;
} & Omit<Options, "element">;
export declare const ZOOM_DEFAULTS: Record<string, number>;
export declare const DEFAULT_GEOMETRY_STYLE: (options: OpenLayersGeocodingControlOptions) => StyleFunction;