# react-leaflet-geosearch

> Adds support for address lookup (a.k.a. geocoding / geoseaching) to React-Leaflet.

Latest version **0.3.4** (published 2021-07-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-leaflet-geosearch
pnpm add react-leaflet-geosearch
yarn add react-leaflet-geosearch
bun add react-leaflet-geosearch
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.4 |
| Published | 2021-07-09 |
| First published | 2019-11-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 1.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | T.A. Geoforce |
| Maintainers | tageoforce |
| Keywords | geolocation, geocoding, plugins, leaflet, geo, map, react |

## Links

- npm: https://www.npmjs.com/package/react-leaflet-geosearch
- Repository: https://github.com/TA-Geoforce/react-leaflet-geosearch
- Homepage: https://github.com/TA-Geoforce/react-leaflet-geosearch#readme
- Issues: https://github.com/TA-Geoforce/react-leaflet-geosearch/issues
- npm.io page: https://npm.io/package/react-leaflet-geosearch

## Dependencies (2)

- [react-leaflet](https://npm.io/package/react-leaflet.md) ^3.0.5
- [leaflet-geosearch](https://npm.io/package/leaflet-geosearch.md) ^2.7.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.3.4 (latest) — 2021-07-09
- 0.3.3 — 2021-07-08
- 0.3.2 — 2021-07-08
- 0.3.1 — 2021-06-14
- 0.3.0 — 2019-12-27
- 0.2.1 — 2019-12-04
- 0.2.0 — 2019-12-02
- 0.1.1 — 2019-11-29
- 0.1.0 — 2019-11-29

## README

# react-leaflet-geosearch [![npm version](https://img.shields.io/npm/v/react-leaflet-geosearch.svg)](https://www.npmjs.com/package/react-leaflet-geosearch)![npm downloads](https://img.shields.io/npm/dw/react-leaflet-geosearch)[![Node.js CI](https://github.com/TA-Geoforce/react-leaflet-geosearch/actions/workflows/node.js.yml/badge.svg?branch=master)](https://github.com/TA-Geoforce/react-leaflet-geosearch/actions/workflows/node.js.yml)[![Release](https://github.com/TA-Geoforce/react-leaflet-geosearch/actions/workflows/npm-publish.yml/badge.svg?branch=master)](https://github.com/TA-Geoforce/react-leaflet-geosearch/actions/workflows/npm-publish.yml)

Most recently tested with Leaflet React-Leaflet 2.5.0.

React Leaflet geosearching/geocoding control build on top of [React-Leaflet](https://github.com/PaulLeCam/react-leaflet). 

The SearchControl is using the plugin from [leaflet-geosearch](https://github.com/smeijer/leaflet-geosearch) 

## Complete example with react-leaflet-geosearch

To get started, to be able to run the example you have execute:
```bash
npm install
```

```jsx
import React from "react";
import { Map, TileLayer } from "react-leaflet";
import { SearchControl, OpenStreetMapProvider } from "../dist/index";

//here you can add some styles
import './example/react-leaflet-geosearch.css';

export default class GeoSearchExample extends React.Component {
  constructor() {
    super();
  }

  render() {
    const prov = OpenStreetMapProvider();
    const GeoSearchControlElement = SearchControl;

    return (
      <Map
        center={[42.09618442380296, -71.5045166015625]}
        zoom={2}
        zoomControl={true}
      >
        <TileLayer
          attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
          url="http://{s}.tile.osm.org/{z}/{x}/{y}.png"
        />
        <GeoSearchControlElement
          provider={prov}
          showMarker={true}
          showPopup={false}
          maxMarkers={3}
          retainZoomLevel={false}
          animateZoom={true}
          autoClose={false}
          searchLabel={"Enter address, please"}
          keepResult={true}
          popupFormat={({ query, result }) => result.label}
        />
      </Map>
    );
  }
}
```

You can find the following example in the folder ```example```. Run the above code by executing the following scripts in package.json, with the order they are stated underneath:

1) ```build```

1) ```example```

---
_Source: https://npm.io/package/react-leaflet-geosearch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
