{"id":13857721,"url":"https://github.com/EhrmannS/geometr","last_synced_at":"2025-07-13T22:31:03.643Z","repository":{"id":48679790,"uuid":"170218893","full_name":"EhrmannS/geometr","owner":"EhrmannS","description":"Generate and modify interoperable geometric shapes","archived":false,"fork":false,"pushed_at":"2024-01-29T09:54:06.000Z","size":65105,"stargazers_count":14,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-22T15:41:18.647Z","etag":null,"topics":["geometric-shapes","getters","interoperability","setters","spatial-data"],"latest_commit_sha":null,"homepage":"https://ehrmanns.github.io/geometr/","language":"R","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/EhrmannS.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","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":"2019-02-11T23:25:40.000Z","updated_at":"2024-09-25T15:32:25.000Z","dependencies_parsed_at":"2024-11-22T15:34:00.700Z","dependency_job_id":"8d7df939-643b-4e75-be3e-1170cc20e2ed","html_url":"https://github.com/EhrmannS/geometr","commit_stats":{"total_commits":1092,"total_committers":4,"mean_commits":273.0,"dds":"0.38186813186813184","last_synced_commit":"3db05481f7deb2345bd2f5c9be6cecd48a286b8f"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/EhrmannS/geometr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EhrmannS%2Fgeometr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EhrmannS%2Fgeometr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EhrmannS%2Fgeometr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EhrmannS%2Fgeometr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EhrmannS","download_url":"https://codeload.github.com/EhrmannS/geometr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EhrmannS%2Fgeometr/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265218200,"owners_count":23729496,"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":["geometric-shapes","getters","interoperability","setters","spatial-data"],"created_at":"2024-08-05T03:01:45.135Z","updated_at":"2025-07-13T22:31:03.159Z","avatar_url":"https://github.com/EhrmannS.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n\n# calling any function from geometr for the first time creates an annoying\n# message about spatstat, which I can remove by calling it here without\n# including this chunk in the Rmd\nlibrary(sf)\nlibrary(geometr)\nnc_sf \u003c- st_read(system.file(\"shape/nc.shp\", package=\"sf\"), quiet = TRUE)\ngeomio::getFeatures(nc_sf)\n```\n# geometr \u003ca href='https://ehrmanns.github.io/geometr/'\u003e\u003cimg src='man/figures/logo.svg' align=\"right\" height=\"200\" /\u003e\u003c/a\u003e\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/EhrmannS/geometr/workflows/R-CMD-check/badge.svg)](https://github.com/EhrmannS/geometr/actions)\n[![Coverage\nStatus](https://codecov.io/gh/EhrmannS/geometr/branch/master/graph/badge.svg)](https://codecov.io/github/EhrmannS/geometr?branch=master)\n[![CRAN\\_Status\\_Badge](http://www.r-pkg.org/badges/version/geometr)](https://cran.r-project.org/package=geometr)\n[![](http://cranlogs.r-pkg.org/badges/grand-total/geometr)](https://cran.r-project.org/package=geometr)\n\n\u003c!-- badges: end --\u003e\n\n\n## Overview\n\nThe `geometr` package provides tools that generate and process easily accessible and tidy geometric shapes (of class `geom`). Moreover, it aims to improve interoperability of spatial and other geometric classes. Spatial\nclasses are typically a collection of geometric shapes (or their vertices) that are accompanied by various metadata (such as attributes and a coordinate reference system). Most spatial classes are thus conceptually quite similar, yet a common standard lacks for accessing features, vertices or the metadata. `geometr` fills this gap by\nproviding tools that\n\n  - produce an identical output for the same metadata of different classes (via so-called getters) and\n  - use an identical input to write to various classes that originally require different input (via so-called setters).\n\n## Installation\n\n1) Install the official version from CRAN:\n\n```{r, eval=FALSE}\ninstall.packages(\"geometr\")\n```\n\nor the latest development version from github:\n\n```{r, eval=FALSE}\ndevtools::install_github(\"EhrmannS/geometr\")\n```\n\n2) The [vignette](https://ehrmanns.github.io/geometr/articles/geometr.html) gives an in depth introduction, explains the take on interoperability and discusses the spatial class `geom` that comes with `geometr`.\n\n3) Have fun being a [geometer](https://en.wikipedia.org/wiki/List_of_geometers)\\!\n\n## Examples\n\nCreate a `geom`\n\n```{r}\nlibrary(geometr)\n\n# ... from other classes\nlibrary(sf)\nnc_sf \u003c- st_read(system.file(\"shape/nc.shp\", package=\"sf\"), quiet = TRUE)\nnc_geom \u003c- geomio::as_geometr(x = nc_sf)\n```\n\nMetadata of different classes can be extracted in interoperable quality (i.e. the same metadata in different objects/classes have the same names and the same arrangement).\n\n```{r}\ngeomio::getExtent(x = nc_geom)\n\ngeomio::getFeatures(x = nc_geom)\n```\n\n`geometr` only knows the feature types `point`, `line`, `polygon` and `grid` (a systematic lattice of points). \nIn contrast to the simple features standard, there are no  *MULTI\\** features. \nThe way simple features have been implemented in R has the consequence that certain information can only be stored in a rather inefficient and cumbersome way. \nThink of a set of polygons that has individual attributes at the `POLYGON` level, but also attributes at the group (`MULTIPOLYGON`) level, i.e., where all polygons of that group have the same value of the respective attributes.\nIt is impossible to store this information in a single `sf` object, other than in a `POLYGON` that contains the respective attributes as duplicates (which may be very inefficient in large objects).\n\nThe backbone of a `geom` are three tables, one for points, one for features and one for groups of features, the latter two of which can be provided with ancillary information (attributes).\nEach point is stored with a feature ID (`fid`) that relates it to a feature (and its attributes) and each feature is stored with a group ID (`gid`) that relates it to a group (and its attributes).\nEventually this results in a tidier data-structure with easier access than `sp` or `sf` objects and with higher versatility.\n\n```{r}\n# when using the group = TRUE argument, the attributes of MULTI*-feature are\n# stored in the group attribute table of a geom\nnc_geom \u003c- geomio::as_geometr(x = nc_sf, group = TRUE)\ncurrituck \u003c- geo_filter(obj = nc_geom, gid == 4)\n\ngeomio::getFeatures(x = currituck)\ngeomio::getGroups(x = currituck)\n\n# and new attributes can be set easily, \nnewTable \u003c- data.frame(fid = c(1:108), \n                       attrib = rnorm(108))\n(nc_geom \u003c- geomio::setFeatures(x = nc_geom, table = newTable))\n```\n\nMoreover, a `geom` also allows to store raster information in the same data format.\nA raster is a systematic lattice of points/pixels with one or more layers, where each pixel exists in each layer, possibly with different values, i.e., from different attributes.\nThe raster attribute table (RAT) is basically already the groups attribute table of a `geom`, where a group of pixels that have the same value are associated to attributes this class has in common.\nIn this case, however, the features (single pixels) don't have to be associated to a group ID, as their feature values are at the same time the group values.\n\n```{r}\nstr(geoms$polygon, max.level = 2)\n\nstr(geoms$grid, max.level = 2)\n```\n\n\n`geometr` comes with the `visualise` function, which makes nice-looking diagnostic spatial plots, that show explicit values whenever possible.\nFor example, it does not create artificial (\\\"nice\\\") bins for the x and y axis or the values values shown in the plot, but provides the range of values explicitly.\nMoreover, you can easily set plot titles without much effort.\n\n```{r, fig.height=3}\ngeo_vis(`North Carolina` = nc_geom)\n```\n\nYou can use quick options to scale plot parameters to the attributes of the `geom` to modify which aspects of an object should be shown in the plot, for example when scaling `fillcol` to `NWBIR74`.\n\n```{r, fig.height=3}\nmyAttr \u003c- \"NWBIR74\"\ngeo_vis(!!paste0(\"NC - \", myAttr) := nc_geom, fillcol = !!myAttr)\n```\n\nThe `@window` slot of a modified `geom` is by default automatically updated.\n\n```{r, fig.height=3.5}\ngeo_vis(`Currituck` = currituck, linecol = \"fid\")\n```\n\nFinally, cast a `geom` to another type simply by providing it in `anchor` of the respective type\n\n```{r, fig.height=3.5}\nboundPoints \u003c- geo_point(crds = geomio::getPoints(currituck))\ngeo_vis(`Currituck - boundary vertices`= boundPoints, linecol = \"fid\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEhrmannS%2Fgeometr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEhrmannS%2Fgeometr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEhrmannS%2Fgeometr/lists"}