3.0.1 • Published 8 years ago
@norkart/leaflet-norkartsearch v3.0.1
L.Control.NorkartSearch
L.Control.NorkartSearch is a Leaflet plugin for using the address search from Norkart. Requires an API-key.
Usage
L.control.norkartSearch({
apiKey: 'MY_API_KEY'
}).addTo(map);Options
| option | Type | Default | Description | |
|---|---|---|---|---|
| apiKey | string | none | an api key from Norkart | |
| position | leaflet control position | 'topright' | position of the leaflet control | |
| placeholder | string | Søk | placeholder text for search box | |
| showMarker | boolean | true | Wether or not to show a marker in the map when a hit is selected | |
| limits | array | undefined | array of municipality id's (kommunenummer) to limit search to | |
| targets | array | 'matrikkelenhet', 'gateadresse' | target names that determines what type of search the engine supports. Supported targets are: 'matrikkelenhet', 'gateadresse', 'stedsnavn' (and more, see fritektsook api). | |
| <!-- | onFocus | boolean | false | Wether or not the searchbox should be automatically selected (focused) when the page is loaded --> |
Events
the plugin triggers a ```search:select``` event on the map when a hit is selected.
map.on('search:select', function(event) {
var position = event.position; // a L.latLng
var element = event.element; // The raw data from the search API
});As a standalone component
Make sure to have the following components available on your page
- Leaflet
- Bootstrap (css only)
- Reqwest
- React & ReactDOM
And include the L.Control.NorkartSearch.js and L.Control.NorkartSearch.css from /build/.
See demo/index.html for an example.
As an npm-module
Install:
npm install @norkart/leaflet-norkartsearch --saveIn code:
require('leaflet-norkartsearch');Demo
See https://norkart.github.io/L.Control.NorkartSearch/demo/ for a simple example
Contribute
Install dependencies:
npm install
Run code:
Run the demo code by running:
npm start and go to localhost:8080
3.0.1
8 years ago
3.0.0
8 years ago
2.0.1
8 years ago
2.0.0
8 years ago
1.2.1
8 years ago
1.2.0
8 years ago
1.1.4
8 years ago
1.1.3
8 years ago
1.1.2
9 years ago
1.1.0
9 years ago
1.0.8
9 years ago
1.0.7
10 years ago
1.0.6
10 years ago
1.0.5
10 years ago
1.0.4
10 years ago
1.0.3
10 years ago
1.0.2
10 years ago
1.0.1
10 years ago
1.0.0
10 years ago