Skip to content

Commit 756ae93

Browse files
committed
Generate API documentation using TypeDoc
1 parent 812b149 commit 756ae93

21 files changed

+444
-160
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
bundle.js
22
demo-*/package-lock.json
33
dist/
4+
docs/
45
node_modules/

README.md

Lines changed: 2 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ The plugin supports many different data providers:
2424
- [HERE Geocoder API](https://developer.here.com/documentation/geocoder/topics/introduction.html)
2525
- [Neutrino API](https://www.neutrinoapi.com/api/geocode-address/)
2626
- [Plus codes](https://plus.codes/) (formerly OpenLocationCode) (requires [open-location-code](https://www.npmjs.com/package/open-location-code))
27+
- [ArcGIS](https://developers.arcgis.com/features/geocoding/)
2728

2829
The plugin can easily be extended to support other providers. Current extensions:
2930

@@ -84,147 +85,4 @@ var geocoder = L.Control.geocoder({
8485
This will add a polygon representing the result's boundingbox when a result is selected.
8586

8687
# API
87-
88-
## L.Control.Geocoder
89-
90-
This is the geocoder control. It works like any other Leaflet control, and is added to the map.
91-
92-
### Constructor
93-
94-
This plugin supports the standard JavaScript constructor (to be invoked using `new`) as well as the [class factory methods](https://leafletjs.com/reference.html#class-class-factories) known from Leaflet:
95-
96-
```js
97-
new L.Control.Geocoder(options);
98-
// or
99-
L.Control.geocoder(options);
100-
```
101-
102-
### Options
103-
104-
| Option | Type | Default | Description |
105-
| ------------------ | --------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
106-
| `collapsed` | Boolean | `true` | Collapse control unless hovered/clicked |
107-
| `expand` | String | `"touch"` | How to expand a collapsed control: `touch` or `click` or `hover` |
108-
| `position` | String | `"topright"` | Control [position](https://leafletjs.com/reference.html#control-positions) |
109-
| `placeholder` | String | `"Search..."` | Placeholder text for text input |
110-
| `errorMessage` | String | `"Nothing found."` | Message when no result found / geocoding error occurs |
111-
| `iconLabel` | String | `"Initiate a new search"` | Accessibility label for the search icon used by screen readers |
112-
| `geocoder` | IGeocoder | `new L.Control.Geocoder.Nominatim()` | Object to perform the actual geocoding queries |
113-
| `showUniqueResult` | Boolean | `true` | Immediately show the unique result without prompting for alternatives |
114-
| `showResultIcons` | Boolean | `false` | Show icons for geocoding results (if available); supported by Nominatim |
115-
| `suggestMinLength` | Number | `3` | Minimum number characters before suggest functionality is used (if available from geocoder) |
116-
| `suggestTimeout` | Number | `250` | Number of milliseconds after typing stopped before suggest functionality is used (if available from geocoder) |
117-
| `query` | String | `""` | Initial query string for text input |
118-
| `queryMinLength` | Number | `1` | Minimum number of characters in search text before performing a query |
119-
120-
### Methods
121-
122-
| Method | Returns | Description |
123-
| --------------------------------------- | ------- | --------------------------------------- |
124-
| `markGeocode(<GeocodingResult> result)` | `this` | Marks a geocoding result on the map |
125-
| `setQuery(<String> query)` | `this` | Sets the query string on the text input |
126-
127-
## L.Control.Geocoder.Nominatim
128-
129-
Uses [Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim) to respond to geocoding queries. This is the default
130-
geocoding service used by the control, unless otherwise specified in the options. Implements `IGeocoder`.
131-
132-
Unless using your own Nominatim installation, please refer to the [Nominatim usage policy](https://operations.osmfoundation.org/policies/nominatim/).
133-
134-
### Constructor
135-
136-
```js
137-
new L.Control.Geocoder.Nominatim(options);
138-
// or
139-
L.Control.Geocoder.nominatim(options);
140-
```
141-
142-
### Options
143-
144-
| Option | Type | Default | Description |
145-
| ---------------------- | -------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
146-
| `serviceUrl` | String | `"https://nominatim.openstreetmap.org/"` | URL of the service |
147-
| `geocodingQueryParams` | Object | `{}` | Additional URL parameters (strings) that will be added to geocoding requests; can be used to restrict results to a specific country for example, by providing the [`countrycodes`](https://wiki.openstreetmap.org/wiki/Nominatim#Parameters) parameter to Nominatim |
148-
| `reverseQueryParams` | Object | `{}` | Additional URL parameters (strings) that will be added to reverse geocoding requests |
149-
| `htmlTemplate` | function | special | A function that takes an GeocodingResult as argument and returns an HTML formatted string that represents the result. Default function breaks up address in parts from most to least specific, in attempt to increase readability compared to Nominatim's naming |
150-
151-
## L.Control.Geocoder.Bing
152-
153-
Uses [Bing Locations API](http://msdn.microsoft.com/en-us/library/ff701715.aspx) to respond to geocoding queries. Implements `IGeocoder`.
154-
155-
Note that you need an API key to use this service.
156-
157-
### Constructor
158-
159-
```ts
160-
new L.Control.Geocoder.Bing(options);
161-
// or
162-
L.Control.Geocoder.bing(options);
163-
```
164-
165-
## L.Control.Geocoder.OpenCage
166-
167-
Uses [OpenCage Data API](https://opencagedata.com/) to respond to geocoding queries. Implements `IGeocoder`.
168-
169-
Note that you need an API key to use this service.
170-
171-
### Constructor
172-
173-
```ts
174-
new L.Control.Geocoder.OpenCage(options);
175-
// or
176-
L.Control.Geocoder.opencage(options);
177-
```
178-
179-
### Options
180-
181-
| Option | Type | Default | Description |
182-
| ---------------------- | ------ | ------------------------------------------------ | ------------------------------------------------------------------------------------ |
183-
| `serviceUrl` | String | `"https://api.opencagedata.com/geocode/v1/json"` | URL of the service |
184-
| `geocodingQueryParams` | Object | `{}` | Additional URL parameters (strings) that will be added to geocoding requests |
185-
| `reverseQueryParams` | Object | `{}` | Additional URL parameters (strings) that will be added to reverse geocoding requests |
186-
187-
## L.Control.Geocoder.LatLng
188-
189-
Parses basic latitude/longitude strings such as `'50.06773 14.37742'`, `'N50.06773 W14.37742'`, `'S 50° 04.064 E 014° 22.645'`, or `'S 50° 4′ 03.828″, W 14° 22′ 38.712″'`.
190-
191-
### Constructor
192-
193-
```ts
194-
new L.Control.Geocoder.LatLng(options);
195-
// or
196-
L.Control.Geocoder.latLng(options);
197-
```
198-
199-
### Options
200-
201-
| Option | Type | Default | Description |
202-
| -------------- | --------- | ------- | --------------------------------------------------------- |
203-
| `next` | IGeocoder | | The next geocoder to use for non-supported queries. |
204-
| `sizeInMeters` | Number | 10000 | The size in meters used for passing to `LatLng.toBounds`. |
205-
206-
## IGeocoder
207-
208-
An interface implemented to respond to geocoding queries.
209-
210-
### Methods
211-
212-
| Method | Returns | Description |
213-
| ----------------------------------------------------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
214-
| `geocode(<String> query, callback, context)` | `GeocodingResult[]` | Performs a geocoding query and returns the results to the callback in the provided context |
215-
| `suggest(<String> query, callback, context)` | `GeocodingResult[]` | Performs a geocoding query suggestion (this happens while typing) and returns the results to the callback in the provided context |
216-
| `reverse(<L.LatLng> location, <Number> scale, callback, context)` | `GeocodingResult[]` | Performs a reverse geocoding query and returns the results to the callback in the provided context |
217-
218-
## GeocodingResult
219-
220-
An object that represents a result from a geocoding query.
221-
222-
### Properties
223-
224-
| Property | Type | Description |
225-
| -------- | -------------- | ---------------------------------------------------- |
226-
| `name` | String | Name of found location |
227-
| `bbox` | L.LatLngBounds | The bounds of the location |
228-
| `center` | L.LatLng | The center coordinate of the location |
229-
| `icon` | String | URL for icon representing result; optional |
230-
| `html` | String | (optional) HTML formatted representation of the name |
88+
→ docs/

package-lock.json

Lines changed: 107 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"build:demo-rollup": "cd demo-rollup && npm install && npm run build",
1414
"build:demo-webpack": "cd demo-rollup && npm install && npm run build",
1515
"changelog": "conventional-changelog --infile CHANGELOG.md --same-file --output-unreleased",
16+
"doc": "typedoc --excludePrivate --stripInternal --moduleResolution node --out docs/ src/",
1617
"test": "jest",
1718
"lint": "eslint --ext .js,.ts ."
1819
},
@@ -74,6 +75,7 @@
7475
"rollup-plugin-terser": "^5.3.0",
7576
"ts-jest": "^26.4.4",
7677
"tslib": "^1.11.1",
78+
"typedoc": "^0.19.2",
7779
"typescript": "^3.8.3"
7880
},
7981
"optionalDependencies": {

0 commit comments

Comments
 (0)