You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plugin can easily be extended to support other providers. Current extensions:
29
30
@@ -84,147 +85,4 @@ var geocoder = L.Control.geocoder({
84
85
This will add a polygon representing the result's boundingbox when a result is selected.
85
86
86
87
# 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:
|`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
-
newL.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.
|`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″'`.
|`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.
0 commit comments