{"id":18564329,"url":"https://github.com/heyman/leaflet-areaselect","last_synced_at":"2025-04-10T01:07:09.718Z","repository":{"id":13880369,"uuid":"16578440","full_name":"heyman/leaflet-areaselect","owner":"heyman","description":"Leaflet plugin for letting users select an area of the map using a rectangle, and get the bounding box","archived":false,"fork":false,"pushed_at":"2023-11-21T19:39:28.000Z","size":44,"stargazers_count":112,"open_issues_count":3,"forks_count":40,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T01:07:04.287Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heyman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-02-06T12:17:56.000Z","updated_at":"2024-11-24T15:28:21.000Z","dependencies_parsed_at":"2024-06-21T05:36:41.180Z","dependency_job_id":null,"html_url":"https://github.com/heyman/leaflet-areaselect","commit_stats":{"total_commits":51,"total_committers":9,"mean_commits":5.666666666666667,"dds":"0.43137254901960786","last_synced_commit":"ab1e21e6d08502f624d99fa72433bebfe505b6f2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyman%2Fleaflet-areaselect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyman%2Fleaflet-areaselect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyman%2Fleaflet-areaselect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyman%2Fleaflet-areaselect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heyman","download_url":"https://codeload.github.com/heyman/leaflet-areaselect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137886,"owners_count":21053775,"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-11-06T22:14:51.752Z","updated_at":"2025-04-10T01:07:09.701Z","avatar_url":"https://github.com/heyman.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Leaflet AreaSelect [![npm version](https://badge.fury.io/js/@jonatanheyman%2Fleaflet-areaselect.svg)](https://badge.fury.io/js/@jonatanheyman%2Fleaflet-areaselect)\n\nAreaSelect is a leaflet plugin for letting users select a square area (bounding box), \nusing a resizable centered box on top of the map. \n\n![longitude.me](https://s3-eu-west-1.amazonaws.com/heyman.info/screenshots/leaflet-areaselect.jpg)\n\nAnother similar plugin is [leaflet-locationfilter](https://github.com/kajic/leaflet-locationfilter), \nwhich solves the same problem but provides a rectangle that is movable and not fixed to the center, \nbut doesn't support keeping the aspect ratio.\n\n## Example Code\n```javascript\n    // Add it to the map\n    var areaSelect = L.areaSelect({width:200, height:300, minWidth:40, minHeight:40, minHorizontalSpacing:40, minVerticalSpacing:100, keepAspectRatio:false});\n    areaSelect.addTo(map);\n    \n    // Read the bounding box\n    var bounds = areaSelect.getBounds();\n    \n    // Get a callback when the bounds change\n    areaSelect.on(\"change\", function() {\n        console.log(\"Bounds:\", this.getBounds());\n    });\n    \n    // Set the dimensions of the box\n    areaSelect.setDimensions({width: 500, height: 500})\n\n    // And to remove it do:\n    //areaSelect.remove();\n```\n\n#### To make it keep the aspect ratio:\n\n```javascript\n    var areaSelect = L.areaSelect({width:200, height:300, keepAspectRatio:true});\n```\n\n#### To set the selected area (not compatible with `keepAspectRatio:true`):\n\n```javascript\n    areaSelect.setBounds([{lat:59.2272559, lng:17.7606917}, {lat:59.4402838, lng:18.2000673}]);\n```\n\n## See it in action\n\nCheck out the [bundled example](http://heyman.github.io/leaflet-areaselect/example/).\n\n## Author\n\nAreaSelect is developed by [Jonatan Heyman](http://heyman.info).\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheyman%2Fleaflet-areaselect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheyman%2Fleaflet-areaselect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheyman%2Fleaflet-areaselect/lists"}