source: spip-zone/_plugins_/gisban/lib/leaflet.photon/README.md @ 89041

Last change on this file since 89041 was 88937, checked in by laurent@…, 6 years ago

Création du module GIS BAN qui ajoute aux cartes de GIS 4 un moteur de recherche pour la base BAN

File size: 2.1 KB
Line 
1leaflet.photon
2==============
3
4This is [leaflet](http://leafletjs.com/) plugin for [photon](https://github.com/komoot/photon/).
5
6## Sample Usage
7
8```javascript
9function myHandler(geojson) {
10    console.debug(geojson);
11};
12
13var map = L.map('map', {
14  photonControl: true,
15  photonControlOptions: {
16      resultsHandler: myHandler,
17      placeholder: 'Try me …',
18      position: 'topleft'}
19  }
20);
21```
22
23## Options
24- `url` URL of the Photon API to use. *Default: 'http://photon.komoot.de/api/?'*
25- `placeholder` Placeholder of the search input. *Default: "Start typing..."*
26- `noResultLabel` Message to display when no result has been found. *Default: "No result"*
27- `minChar` Min char to be typed before actually searching (can be a function that
28   takes the val as parameter and must return a boolean). *Default: 3*
29- `limit` Number of results max to return from API. *Default: 5*
30- `submitDelay` Min time buffer between to sent request, to avoid too much
31  requests when typing fast (in milliseconds). *Default: 300*
32- `includePosition` Whether to include or not the map center as location bias
33  for the search. *Default: true*
34- `feedbackEmail` Email to use as feedback link. Set to null to disable the
35  feedback box. *Default: "photon@komoot.de"*
36- `lang` land code (en, it, fr…) to send to Photon API. *Default: null*
37- `onSelected` Action to run when user select a search result. *Default: center
38  map on selected result's latlng*
39- `formatResult` Optional function to control the way geojson features are
40  displayed in the results box.
41- `formatType` Optional function to control the way features types (amenity,
42  school, etc.) are displayed in the default `formatResult` function.
43- `resultsHandler` Optional function that will be called when a geojson is
44  retrieved from the API. You way want to use this to display points in the map
45  for instance.
46
47
48## Events
49- `focus` sent on input focus
50- `blur` sent on input blur
51- `hide` sent on result box hide
52- `selected` sent on result select. Event: {choice: <selected geojson feature>}
53- `ajax:send` sent when an ajax call is made
54- `ajax:return` sent when an ajax call is returned
Note: See TracBrowser for help on using the repository browser.