{"id":16438827,"url":"https://github.com/ghettovoice/ol-mapscale","last_synced_at":"2025-12-12T04:37:57.753Z","repository":{"id":1877395,"uuid":"45108134","full_name":"ghettovoice/ol-mapscale","owner":"ghettovoice","description":"OpenLayers map scale control with scale string","archived":false,"fork":false,"pushed_at":"2023-04-16T20:11:35.000Z","size":616,"stargazers_count":13,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-09T06:09:00.289Z","etag":null,"topics":["hacktoberfest","ol","ol-mapscale","ol-plugins","ol3","ol4","openlayers","openlayers3","openlayers4"],"latest_commit_sha":null,"homepage":"","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/ghettovoice.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}},"created_at":"2015-10-28T11:33:30.000Z","updated_at":"2023-04-15T05:43:09.000Z","dependencies_parsed_at":"2023-07-09T01:01:27.767Z","dependency_job_id":null,"html_url":"https://github.com/ghettovoice/ol-mapscale","commit_stats":{"total_commits":43,"total_committers":3,"mean_commits":"14.333333333333334","dds":"0.18604651162790697","last_synced_commit":"6c3b2ed2d7c494290a2658b58bb9773b95cc86d6"},"previous_names":["ghettovoice/ol3-mapscale"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghettovoice%2Fol-mapscale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghettovoice%2Fol-mapscale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghettovoice%2Fol-mapscale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghettovoice%2Fol-mapscale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghettovoice","download_url":"https://codeload.github.com/ghettovoice/ol-mapscale/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245078067,"owners_count":20557274,"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":["hacktoberfest","ol","ol-mapscale","ol-plugins","ol3","ol4","openlayers","openlayers3","openlayers4"],"created_at":"2024-10-11T09:06:35.424Z","updated_at":"2025-12-12T04:37:57.663Z","avatar_url":"https://github.com/ghettovoice.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/ghettovoice/ol-mapscale.svg?branch=master)](https://travis-ci.com/ghettovoice/ol-mapscale)\n[![Coverage Status](https://coveralls.io/repos/github/ghettovoice/ol-mapscale/badge.svg?branch=master)](https://coveralls.io/github/ghettovoice/ol-mapscale?branch=master)\n[![view on npm](http://img.shields.io/npm/v/ol-mapscale.svg)](https://www.npmjs.org/package/ol-mapscale)\n[![GitHub tag](https://img.shields.io/github/tag/ghettovoice/ol-mapscale.svg)](https://github.com/ghettovoice/ol-mapscale/releases)\n[![License](https://img.shields.io/github/license/ghettovoice/ol-mapscale.svg)](https://github.com/ghettovoice/ol-mapscale/blob/master/LICENSE)\n\n# Map scale control with scale string for OpenLayers\n\nAdds custom control to [OpenLayers](https://openlayers.org/) map. Shows scale line and scale string.\n\n## Installation\n\nInstall it thought NPM or Bower:\n\n```shell\n# ES6 version for bundling with Webpack, Rollup or etc.\nnpm install ol ol-mapscale\n# to use UMD version 'openlayers' package should be installed\nnpm install openlayers\n```\n\nOr add from CDN:\n\n```html\n\u003cscript src=\"https://unpkg.com/openlayers@latest/dist/ol.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://unpkg.com/ol-mapscale@latest/dist/bundle.min.js\"\u003e\u003c/script\u003e\n```\n\n### Note\n**Plugin is available in 2 versions: as UMD module and as ES2015 module:**\n- **RECOMMENDED: ES2015 version (`dist/bundle.es.js`) should be used with [ol](https://www.npmjs.com/package/ol) package (you should\n  install it manually).**\n- **UMD version (`dist/bundle[.min].js`) should be used with [openlayers](https://www.npmjs.com/package/openlayers) package.\n  You can install `ol` package as dev dependency to suppress NPM warning about required peer dependencies.**\n\n## Usage\n\nPlugin may be used as UMD module or ES2015 module:\n\n```js\n// Use as ES2015 module (based on NPM package `ol`)\nimport Map from 'ol/map'\n...\nimport MapScaleControl from 'ol-mapscale'\n\n// Use as UMD module (based on NPM package `openlayers`)\nconst ol = require('openlayers')\n...\nconst MapScaleControl = require('ol-mapscale')\n```\n\nIn Browser environment you should add **script** tag pointing to UMD module after OpenLayers js files.\n```html\n\u003cscript src=\"https://unpkg.com/openlayers@latest/dist/ol.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://unpkg.com/ol-mapscale@latest/dist/bundle.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  // plugin exports global variable MapScaleControl\n  // in addition it also exported to `ol.control.MapScale` field (for backward compatibility).\n\u003c/script\u003e\n```\n\n### Options\n\n| Option              | Type                                      | Description                                                                            |\n|:--------------------|:------------------------------------------|:---------------------------------------------------------------------------------------|\n| target              | _Element \u0026#124; string \u0026#124; undefined_  | Specify a target if you want the control to be rendered outside of the map's viewport. |\n| className           | _string \u0026#124; string[] \u0026#124; undefined_ | Custom class name of the control container element. Default is `ol-mapscale`.          |\n| scaleLineClassName  | _string \u0026#124; string[] \u0026#124; undefined_ | Custom class name of the scale line container element. Default is `ol-scale-line`.     |\n| scaleValueClassName | _string \u0026#124; string[] \u0026#124; undefined_ | Custom class name of the scale value container element. Default is `ol-scale-value`.   |\n| scaleLine           | _boolean \u0026#124; undefined_                | Show/hide scale line control. Default is `true`.                                       |\n| units               | _string[] \u0026#124; undefined_               | Array of scale value units. Default is `['k', 'M', 'G']`.                              |\n| digits              | _number \u0026#124; undefined_                 | The number of digits to appear after the decimal point. Default is `0`.                |\n\n### Example usage:\n```js\nimport Map from 'ol/map'\nimport View from 'ol/view'\nimport TileLayer from 'ol/layer/tile'\nimport OSMSource from 'ol/source/osm'\nimport 'ol/ol.css'\nimport MapScaleControl from 'ol-mapscale'\n\nconst map = new Map({\n  target: 'map',\n  view: new View({\n    center: [4189972.14, 7507950.67],\n    zoom: 5,\n  }),\n  layers: [\n    new TileLayer({\n      source: new OSMSource(),\n    }),\n  ],\n})\n\nmap.addControl(new MapScaleControl())\n```\n\n## License\n\nMIT (c) 2016-2020, Vladimir Vershinin\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghettovoice%2Fol-mapscale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghettovoice%2Fol-mapscale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghettovoice%2Fol-mapscale/lists"}