{"id":13554163,"url":"https://github.com/osmlab/leaflet-nectarivore","last_synced_at":"2025-07-05T19:14:42.884Z","repository":{"id":86682798,"uuid":"113755954","full_name":"osmlab/leaflet-nectarivore","owner":"osmlab","description":"Leaflet plugin to create layers based on remote services (Overpass, Osmose, etc.)","archived":false,"fork":false,"pushed_at":"2018-10-06T12:42:35.000Z","size":803,"stargazers_count":10,"open_issues_count":1,"forks_count":2,"subscribers_count":6,"default_branch":"develop","last_synced_at":"2025-04-12T23:43:53.300Z","etag":null,"topics":["leaflet","openstreetmap","osm","osmose","overpass"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/osmlab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-12-10T14:19:46.000Z","updated_at":"2024-06-03T13:46:38.000Z","dependencies_parsed_at":"2023-03-06T11:00:30.879Z","dependency_job_id":null,"html_url":"https://github.com/osmlab/leaflet-nectarivore","commit_stats":{"total_commits":47,"total_committers":3,"mean_commits":"15.666666666666666","dds":0.04255319148936165,"last_synced_commit":"7335c6ea404c9f1a432e4239bdf8586f0179fc75"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osmlab%2Fleaflet-nectarivore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osmlab%2Fleaflet-nectarivore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osmlab%2Fleaflet-nectarivore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osmlab%2Fleaflet-nectarivore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osmlab","download_url":"https://codeload.github.com/osmlab/leaflet-nectarivore/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647256,"owners_count":21139081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["leaflet","openstreetmap","osm","osmose","overpass"],"created_at":"2024-08-01T12:02:40.929Z","updated_at":"2025-04-12T23:43:59.929Z","avatar_url":"https://github.com/osmlab.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","others"],"sub_categories":[],"readme":"[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![GitHub release](https://img.shields.io/github/release/osmlab/leaflet-nectarivore.svg)](https://github.com/osmlab/leaflet-nectarivore/releases)\n[![Build Status](https://api.travis-ci.org/osmlab/leaflet-nectarivore.svg?branch=develop)](http://travis-ci.org/osmlab/leaflet-nectarivore)\n[![Coverage Status](https://coveralls.io/repos/github/osmlab/leaflet-nectarivore/badge.svg?branch=develop)](https://coveralls.io/github/osmlab/leaflet-nectarivore?branch=develop)\n\n# Leaflet Nectarivore\n\nLeaflet Nectarivore is a plugin to create layers based on remote services (Overpass, Osmose, etc.). Its name is a nod to [Leaflet Omnivore](https://github.com/mapbox/leaflet-omnivore), which _eats_ several kind of files to display informations on a Leaflet map. Leaflet Nectarivore _gathers nectar_ from remote services to create its layers on the map.\n\nThe first two supported services are Overpass and Osmose. See the demo pages here:\n\n* [Overpass demo page](https://osmlab.github.io/leaflet-nectarivore/overpass.html)\n* [Osmose demo page](https://osmlab.github.io/leaflet-nectarivore/osmose.html)\n\n\n## Installation\n\n```\n$ npm install leaflet-nectarivore\n```\n\n\n## Usage\n\n### Overpass\n\n```javascript\nimport Nectarivore from 'leaflet-nectarivore';\n\nconst attributions = [\n  'Map data \u0026copy; \u003ca href=\"https://openstreetmap.org\"\u003eOpenStreetMap\u003c/a\u003e contributors',\n  'POI via \u003ca href=\"https://www.overpass-api.de\"\u003eOverpass API\u003c/a\u003e',\n];\n\nconst tileLayer = new L.TileLayer(\n  'http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png',\n  { attribution: attributions.join(', ') }\n);\n\nconst overpassLayer = Nectarivore.overpass({\n  minZoom: 15,\n  endPoint: 'https://overpass-api.de/api',\n  query: 'node({{bbox}})[\"amenity\"=\"post_box\"];out;',\n});\n\nconst map = new L.Map('my-map')\n  .addLayer(tileLayer)\n  .addLayer(overpassLayer)\n  .setView(L.latLng(44.84061, -0.5724), 15);\n```\n\nIn order to get a valid query the [Overpass-turbo IDE](http://overpass-turbo.eu/) might help.\n\n\n### Osmose\n\n```javascript\nimport Nectarivore from 'leaflet-nectarivore';\n\nconst attributions = [\n  'Map data \u0026copy; \u003ca href=\"https://openstreetmap.org\"\u003eOpenStreetMap\u003c/a\u003e contributors',\n  'POI via \u003ca href=\"http://wiki.openstreetmap.org/wiki/Osmose\"\u003eOsmose API\u003c/a\u003e',\n];\n\nconst tileLayer = new L.TileLayer(\n  'http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png',\n  { attribution: attributions.join(', ') }\n);\n\nconst osmoseLayer = L.Nectarivore.osmose({\n  minZoom: 15,\n  endpoint: 'https://osmose.openstreetmap.fr/api/0.2',\n  language: 'en',\n  item: 8120,\n  status: 'open',\n});\n\nconst map = new L.Map('my-map')\n  .addLayer(tileLayer)\n  .addLayer(osmoseLayer)\n  .setView(L.latLng(44.84061, -0.5724), 15);\n```\n\n\n## Options\n\n```javascript\n{\n  debug: false,\n  minZoom: 15,\n  endpoint: '',\n  loadedBounds: [],\n  markerIcon: null,\n  timeout: 30 * 1000, // Milliseconds\n  retryOnTimeout: false,\n  noInitialRequest: false,\n  beforeRequest: function() {},\n  afterRequest: function() {},\n  onSuccess: function(data) {},\n  onError: function(xhr) {},\n  onTimeout: function(xhr) {},\n}\n```\n\n### Overpass supplemental options\n\n```javascript\n{\n  endpoint: 'https://overpass-api.de/api',\n  query: `(\n    node({{bbox}})[organic];\n    node({{bbox}})[second_hand];\n  );\n  out qt;`\n}\n```\n\n\n### Osmose supplemental options\n\n```javascript\n{\n  endpoint: 'https://osmose.openstreetmap.fr/api/0.2',\n  language: 'en'\n}\n```\n\n\n## Contribute\n\n```\n$ git clone git@github.com:osmlab/leaflet-nectarivore.git leaflet-nectarivore\n$ cd leaflet-nectarivore\n$ npm install\n$ npm run watch\n```\n\n\n## Make a release\n\n```sh\n$ npm version patch -m \"release: %s\"\n$ npm publish\n```\n\n`npm version` tests the code and build it. Then it upgrades the package version number according to the used keyword (patch, minor or major) and commit the modifications in Git (with a proper version tag). Finally, it pushes it to repository with the tag.\n\n\n### How to add a service\n\n\u003e Please do!\n\nAll the plugin logic is in the `services/baseService.js` file. It is then extended by the service logic by creating specific fies in the `services` folder.\n\nSo in order to add another service you have to:\n\n1. Create your service file in the `services` folder by duplicating `overpass.js` or `osmose.js`.\n2. Replace the service defaultOptions by yours.\n3. Replace the logic, you just have to let 4 methods:\n  * constructor: Called at the plugin instanciation.\n  * clear: Called when the query/endpoint is replaced by the user.\n  * buildRequestBounds: Called when the map is moved. It lets you modify the requested bounds.\n  * buildRequestPromise: Called to build the actual request to the service. It has to return a Promise.\n4. Reference your new service file in the `service/index.js` file.\n5. Add some tests for your service logic ;) In the `services/__tests__` folder.\n6. Add a demo page in the `docs` folder.\n7. Document your service in the `README.md` file\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosmlab%2Fleaflet-nectarivore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosmlab%2Fleaflet-nectarivore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosmlab%2Fleaflet-nectarivore/lists"}