{"id":13572751,"url":"https://github.com/r-spatial/leafpm","last_synced_at":"2025-04-04T11:30:38.389Z","repository":{"id":56936947,"uuid":"163243208","full_name":"r-spatial/leafpm","owner":"r-spatial","description":"Leaflet.pm for R Leaflet","archived":false,"fork":false,"pushed_at":"2019-04-27T17:27:53.000Z","size":85,"stargazers_count":22,"open_issues_count":4,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T16:16:26.261Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r-spatial.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-27T03:34:12.000Z","updated_at":"2023-10-24T21:06:53.000Z","dependencies_parsed_at":"2022-08-21T01:10:18.019Z","dependency_job_id":null,"html_url":"https://github.com/r-spatial/leafpm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-spatial%2Fleafpm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-spatial%2Fleafpm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-spatial%2Fleafpm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-spatial%2Fleafpm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-spatial","download_url":"https://codeload.github.com/r-spatial/leafpm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247169846,"owners_count":20895361,"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-01T15:00:18.924Z","updated_at":"2025-04-04T11:30:33.381Z","avatar_url":"https://github.com/r-spatial.png","language":"R","funding_links":[],"categories":["Leaflet Functions"],"sub_categories":["Map Edit"],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  eval = FALSE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# leafpm - Interactively Edit Spatial Vector Features in R\n\n[![Travis build status](https://travis-ci.org/r-spatial/leafpm.svg?branch=master)](https://travis-ci.org/r-spatial/leafpm)\n[![monthly](http://cranlogs.r-pkg.org/badges/leafpm)](https://www.rpackages.io/package/leafpm) \n[![total](http://cranlogs.r-pkg.org/badges/grand-total/leafpm)](https://www.rpackages.io/package/leafpm)\n[![CRAN](http://www.r-pkg.org/badges/version/leafpm?color=009999)](https://cran.r-project.org/package=leafpm)\n[![status](https://tinyverse.netlify.com/badge/leafpm)](https://CRAN.R-project.org/package=leafpm)\n\n`leafpm` is a plugin for [`leaflet`](https://github.com/rstudio/leaflet) to provide map editing and drawing in R with [`Leaflet.pm`](https://github.com/codeofsumit/leaflet.pm).  It is based closely off of [`leaflet.extras`](https://github.com/bhaskarvk/leaflet.extras) `addDrawToolbar()`.  `leafpm` is intended to supplement `leaflet.extras` with better support for snapping and holes.\n\n\n## Installation\n\nYou can install the released version of leafpm from [CRAN](https://CRAN.R-project.org) with:\n\n``` r\ninstall.packages(\"leafpm\")\n```\n\n## Example\n\n``` r\nlibrary(mapview)\nlibrary(leafpm)\nlibrary(sf)\n\nouter1 = matrix(c(0,0,10,0,10,10,0,10,0,0),ncol=2, byrow=TRUE)\nhole1 = matrix(c(1,1,1,2,2,2,2,1,1,1),ncol=2, byrow=TRUE)\nhole2 = matrix(c(5,5,5,6,6,6,6,5,5,5),ncol=2, byrow=TRUE)\nouter2 = matrix(c(11,0,11,1,12,1,12,0,11,0),ncol=2, byrow=TRUE)\n\npts1 = list(outer1, hole1, hole2)\npts2 = list(outer2)\n\npl1 = st_sf(geom = st_sfc(st_polygon(pts1)))\npl2 = st_sf(geom = st_sfc(st_polygon(pts2)))\n\nmpl = st_sf(geom = st_combine(rbind(pl1, pl2)))\n\naddPmToolbar(\n  mapview(mpl)@map,\n  targetGroup = \"mpl\"\n)\n```\n\n\n## mapedit Integration\n\n`leafpm` was designed to work as an editor in [`mapedit`](https://github.com/r-spatial/mapedit), so you can get your edits back into the `R` session.  For instance,\n\n``` r\n#install.packages(\"mapedit\")\nlibrary(mapedit)\n\ndrawFeatures(editor = \"leafpm\")\n```\n\n\n### Code of Conduct\n\nPlease note that the 'leafpm' project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.\n\n\n### Acknowledgment\n\nThis project has been realized with financial [support](https://www.r-consortium.org/projects) from the\n\n\u003ca href=\"https://www.r-consortium.org/projects/awarded-projects\"\u003e\n\u003cimg src=\"http://pebesma.staff.ifgi.de/RConsortium_Horizontal_Pantone.png\" width=\"400\"\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-spatial%2Fleafpm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-spatial%2Fleafpm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-spatial%2Fleafpm/lists"}