Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@geoblocks/ga-search

Package Overview
Dependencies
Maintainers
5
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@geoblocks/ga-search

A web component element to access the [GeoAdmin search API](https://api3.geo.admin.ch/services/sdiservices.html#search).

  • 0.0.22
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
78
increased by457.14%
Maintainers
5
Weekly downloads
 
Created
Source

A web component element to access the GeoAdmin search API.

Installation

npm install @geoblocks/ga-search

Example Usage

<ga-search limit="42">
  <input placeholder="Search...">
  <ul></ul>
</ga-search>

The component has to have an input and ul as children element. The query text is taken from the input and the results are displayed in the ul.

API

Properties/Attributes

NameTypeDefaultDescription
minlengthnumber1The minimum number of characters of the input to start a search.
limitnumber15The number of result per type.
debounceTimenumber200Time in milliseconds that the component should wait after last keystroke before calling search function.
langstringLanguage code (de, fr, it , rm, or en). Default is the value of the lang attribute of the HTML document.
typesstring'location'A comma separated list of types of search to use. Can be a combination of 'location', 'layer', 'feature' and 'additionalSource'. The order of this list is used as the display order.
srstring'4326'The spatial reference code for output geometries. Can be 21781, 2056, 3857 or 4326
locationOriginsstring'zipcode,gg25'A comma separated list of location origins. Possible origins are: zipcode, gg25, district, kantone, gazetteer, address and parcel.
featureLayersstringA comma separated list of technical layer names to be used by the feature search.
filterResultsfunctionOptional filter function applied to the result array. The function accepts three arguments: element, index and array and must return a boolean.
renderResultfunctionOptional function to change the result line. The function accepts two arguments: result and label and must return a string.
additionalSourceobject
historyEnabledbooleantrueEnable search history or not. If enabled, show history as result list when the input length is less than minlength
storageobjectStorageDefine which storage to be use to store search history. Should implement methods addEntry(entry) to add a new entry to the history and getHistory() to return the history. The default Storage support a default limit of 10 entry. This can be changed by setting storage.setLimit(limit).

Events

NameDetailDescription
submit{result: Feature}Fired when a search result is selected.

Running the demo

npm i
npm run start

FAQs

Package last updated on 13 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc