New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

leaflet-control-geocoder

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaflet-control-geocoder

Extendable geocoder with builtin OSM/Nominatim support

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.7K
decreased by-80.35%
Maintainers
1
Weekly downloads
 
Created
Source

Leaflet Control Geocoder

A simple geocoder for Leaflet that by default uses OSM/Nominatim to locate places, but also supports Bing Locations API and can easily be extended to support other providers.

See the Leaflet Control Geocoder Demo.

Usage

var map = L.map('map').setView([0, 0], 2);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
L.Control.geocoder().addTo(map);

API

L.Control.Geocoder

This is the geocoder control. It works like any other Leaflet control, and is added to the map.

Constructor

L.Control.Geocoder(options)

Options

OptionTypeDefaultDescription
collapsedBooleantrueCollapse control unless hovered/clicked
positionString"topright"Control position
placeholderString"Search..."Placeholder text for text input
errorMessageString"Nothing found."Message when no result found / geocoding error occurs
geocoderIGeocodernew L.Control.Geocoder.Nominatim()Object to perform the actual geocoding queries

Methods

MethodReturnsDescription
markGeocode( result)thisMarks a geocoding result on the map

L.Control.Geocoder.Nominatim

Uses 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.

Constructor

L.Control.Geocoder.Nominatim(options)

Options

OptionTypeDefaultDescription
serviceUrlString"http://nominatim.openstreetmap.org/search/"URL of the service

L.Control.Geocoder.Bing

Uses Bing Locations API to respond to geocoding queries. Implements IGeocoder.

Note that you need an API key to use this service.

Constructor

L.Control.Geocoder.Bing(<String> key)

IGeocoder

An interface implemented to respond to geocoding queries.

Methods

MethodReturnsDescription
geocode( query, callback, context)GeocodingResult[]Performs a geocoding query and returns the results to the callback in the provided context

GeocodingResult

An object that represents a result from a geocoding query.

Properties

PropertyTypeDescription
nameStringName of found location
boundsL.LatLngBoundsThe bounds of the location
centerL.LatLngThe center coordinate of the location

Keywords

FAQs

Package last updated on 08 Oct 2013

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