This is leaflet plugin for photon.
Use the map options to create a Photon search control when the map is created:
function myHandler(geojson) {
console.debug(geojson);
};
var map = L.map('map', {
photonControl: true,
photonControlOptions: {
resultsHandler: myHandler,
placeholder: 'Try me …',
position: 'topleft'}
}
);Or create a control afterwards:
var searchControl = L.control.photon(photonControlOptions);
searchControl.addTo(map);urlURL of the Photon API to use. Default: 'https://photon.komoot.io/api/?'placeholderPlaceholder of the search input. Default: "Start typing..."noResultLabelMessage to display when no result has been found. Default: "No result"minCharMin char to be typed before actually searching (can be a function that takes the val as parameter and must return a boolean). Default: 3limitNumber of results max to return from API. Default: 5submitDelayMin time buffer between to sent request, to avoid too much requests when typing fast (in milliseconds). Default: 300includePositionWhether to include or not the map center as location bias for the search. Default: truebboxFilter results on bounding box array. Default: nullfeedbackEmailEmail to use as feedback link. Set to null to disable the feedback box. Default: "[email protected]"feedbackLabelMessage for feedback link. Default: "Feedback"langland code (en, it, fr…) to send to Photon API. Default: nullonSelectedAction to run when user select a search result. Default: center map on selected result's latlngosm_tagosm_tag (e.g. 'boundary:administrative') to send to Photon API for filtering. Default: nullformatResultOptional function to control the way geojson features are displayed in the results box.formatTypeOptional function to control the way features types (amenity, school, etc.) are displayed in the defaultformatResultfunction.resultsHandlerOptional function that will be called when a geojson is retrieved from the API. You way want to use this to display points in the map for instance.location_bias_scaleOptional option to control this parameter in the API search calls. From 0 to 1. Default:undefined.
focussent on input focusblursent on input blurhidesent on result box hideselectedsent on result select. Event: {choice: }ajax:sendsent when an ajax call is madeajax:returnsent when an ajax call is returned