{"id":23638493,"url":"https://github.com/gabriel-russo/leaflet.arearuler","last_synced_at":"2025-11-09T12:30:16.963Z","repository":{"id":187076144,"uuid":"675654362","full_name":"gabriel-russo/Leaflet.AreaRuler","owner":"gabriel-russo","description":"A simple tool to measure area on map","archived":false,"fork":false,"pushed_at":"2023-08-08T19:45:19.000Z","size":1311,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-12-16T16:13:09.980Z","etag":null,"topics":["area","leaflet","leaflet-measure","leaflet-plugins","plugin","ruler"],"latest_commit_sha":null,"homepage":"https://gabriel-russo.github.io/Leaflet.AreaRuler/example","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/gabriel-russo.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":"2023-08-07T12:20:18.000Z","updated_at":"2023-11-28T11:55:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"7a5037bd-c4a5-4461-ad74-8005a98b6de9","html_url":"https://github.com/gabriel-russo/Leaflet.AreaRuler","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"8bb6ca2dc75ba3845dbadef5c451dc5511601d54"},"previous_names":["gabriel-russo/leaflet.arearuler"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabriel-russo%2FLeaflet.AreaRuler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabriel-russo%2FLeaflet.AreaRuler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabriel-russo%2FLeaflet.AreaRuler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabriel-russo%2FLeaflet.AreaRuler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabriel-russo","download_url":"https://codeload.github.com/gabriel-russo/Leaflet.AreaRuler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239573935,"owners_count":19661622,"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":["area","leaflet","leaflet-measure","leaflet-plugins","plugin","ruler"],"created_at":"2024-12-28T07:44:52.965Z","updated_at":"2025-11-09T12:30:16.913Z","avatar_url":"https://github.com/gabriel-russo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Leaflet.AreaRuler\n\nA simple tool to measure area on map.\n\nRequires [Leaflet](https://github.com/Leaflet/Leaflet/releases) 1.0.0+ branches\n\nRequires [Leaflet.Draw](https://github.com/leaflet/Leaflet.Draw#readme)\n\n## Install\n\n```shell\nnpm install leaflet-arearuler\n```\n\n## Demo\n\nCheck out the [demo](https://gabriel-russo.github.io/Leaflet.AreaRuler/example/)\n\n![Example](docs/images/example_screenshot.png)\n\n## Usage\n\nAs map option:\n\n```js\nconst map = L.map('map', { areaRulerControl: true });\n```\n\nOr like any control:\n\n```js\nconst options = {}; // See docs to see options\nL.Control.arearuler(options)\n  .addTo(map);\n```\n\n## Docs\n\n### Options:\n\n```js\n// Default plugin options object, change wathever you want\noptions = {\n  position: 'topleft',\n  unity: 'ha', // m, ha, alq, km\n  shapeOptions: {\n    color: \"#d07f03\",\n    stroke: true,\n    weight: 4,\n    opacity: 0.7,\n    fill: true,\n  },\n  icon: new L.DivIcon({\n    iconSize: new L.Point(9, 9),\n    className: 'leaflet-div-icon leaflet-editing-icon',\n  }),\n  text: {\n    title: 'Measure area',\n  },\n};\n```\n\n### Methods\n\n| Method Name | Description                                       |\n|-------------|---------------------------------------------------|\n| enabled     | Gets a true/false of whether the ruler is enabled |\n| setOptions  | Update options after instantiate                  |\n| toggle      | Toggles the ruler on or off                       |\n\n### Events:\n\n* `arearuler:measurestart` - Event fired when the measure handler are added to map\n* `arearuler:newarea` - Event fired when a new segment/vertex is added\n  ```js\n  // Event data example: unity = ha\n  {\n    converted: {\n      area: 11.48,\n      unity: \"ha\"\n    },\n    original: {\n      area: 114848.85315528093,\n      unity: \"m\"\n    },\n    type: \"arearuler:newarea\",\n  // target ...,\n  // sourceTarget...,\n  }\n  ```\n* `arearuler:newmeasure` - Event fired when the user starts a new measure\n* `arearuler:measurestop` - Event fired when the measure handler are removed from map\n\n### Custom html button\n\nIf you are developing a web application and you want to use your own html button outside the map container, you can use\nthe following code:\n\n```javascript\nconst options = {\n  button: document.getElementById('my-button'), // Your html button HTML reference\n}\n\nconst control = L.Control.arearuler(options)\n  .addTo(map);\n```\n\nAfter that, you have to make your own segments output box using the events described above.\n\nYou can see the example [here](https://gabriel-russo.github.io/Leaflet.AreaRuler/example/with-button.html)\n\n## Development\n\n```shell\nnpm install --save-dev     # install dependencies\nnpm run dev  # Compile and save at dist/ after any change\n```\n\nOpen `index.html` in your browser and start editing.\n\n## Authors\n\n* Gabriel Russo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabriel-russo%2Fleaflet.arearuler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabriel-russo%2Fleaflet.arearuler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabriel-russo%2Fleaflet.arearuler/lists"}