{"id":13907403,"url":"https://github.com/perliedman/leaflet-underneath","last_synced_at":"2025-06-17T17:33:57.024Z","repository":{"id":145270344,"uuid":"51155409","full_name":"perliedman/leaflet-underneath","owner":"perliedman","description":"Find interesting features is in your map using Mapbox Vector Tiles data","archived":false,"fork":false,"pushed_at":"2019-10-21T12:27:22.000Z","size":76,"stargazers_count":32,"open_issues_count":1,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-13T22:54:25.126Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/perliedman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2016-02-05T15:39:39.000Z","updated_at":"2024-12-20T09:27:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"c0a7e5d8-693a-4f8f-9254-770ecbfaa850","html_url":"https://github.com/perliedman/leaflet-underneath","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/perliedman/leaflet-underneath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perliedman%2Fleaflet-underneath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perliedman%2Fleaflet-underneath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perliedman%2Fleaflet-underneath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perliedman%2Fleaflet-underneath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perliedman","download_url":"https://codeload.github.com/perliedman/leaflet-underneath/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perliedman%2Fleaflet-underneath/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260408825,"owners_count":23004587,"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":[],"created_at":"2024-08-06T23:01:55.496Z","updated_at":"2025-06-17T17:33:52.015Z","avatar_url":"https://github.com/perliedman.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Leaflet Underneath\n\n[![NPM version](https://img.shields.io/npm/v/leaflet-underneath.svg)](https://www.npmjs.com/package/leaflet-underneath) ![Leaflet 1.0 compatible!](https://img.shields.io/badge/Leaflet%201.0-%E2%9C%93-1EB300.svg?style=flat)\n\n[Check out the demo](http://www.liedman.net/leaflet-underneath/)\n\nWith a normal tile layer, the user can't interact to find out more about a location, since it is a static image. With this plugin, you can find out what features are underneath the current mouse position, for example when the user clicks the map.\n\nThis is done using [Mapbox Vector Tiles](https://www.mapbox.com/developers/vector-tiles/), that are queried for features in a way that is both fast and reasonably bandwidth efficient.\n\n### Leaflet 1.0 compatibility\n\nVersion 3.0 and up of Leaflet Underneath is only compatible with Leaflet 1.0; earlier versions only work with Leaflet 0.7.\n\n## Using\n\n[Download](https://github.com/perliedman/leaflet-underneath/releases) the code. Include the pre-built Leaflet Underneath script in your project:\n\n```html\n    \u003cscript src=\"leaflet-underneath/dist/leaflet-underneath.js\"\u003e\u003c/script\u003e\n```\n\nor, even better, use Browserify or similar and install from npm:\n\n```\nnpm install --save leaflet-underneath\n```\n\n```javascript\nvar L = require('leaflet');\nrequire('leaflet-underneath');\n\n// Leaflet Underneath will be available as L.underneath\n```\n\nFor a complete example on how to use Leaflet Underneath, see basic [Leaflet Underneath example](https://github.com/perliedman/leaflet-underneath/blob/master/example/index.js).\n\n## API\n\n### L.Underneath\n\nLeaflet Underneath can be queried for features from a location.\n\n#### Creation\n\nFactory              | Description\n---------------------|-----------------------------\n`L.underneath(\u003cString\u003e tileUrl, \u003cMap\u003e map, \u003c`[`UnderneathOptions`](#underneathoptions)`\u003e options?) | Instantiates a new Leaflet Underneath layer\n\n#### Options\n\nOption                 | Type          | Default              | Description\n-----------------------|---------------|----------------------|----------------------------\n`minZoom`              | `Number`      | `0`                  | Minimum zoom level in the tile set\n`maxZoom`              | `Number`      | `22`                 | Maximum zoom level in the tile set\n`subdomains`           | `Array`       | `['a', 'b', 'c']`    | Available subdomains\n`layers`               | `String[]`    | `[]`                 | Names of layers to include in search\n`defaultRadius`        | `Number`      | `20`                 | Default number of pixels search radius\n`featureId`            | `Function`    |                      | Function that returns a unique feature id; used to filter out duplicates. Default returns a features `osm_id`property\n`zoomIn`               | `Number`      | `0`                  | Zoom in relative to the map's current zoom level when making a query; used to get more or less detailed results than current zoom would give\n`joinFeatures`         | `Boolean`     | `false`              | For features with same id, should geometries be joined (`true`), or should they be ignored (`false`)\n\n#### Methods\n\nMethod                          | Returns                   | Description\n--------------------------------|---------------------------|--------------------------\n`query(\u003c`[`L.LatLng`](http://leafletjs.com/reference.html#latlng)`\u003e latLng, \u003cFunction\u003e callback, \u003cObject\u003e context, \u003c`[`QueryOptions`](#queryoptions)\u003e options?)` | `this` | Asynchronously queries for features near `latLng`; `callback` will be called with features within `radius` pixels of the coordinate\n\n#### QueryOptions\n\nOption                 | Type          | Default              | Description\n-----------------------|---------------|----------------------|----------------------------\n`radius`               | `Number`      | Take from layer options | Number of pixels search radius\n`onlyInside`           | `Boolean`     | `false`              | Only return features (polygons) that the queried location is inside\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperliedman%2Fleaflet-underneath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperliedman%2Fleaflet-underneath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperliedman%2Fleaflet-underneath/lists"}