Skip to content

Commit

Permalink
add Geoapify Provider
Browse files Browse the repository at this point in the history
  • Loading branch information
CarolineVantim committed Mar 31, 2023
1 parent d18b72f commit 751e4ec
Show file tree
Hide file tree
Showing 12 changed files with 21,258 additions and 26,398 deletions.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ GOOGLE_API_KEY=___YOUR_KEY___
LOCATIONIQ_API_KEY=___YOUR_KEY___
OPENCAGE_API_KEY=___YOUR_KEY___
HERE_API_KEY=___YOUR_KEY___
GEOAPIFY_API_KEY=___YOUR_KEY___
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Leaflet.GeoSearch

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-53-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

**Demo and Docs: [smeijer.github.io/leaflet-geosearch](https://smeijer.github.io/leaflet-geosearch)**
Expand Down Expand Up @@ -58,6 +60,7 @@ The control comes with a number of default providers:
- [Pelias]
- [Mapbox](https://docs.mapbox.com/help/tutorials/local-search-geocoding-api/)
- [GeoApiFR](https://geo.api.gouv.fr/adresse)
- [Geoapify](https://apidocs.geoapify.com/docs/geocoding/forward-geocoding/#about)

Although this project is still named `leaflet-geosearch`, this library is also
usable without LeafletJS, and does not have any dependencies whatsoever.
Expand Down Expand Up @@ -424,10 +427,11 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center"><a href="https://paulschreiber.com/"><img src="https://avatars.githubusercontent.com/u/86784?v=4?s=100" width="100px;" alt="Paul Schreiber"/><br /><sub><b>Paul Schreiber</b></sub></a><br /><a href="https://github.com/smeijer/leaflet-geosearch/commits?author=paulschreiber" title="Code">💻</a></td>
<td align="center"><a href="https://nsilvestri.me/"><img src="https://avatars.githubusercontent.com/u/33607815?v=4?s=100" width="100px;" alt="Nick Silvestri"/><br /><sub><b>Nick Silvestri</b></sub></a><br /><a href="#ideas-nsilvestri" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/smeijer/leaflet-geosearch/commits?author=nsilvestri" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/teriblus"><img src="https://avatars.githubusercontent.com/u/17048774?v=4?s=100" width="100px;" alt="teriblus"/><br /><sub><b>teriblus</b></sub></a><br /><a href="https://github.com/smeijer/leaflet-geosearch/commits?author=teriblus" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/CarolineVantim"><img src="https://avatars.githubusercontent.com/u/82098788?s=400&u=b20b0acc98f9bdb694e20c56d6c157b3198b7c62&v=4" width="100px;" alt="Caroline Vantim"/><br /><sub><b>Caroline Vantim</b></sub></a><br /><a href="https://github.com/smeijer/leaflet-geosearch/commits?author=CarolineVantim" title="Code">💻</a></td>
</tr>
</tbody>
<tfoot>

</tfoot>
</table>

Expand Down
5 changes: 5 additions & 0 deletions docs/lib/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
OpenStreetMapProvider,
PeliasProvider,
GeoApiFrProvider,
GeoapifyProvider,
} from 'leaflet-geosearch';

export default {
Expand Down Expand Up @@ -44,6 +45,10 @@ export default {
params: { key: process.env.GATSBY_OPENCAGE_API_KEY },
}),

Geoapify: new GeoapifyProvider({
params: { apiKey: process.env.GATSBY_GEOAPIFY_API_KEY },
}),

OpenStreetMap: new OpenStreetMapProvider(),

Pelias: new PeliasProvider(),
Expand Down
40 changes: 40 additions & 0 deletions docs/providers/geoapify.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Geoapify
menu: Providers
route: /providers/geoapify
---

import Playground from '../components/Playground';
import Map from '../components/Map';

# Geoapify Provider

**note**: Geoapify services require an API key. [Obtain geoapify][1].
For more options and configurations, see the [Geoapify developer docs][2].

<Playground>
<Map provider="Geoapify" />
</Playground>

```js
import { GeoapifyProvider } from 'leaflet-geosearch';

const provider = new GeoapifyProvider({
params: {
apiKey: '__YOUR_HERE_KEY__',
},
});

// add to leaflet
import { GeoSearchControl } from 'leaflet-geosearch';

map.addControl(
new GeoSearchControl({
provider,
style: 'bar',
}),
);
```

[1]: https://apidocs.geoapify.com/
[2]: https://apidocs.geoapify.com/docs/geocoding/forward-geocoding/#geocode-addresses
1 change: 1 addition & 0 deletions doczrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default {
'OpenStreetMap',
'Pelias',
'Custom Providers',
'Geoapify',
],
},
],
Expand Down
Loading

0 comments on commit 751e4ec

Please sign in to comment.