Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/whitequark/leaflet.nanoscale
Sub-millimeter scale indicator for Leaflet.js
https://github.com/whitequark/leaflet.nanoscale
Last synced: about 1 month ago
JSON representation
Sub-millimeter scale indicator for Leaflet.js
- Host: GitHub
- URL: https://github.com/whitequark/leaflet.nanoscale
- Owner: whitequark
- License: mit
- Created: 2015-06-17T22:10:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-10-29T21:08:44.000Z (about 2 years ago)
- Last Synced: 2024-05-08T17:15:28.630Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 784 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Leaflet.Nanoscale
=================Leaflet.Nanoscale is a sub-millimeter scale indicator for [Leaflet](http://leaflet.com). It displays a scale in nanometers, micrometers or millimeters, calculating it from a known ratio of absolute pixels (i.e. pixels at maximum zoom) to nanometers.
Screenshot
----------![Screenshot](screenshot.png)
Usage
-----Include the script:
``` html
```
Add the control to the map:
``` javascript
L.control.nanoscale({
nanometersPerPixel: scale,
}).addTo(map);
```Options
-------| Option | Type | Default | Description |
| -------------------- | --------- | -------------- | ----------- |
| `nanometersPerPixel` | `Number` | `1000` | The ratio between pixels at known zoom and nanometers. |
| `ratioAtZoom` | `Number` | `map.getMaxZoom()` | The zoom level used for translating pixels to distances. |
| `position` | `String` | `'topright'` | The position of the control (one of the map corners). See [control positions](http://leafletjs.com/reference.html#control-positions). |
| `maxWidth` | `Number` | `100` | Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500). |
| `updateWhenIdle` | `Boolean` | `false` | If true, the control is updated on moveend, otherwise it's always up-to-date (updated on move). |License
-------[MIT license](LICENSE.txt)