Update Control.Geocoder to 1.6.0.

This commit is contained in:
David Molineus
2018-08-23 15:42:45 +02:00
parent 2f372e2d0e
commit 9a21c60b9e
7 changed files with 1406 additions and 1337 deletions

View File

@@ -18,7 +18,7 @@ This package contains following packages:
- [Leaflet-omnivore 0.3.4](https://github.com/mapbox/leaflet-omnivore) - [Leaflet-omnivore 0.3.4](https://github.com/mapbox/leaflet-omnivore)
- [Leaflet.loading 0.1.24](https://github.com/ebrelsford/Leaflet.loading) - [Leaflet.loading 0.1.24](https://github.com/ebrelsford/Leaflet.loading)
- [Leaflet.Control.FullScreen 1.4.5](https://github.com/brunob/leaflet.fullscreen) - [Leaflet.Control.FullScreen 1.4.5](https://github.com/brunob/leaflet.fullscreen)
- [Leaflet Control Geocoder 1.5.8](https://github.com/perliedman/leaflet-control-geocoder) - [Leaflet Control Geocoder 1.6.0](https://github.com/perliedman/leaflet-control-geocoder)
- [Leaflet.ExtraMarkers 1.0.6](https://github.com/coryasilva/Leaflet.ExtraMarkers) - [Leaflet.ExtraMarkers 1.0.6](https://github.com/coryasilva/Leaflet.ExtraMarkers)
- [leaflet.pm 0.23.1](https://github.com/codeofsumit/leaflet.pm) - [leaflet.pm 0.23.1](https://github.com/codeofsumit/leaflet.pm)
- [osmtogeojson 2.2.12](https://github.com/tyrasd/osmtogeojson) - [osmtogeojson 2.2.12](https://github.com/tyrasd/osmtogeojson)

View File

@@ -1,123 +1,126 @@
.leaflet-control-geocoder { .leaflet-control-geocoder {
border-radius: 4px; border-radius: 4px;
background: white; background: white;
min-width: 26px; min-width: 26px;
min-height: 26px; min-height: 26px;
} }
.leaflet-touch .leaflet-control-geocoder { .leaflet-touch .leaflet-control-geocoder {
min-width: 30px; min-width: 30px;
min-height: 30px; min-height: 30px;
} }
.leaflet-control-geocoder a, .leaflet-control-geocoder .leaflet-control-geocoder-icon { .leaflet-control-geocoder a,
border-bottom: none; .leaflet-control-geocoder .leaflet-control-geocoder-icon {
display: inline-block; border-bottom: none;
display: inline-block;
} }
.leaflet-control-geocoder .leaflet-control-geocoder-alternatives a { .leaflet-control-geocoder .leaflet-control-geocoder-alternatives a {
width: inherit; width: inherit;
height: inherit; height: inherit;
line-height: inherit; line-height: inherit;
} }
.leaflet-control-geocoder a:hover, .leaflet-control-geocoder .leaflet-control-geocoder-icon:hover { .leaflet-control-geocoder a:hover,
border-bottom: none; .leaflet-control-geocoder .leaflet-control-geocoder-icon:hover {
display: inline-block; border-bottom: none;
display: inline-block;
} }
.leaflet-control-geocoder-form { .leaflet-control-geocoder-form {
display: none; display: none;
vertical-align: middle; vertical-align: middle;
} }
.leaflet-control-geocoder-expanded .leaflet-control-geocoder-form { .leaflet-control-geocoder-expanded .leaflet-control-geocoder-form {
display: inline-block; display: inline-block;
} }
.leaflet-control-geocoder-form input { .leaflet-control-geocoder-form input {
font-size: 120%; font-size: 120%;
border: 0; border: 0;
background-color: transparent; background-color: transparent;
width: 246px; width: 246px;
} }
.leaflet-control-geocoder-icon { .leaflet-control-geocoder-icon {
border-radius: 4px; border-radius: 4px;
width: 26px; width: 26px;
height: 26px; height: 26px;
border: none; border: none;
background-color: white; background-color: white;
background-image: url(images/geocoder.png); background-image: url(images/geocoder.png);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
cursor: pointer; cursor: pointer;
} }
.leaflet-touch .leaflet-control-geocoder-icon { .leaflet-touch .leaflet-control-geocoder-icon {
width: 30px; width: 30px;
height: 30px; height: 30px;
} }
.leaflet-control-geocoder-throbber .leaflet-control-geocoder-icon { .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 { .leaflet-control-geocoder-form-no-error {
display: none; display: none;
} }
.leaflet-control-geocoder-form input:focus { .leaflet-control-geocoder-form input:focus {
outline: none; outline: none;
} }
.leaflet-control-geocoder-form button { .leaflet-control-geocoder-form button {
display: none; display: none;
} }
.leaflet-control-geocoder-error { .leaflet-control-geocoder-error {
margin-top: 8px; margin-top: 8px;
margin-left: 8px; margin-left: 8px;
display: block; display: block;
color: #444; color: #444;
} }
.leaflet-control-geocoder-alternatives { .leaflet-control-geocoder-alternatives {
display: block; display: block;
width: 272px; width: 272px;
list-style: none; list-style: none;
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
.leaflet-control-geocoder-alternatives-minimized { .leaflet-control-geocoder-alternatives-minimized {
display: none; display: none;
height: 0; height: 0;
} }
.leaflet-control-geocoder-alternatives li { .leaflet-control-geocoder-alternatives li {
white-space: nowrap; white-space: nowrap;
display: block; display: block;
overflow: hidden; overflow: hidden;
padding: 5px 8px; padding: 5px 8px;
text-overflow: ellipsis; text-overflow: ellipsis;
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
cursor: pointer; cursor: pointer;
} }
.leaflet-control-geocoder-alternatives li a, .leaflet-control-geocoder-alternatives li a:hover { .leaflet-control-geocoder-alternatives li a,
width: inherit; .leaflet-control-geocoder-alternatives li a:hover {
height: inherit; width: inherit;
line-height: inherit; height: inherit;
background: inherit; line-height: inherit;
border-radius: inherit; background: inherit;
text-align: left; border-radius: inherit;
text-align: left;
} }
.leaflet-control-geocoder-alternatives li:last-child { .leaflet-control-geocoder-alternatives li:last-child {
border-bottom: none; border-bottom: none;
} }
.leaflet-control-geocoder-alternatives li:hover, .leaflet-control-geocoder-selected { .leaflet-control-geocoder-alternatives li:hover,
background-color: #f5f5f5; .leaflet-control-geocoder-selected {
background-color: #f5f5f5;
} }
.leaflet-control-geocoder-address-detail { .leaflet-control-geocoder-address-detail {
} }
.leaflet-control-geocoder-address-context { .leaflet-control-geocoder-address-context {
color: #666; color: #666;
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -9,11 +9,11 @@ While I can't force anyone to do anything, if you happen to disagree with this,
Leaflet Control Geocoder [![NPM version](https://img.shields.io/npm/v/leaflet-control-geocoder.svg)](https://www.npmjs.com/package/leaflet-control-geocoder) ![Leaflet 1.0.0 compatible!](https://img.shields.io/badge/Leaflet%201.0.0-%E2%9C%93-1EB300.svg?style=flat) Leaflet Control Geocoder [![NPM version](https://img.shields.io/npm/v/leaflet-control-geocoder.svg)](https://www.npmjs.com/package/leaflet-control-geocoder) ![Leaflet 1.0.0 compatible!](https://img.shields.io/badge/Leaflet%201.0.0-%E2%9C%93-1EB300.svg?style=flat)
============================= =============================
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: 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) * [Bing Locations API](http://msdn.microsoft.com/en-us/library/ff701715.aspx)
* [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding/) * [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding/)
* [Mapbox Geocoding](https://www.mapbox.com/developers/api/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 # Usage
[Download latest release](https://github.com/perliedman/leaflet-control-geocoder/releases). Load the CSS and Javascript, located in [Download latest release](https://github.com/perliedman/leaflet-control-geocoder/releases), or obtain the latest release via [unpkg.com](https://unpkg.com/):
the `dist` folder:
```HTML ```HTML
<link rel="stylesheet" href="Control.Geocoder.css" /> <link rel="stylesheet" href="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.css" />
<script src="Control.Geocoder.js"></script> <script src="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.js"></script>
``` ```
Add the control to a map instance: 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 ### 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 ```js
L.Control.Geocoder(options) new L.Control.Geocoder(options)
// or
L.Control.geocoder(options)
``` ```
### Options ### Options
| Option | Type | Default | Description | | Option | Type | Default | Description |
| --------------- | ---------------- | ----------------- | ----------- | | ----------------- | ---------------- | ------------------- | ----------- |
| collapsed | Boolean | true | Collapse control unless hovered/clicked | | `collapsed` | Boolean | `true` | Collapse control unless hovered/clicked |
| expand | String | "touch" | How to expand a collapsed control: `touch` `click` `hover` | | `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) | | `position` | String | `"topright"` | Control [position](http://leafletjs.com/reference.html#control-positions) |
| placeholder | String | "Search..." | Placeholder text for text input | `placeholder` | String | `"Search..."` | Placeholder text for text input
| errorMessage | String | "Nothing found." | Message when no result found / geocoding error occurs | | `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 | | `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 | | `showResultIcons` | Boolean | `false` | Show icons for geocoding results (if available); supported by Nominatim |
### Methods ### Methods
| Method | Returns | Description | | 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 ## 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```. 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 ### Constructor
```js ```js
L.Control.Geocoder.Nominatim(options) new L.Control.Geocoder.Nominatim(options)
// or
L.Control.Geocoder.nominatim(options)
``` ```
## Options ## Options
| Option | Type | Default | Description | | Option | Type | Default | Description |
| --------------- | ---------------- | ----------------- | ----------- | | --------------- | ---------------- | ----------------- | ----------- |
| serviceUrl | String | "http://nominatim.openstreetmap.org/" | URL of the service | | `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`](http://wiki.openstreetmap.org/wiki/Nominatim#Parameters) parameter to Nominatim | | `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 | | `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 | `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 ## L.Control.Geocoder.Bing
@@ -137,8 +142,10 @@ Note that you need an API key to use this service.
### Constructor ### Constructor
``` ```ts
L.Control.Geocoder.Bing(<String> key) new L.Control.Geocoder.Bing(<String> key)
// or
L.Control.Geocoder.bing(<String> key)
``` ```
## IGeocoder ## IGeocoder
@@ -149,8 +156,8 @@ An interface implemented to respond to geocoding queries.
| Method | Returns | Description | | Method | Returns | Description |
| ------------------------------------- | ------------------- | ----------------- | | ------------------------------------- | ------------------- | ----------------- |
| geocode(<String> query, callback, context) | GeocodingResult[] | Performs a 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 | | `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 ## GeocodingResult
@@ -158,10 +165,10 @@ An object that represents a result from a geocoding query.
### Properties ### Properties
| Property | Type | Description | | Property | Type | Description |
| ---------- | ---------------- | ------------------------------------- | | ------------ | ---------------- | ------------------------------------- |
| name | String | Name of found location | | `name` | String | Name of found location |
| bbox | L.LatLngBounds | The bounds of the location | | `bbox` | L.LatLngBounds | The bounds of the location |
| center | L.LatLng | The center coordinate of the location | | `center` | L.LatLng | The center coordinate of the location |
| icon | String | URL for icon representing result; optional | | `icon` | String | URL for icon representing result; optional |
| html | String | (optional) HTML formatted representation of the name | | `html` | String | (optional) HTML formatted representation of the name |

View File

@@ -1,10 +1,18 @@
{ {
"name": "leaflet-control-geocoder", "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", "description": "Extendable geocoder with builtin support for Nominatim, Bing, Google, Mapbox, Photon, What3Words, MapQuest, Mapzen, HERE",
"main": "dist/Control.Geocoder.js", "main": "dist/Control.Geocoder.js",
"scripts": { "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", "publish": "sh ./scripts/publish.sh",
"postpublish": "sh ./scripts/postpublish.sh" "postpublish": "sh ./scripts/postpublish.sh"
}, },
@@ -31,14 +39,12 @@
"bugs": { "bugs": {
"url": "https://github.com/perliedman/leaflet-control-geocoder/issues" "url": "https://github.com/perliedman/leaflet-control-geocoder/issues"
}, },
"browserify-shim": {
"leaflet": "global:L"
},
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"browserify": "^11.0.1", "cpr": "^3.0.1",
"browserify-shim": "^3.8.10", "eslint": "^4.15.0",
"derequire": "^2.0.3", "eslint-plugin-prettier": "^2.4.0",
"es3ify": "^0.1.4" "prettier": "^1.9.2",
"rollup": "^0.53.2"
} }
} }

View File

@@ -75,7 +75,7 @@ $GLOBALS['LEAFLET_LIBRARIES']['leaflet-fullscreen'] = array
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-control-geocoder'] = array $GLOBALS['LEAFLET_LIBRARIES']['leaflet-control-geocoder'] = array
( (
'name' => 'Leaflet Control Geocoder', 'name' => 'Leaflet Control Geocoder',
'version' => '1.5.8', 'version' => '1.6.0',
'license' => '<a href="https://github.com/perliedman/leaflet-control-geocoder/blob/master/LICENSE" target="_blank">BSD-2-Clause</a>', 'license' => '<a href="https://github.com/perliedman/leaflet-control-geocoder/blob/master/LICENSE" target="_blank">BSD-2-Clause</a>',
'homepage' => 'https://github.com/perliedman/leaflet-control-geocoder', 'homepage' => 'https://github.com/perliedman/leaflet-control-geocoder',
'css' => 'assets/leaflet/libs/control-geocoder/Control.Geocoder.min.css', 'css' => 'assets/leaflet/libs/control-geocoder/Control.Geocoder.min.css',