mirror of
https://github.com/netzmacht/contao-leaflet-libraries.git
synced 2025-11-28 19:13:54 +01:00
Update Control.Geocoder to 1.6.0.
This commit is contained in:
@@ -1,123 +1,126 @@
|
||||
.leaflet-control-geocoder {
|
||||
border-radius: 4px;
|
||||
background: white;
|
||||
min-width: 26px;
|
||||
min-height: 26px;
|
||||
border-radius: 4px;
|
||||
background: white;
|
||||
min-width: 26px;
|
||||
min-height: 26px;
|
||||
}
|
||||
|
||||
.leaflet-touch .leaflet-control-geocoder {
|
||||
min-width: 30px;
|
||||
min-height: 30px;
|
||||
min-width: 30px;
|
||||
min-height: 30px;
|
||||
}
|
||||
|
||||
.leaflet-control-geocoder a, .leaflet-control-geocoder .leaflet-control-geocoder-icon {
|
||||
border-bottom: none;
|
||||
display: inline-block;
|
||||
.leaflet-control-geocoder a,
|
||||
.leaflet-control-geocoder .leaflet-control-geocoder-icon {
|
||||
border-bottom: none;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.leaflet-control-geocoder .leaflet-control-geocoder-alternatives a {
|
||||
width: inherit;
|
||||
height: inherit;
|
||||
line-height: inherit;
|
||||
width: inherit;
|
||||
height: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
.leaflet-control-geocoder a:hover, .leaflet-control-geocoder .leaflet-control-geocoder-icon:hover {
|
||||
border-bottom: none;
|
||||
display: inline-block;
|
||||
.leaflet-control-geocoder a:hover,
|
||||
.leaflet-control-geocoder .leaflet-control-geocoder-icon:hover {
|
||||
border-bottom: none;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.leaflet-control-geocoder-form {
|
||||
display: none;
|
||||
vertical-align: middle;
|
||||
display: none;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.leaflet-control-geocoder-expanded .leaflet-control-geocoder-form {
|
||||
display: inline-block;
|
||||
display: inline-block;
|
||||
}
|
||||
.leaflet-control-geocoder-form input {
|
||||
font-size: 120%;
|
||||
border: 0;
|
||||
background-color: transparent;
|
||||
width: 246px;
|
||||
font-size: 120%;
|
||||
border: 0;
|
||||
background-color: transparent;
|
||||
width: 246px;
|
||||
}
|
||||
|
||||
.leaflet-control-geocoder-icon {
|
||||
border-radius: 4px;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
border: none;
|
||||
background-color: white;
|
||||
background-image: url(images/geocoder.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
border: none;
|
||||
background-color: white;
|
||||
background-image: url(images/geocoder.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.leaflet-touch .leaflet-control-geocoder-icon {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.leaflet-control-geocoder-throbber .leaflet-control-geocoder-icon {
|
||||
background-image: url(images/throbber.gif);
|
||||
background-image: url(images/throbber.gif);
|
||||
}
|
||||
|
||||
.leaflet-control-geocoder-form-no-error {
|
||||
display: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.leaflet-control-geocoder-form input:focus {
|
||||
outline: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.leaflet-control-geocoder-form button {
|
||||
display: none;
|
||||
display: none;
|
||||
}
|
||||
.leaflet-control-geocoder-error {
|
||||
margin-top: 8px;
|
||||
margin-left: 8px;
|
||||
display: block;
|
||||
color: #444;
|
||||
margin-top: 8px;
|
||||
margin-left: 8px;
|
||||
display: block;
|
||||
color: #444;
|
||||
}
|
||||
.leaflet-control-geocoder-alternatives {
|
||||
display: block;
|
||||
width: 272px;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: block;
|
||||
width: 272px;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.leaflet-control-geocoder-alternatives-minimized {
|
||||
display: none;
|
||||
height: 0;
|
||||
display: none;
|
||||
height: 0;
|
||||
}
|
||||
.leaflet-control-geocoder-alternatives li {
|
||||
white-space: nowrap;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
padding: 5px 8px;
|
||||
text-overflow: ellipsis;
|
||||
border-bottom: 1px solid #ccc;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
padding: 5px 8px;
|
||||
text-overflow: ellipsis;
|
||||
border-bottom: 1px solid #ccc;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.leaflet-control-geocoder-alternatives li a, .leaflet-control-geocoder-alternatives li a:hover {
|
||||
width: inherit;
|
||||
height: inherit;
|
||||
line-height: inherit;
|
||||
background: inherit;
|
||||
border-radius: inherit;
|
||||
text-align: left;
|
||||
.leaflet-control-geocoder-alternatives li a,
|
||||
.leaflet-control-geocoder-alternatives li a:hover {
|
||||
width: inherit;
|
||||
height: inherit;
|
||||
line-height: inherit;
|
||||
background: inherit;
|
||||
border-radius: inherit;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.leaflet-control-geocoder-alternatives li:last-child {
|
||||
border-bottom: none;
|
||||
border-bottom: none;
|
||||
}
|
||||
.leaflet-control-geocoder-alternatives li:hover, .leaflet-control-geocoder-selected {
|
||||
background-color: #f5f5f5;
|
||||
.leaflet-control-geocoder-alternatives li:hover,
|
||||
.leaflet-control-geocoder-selected {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.leaflet-control-geocoder-address-detail {
|
||||
|
||||
}
|
||||
.leaflet-control-geocoder-address-context {
|
||||
color: #666;
|
||||
}
|
||||
color: #666;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1
assets/control-geocoder/Control.Geocoder.js.map
Normal file
1
assets/control-geocoder/Control.Geocoder.js.map
Normal file
File diff suppressed because one or more lines are too long
@@ -9,11 +9,11 @@ While I can't force anyone to do anything, if you happen to disagree with this,
|
||||
Leaflet Control Geocoder [](https://www.npmjs.com/package/leaflet-control-geocoder) 
|
||||
=============================
|
||||
|
||||
A simple geocoder for [Leaflet](http://leafletjs.com/) that by default uses [OSM](http://www.openstreetmap.org/)/[Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim).
|
||||
A simple geocoder for [Leaflet](http://leafletjs.com/) that by default uses [OSM](https://www.openstreetmap.org/)/[Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim).
|
||||
|
||||
The plugin supports many different data providers:
|
||||
|
||||
* [OSM](http://www.openstreetmap.org/)/[Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim)
|
||||
* [OSM](https://www.openstreetmap.org/)/[Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim)
|
||||
* [Bing Locations API](http://msdn.microsoft.com/en-us/library/ff701715.aspx)
|
||||
* [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding/)
|
||||
* [Mapbox Geocoding](https://www.mapbox.com/developers/api/geocoding/)
|
||||
@@ -31,12 +31,11 @@ See the [Leaflet Control Geocoder Demo](http://perliedman.github.com/leaflet-con
|
||||
|
||||
# Usage
|
||||
|
||||
[Download latest release](https://github.com/perliedman/leaflet-control-geocoder/releases). Load the CSS and Javascript, located in
|
||||
the `dist` folder:
|
||||
[Download latest release](https://github.com/perliedman/leaflet-control-geocoder/releases), or obtain the latest release via [unpkg.com](https://unpkg.com/):
|
||||
|
||||
```HTML
|
||||
<link rel="stylesheet" href="Control.Geocoder.css" />
|
||||
<script src="Control.Geocoder.js"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.css" />
|
||||
<script src="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.js"></script>
|
||||
```
|
||||
|
||||
Add the control to a map instance:
|
||||
@@ -85,49 +84,55 @@ This is the geocoder control. It works like any other Leaflet control, and is ad
|
||||
|
||||
### Constructor
|
||||
|
||||
This plugin supports the standard JavaScript constructor (to be invoked using `new`) as well as the [class factory methods](http://leafletjs.com/reference.html#class-class-factories) known from Leaflet:
|
||||
|
||||
```js
|
||||
L.Control.Geocoder(options)
|
||||
new L.Control.Geocoder(options)
|
||||
// or
|
||||
L.Control.geocoder(options)
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
| --------------- | ---------------- | ----------------- | ----------- |
|
||||
| collapsed | Boolean | true | Collapse control unless hovered/clicked |
|
||||
| expand | String | "touch" | How to expand a collapsed control: `touch` `click` `hover` |
|
||||
| position | String | "topright" | Control [position](http://leafletjs.com/reference.html#control-positions) |
|
||||
| placeholder | String | "Search..." | Placeholder text for text input
|
||||
| errorMessage | String | "Nothing found." | Message when no result found / geocoding error occurs |
|
||||
| geocoder | IGeocoder | new L.Control.Geocoder.Nominatim() | Object to perform the actual geocoding queries |
|
||||
| showResultIcons | Boolean | false | Show icons for geocoding results (if available); supported by Nominatim |
|
||||
| Option | Type | Default | Description |
|
||||
| ----------------- | ---------------- | ------------------- | ----------- |
|
||||
| `collapsed` | Boolean | `true` | Collapse control unless hovered/clicked |
|
||||
| `expand` | String | `"touch"` | How to expand a collapsed control: `touch` or `click` or `hover` |
|
||||
| `position` | String | `"topright"` | Control [position](http://leafletjs.com/reference.html#control-positions) |
|
||||
| `placeholder` | String | `"Search..."` | Placeholder text for text input
|
||||
| `errorMessage` | String | `"Nothing found."` | Message when no result found / geocoding error occurs |
|
||||
| `geocoder` | IGeocoder | `new L.Control.Geocoder.Nominatim()` | Object to perform the actual geocoding queries |
|
||||
| `showResultIcons` | Boolean | `false` | Show icons for geocoding results (if available); supported by Nominatim |
|
||||
|
||||
### Methods
|
||||
|
||||
| Method | Returns | Description |
|
||||
| ------------------------------------- | ------------------- | ----------------- |
|
||||
| markGeocode(<GeocodingResult> result) | this | Marks a geocoding result on the map |
|
||||
| `markGeocode(<GeocodingResult> result)` | `this` | Marks a geocoding result on the map |
|
||||
|
||||
## L.Control.Geocoder.Nominatim
|
||||
|
||||
Uses [Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim) to respond to geocoding queries. This is the default
|
||||
Uses [Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim) to respond to geocoding queries. This is the default
|
||||
geocoding service used by the control, unless otherwise specified in the options. Implements ```IGeocoder```.
|
||||
|
||||
Unless using your own Nominatim installation, please refer to the [Nominatim usage policy](http://wiki.openstreetmap.org/wiki/Nominatim_usage_policy).
|
||||
Unless using your own Nominatim installation, please refer to the [Nominatim usage policy](https://operations.osmfoundation.org/policies/nominatim/).
|
||||
|
||||
### Constructor
|
||||
|
||||
```js
|
||||
L.Control.Geocoder.Nominatim(options)
|
||||
new L.Control.Geocoder.Nominatim(options)
|
||||
// or
|
||||
L.Control.Geocoder.nominatim(options)
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
| --------------- | ---------------- | ----------------- | ----------- |
|
||||
| serviceUrl | String | "http://nominatim.openstreetmap.org/" | URL of the service |
|
||||
| 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`](http://wiki.openstreetmap.org/wiki/Nominatim#Parameters) parameter to Nominatim |
|
||||
| reverseQueryParams | Object | {} | Additional URL parameters (strings) that will be added to reverse geocoding requests |
|
||||
| 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
|
||||
| `serviceUrl` | String | `"https://nominatim.openstreetmap.org/"` | URL of the service |
|
||||
| `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 |
|
||||
| `reverseQueryParams` | Object | `{}` | Additional URL parameters (strings) that will be added to reverse geocoding requests |
|
||||
| `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
|
||||
|
||||
## L.Control.Geocoder.Bing
|
||||
|
||||
@@ -137,8 +142,10 @@ Note that you need an API key to use this service.
|
||||
|
||||
### Constructor
|
||||
|
||||
```
|
||||
L.Control.Geocoder.Bing(<String> key)
|
||||
```ts
|
||||
new L.Control.Geocoder.Bing(<String> key)
|
||||
// or
|
||||
L.Control.Geocoder.bing(<String> key)
|
||||
```
|
||||
|
||||
## IGeocoder
|
||||
@@ -149,8 +156,8 @@ An interface implemented to respond to geocoding queries.
|
||||
|
||||
| Method | Returns | Description |
|
||||
| ------------------------------------- | ------------------- | ----------------- |
|
||||
| geocode(<String> query, callback, context) | GeocodingResult[] | Performs a geocoding query and returns the results to the callback in the provided context |
|
||||
| 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 |
|
||||
| `geocode(<String> query, callback, context)` | `GeocodingResult[]` | Performs a geocoding query and returns the results to the callback in the provided context |
|
||||
| `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 |
|
||||
|
||||
## GeocodingResult
|
||||
|
||||
@@ -158,10 +165,10 @@ An object that represents a result from a geocoding query.
|
||||
|
||||
### Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| ---------- | ---------------- | ------------------------------------- |
|
||||
| name | String | Name of found location |
|
||||
| bbox | L.LatLngBounds | The bounds of the location |
|
||||
| center | L.LatLng | The center coordinate of the location |
|
||||
| icon | String | URL for icon representing result; optional |
|
||||
| html | String | (optional) HTML formatted representation of the name |
|
||||
| Property | Type | Description |
|
||||
| ------------ | ---------------- | ------------------------------------- |
|
||||
| `name` | String | Name of found location |
|
||||
| `bbox` | L.LatLngBounds | The bounds of the location |
|
||||
| `center` | L.LatLng | The center coordinate of the location |
|
||||
| `icon` | String | URL for icon representing result; optional |
|
||||
| `html` | String | (optional) HTML formatted representation of the name |
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
{
|
||||
"name": "leaflet-control-geocoder",
|
||||
"version": "1.5.8",
|
||||
"version": "1.6.0",
|
||||
"description": "Extendable geocoder with builtin support for Nominatim, Bing, Google, Mapbox, Photon, What3Words, MapQuest, Mapzen, HERE",
|
||||
"main": "dist/Control.Geocoder.js",
|
||||
"scripts": {
|
||||
"prepare": "sh ./scripts/build.sh",
|
||||
"prepare": "npm run build",
|
||||
"build": "npm run build:js && npm run build:css && npm run build:img",
|
||||
"build:js": "rollup --output.format=iife --name=L.Control.Geocoder --globals=leaflet:L src/index.js --output.file=dist/Control.Geocoder.js --sourcemap",
|
||||
"build:css": "cpr Control.Geocoder.css dist/ --overwrite",
|
||||
"build:img": "cpr images/ dist/images/ --overwrite",
|
||||
"test": "npm run lint",
|
||||
"lint": "npm run lint:js && npm run lint:css",
|
||||
"lint:js": "eslint 'src/**'",
|
||||
"lint:css": "prettier --list-different '*.css'",
|
||||
"publish": "sh ./scripts/publish.sh",
|
||||
"postpublish": "sh ./scripts/postpublish.sh"
|
||||
},
|
||||
@@ -31,14 +39,12 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/perliedman/leaflet-control-geocoder/issues"
|
||||
},
|
||||
"browserify-shim": {
|
||||
"leaflet": "global:L"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"browserify": "^11.0.1",
|
||||
"browserify-shim": "^3.8.10",
|
||||
"derequire": "^2.0.3",
|
||||
"es3ify": "^0.1.4"
|
||||
"cpr": "^3.0.1",
|
||||
"eslint": "^4.15.0",
|
||||
"eslint-plugin-prettier": "^2.4.0",
|
||||
"prettier": "^1.9.2",
|
||||
"rollup": "^0.53.2"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user