{"id":18722514,"url":"https://github.com/mdsumner/basf","last_synced_at":"2025-11-11T05:30:16.209Z","repository":{"id":40445438,"uuid":"135805793","full_name":"mdsumner/basf","owner":"mdsumner","description":"Load sf but with sp-like plot","archived":false,"fork":false,"pushed_at":"2022-09-02T01:27:35.000Z","size":879,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-28T14:51:44.923Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://mdsumner.github.io/basf/.","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/mdsumner.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-02T09:44:59.000Z","updated_at":"2024-06-08T09:55:20.000Z","dependencies_parsed_at":"2022-08-09T20:40:21.427Z","dependency_job_id":null,"html_url":"https://github.com/mdsumner/basf","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Fbasf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Fbasf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Fbasf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Fbasf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdsumner","download_url":"https://codeload.github.com/mdsumner/basf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239587244,"owners_count":19663892,"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-07T13:41:48.079Z","updated_at":"2025-11-11T05:30:16.180Z","avatar_url":"https://github.com/mdsumner.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\neditor_options: \n  chunk_output_type: console\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  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\nlibrary(basf)\n```\n\n\n# basf\n\nThe goal of basf is to smooth over some of the peculiarities of the sf package, with a very short list of features. \n\n- plot simple features in a base graphics way that sp did. \n- read vector data with a straightforward extent filter\n\n## Installation\n\nFrom CRAN in the usual way. \n\n```{r cran, eval=FALSE}\ninstall.packages(\"basf\")\n```\n\nFrom Github: \n\n```{r install, eval=FALSE}\n#install.packages(\"remotes\")\nremotes::install_github(\"mdsumner/basf\")\n```\n\nUse `library(basf)` instead of `library(sf)` if you want these features. \n\n## Plotting \n\n\nThere will be a warning when basf starts up because this is what it does. \n\n```R\nRegistered S3 method overwritten by 'basf':\n  method  from\n  plot.sf sf  \n```\n\nThis example shows the impact of basf on plotting.\n\n```{r example}\nlibrary(basf)\n\n## all the stuff is available\nx \u003c- read_sf(system.file(\"shape/nc.shp\", package=\"sf\"))\n\n## all we've changed is the plot command\nplot(x)\nplot(x[sample(1:nrow(x), 10), ], col = rainbow(10), add = TRUE)\n## overplotting works\naxis(1); axis(2)\nabline(v = -80, h = -34)\n```\n\nWithout basf, we would have to do extra format-aware workarounds when setting up\nthe plot. I find this incredibly disruptive, perhaps because I've used R and sp\nfor so long - I use plotting every day to verify my work. It makes no sense to\nme to make things format-specific so I'm kind of mystified as to why it's gone\nthis way.\n\n```R\nlibrary(sf)\nx \u003c- read_sf(system.file(\"shape/nc.shp\", package=\"sf\"))\n\nplot(x[1], reset = FALSE, col = NA, main = \"\")\nplot(x[sample(1:nrow(x), 10), ], col = rainbow(10), add = TRUE)\naxis(1); axis(2)\nabline(v = -80, h = -34)\n```\n\n## Reading\n\nThis example shows the impact of basf on reading.  We would otherwise obtain 32 polygons from this file. \n\nThe second optional argument `ext` can be an extent, either a raw vector xmin,xmax,ymin,ymax as here or a spatial object. \n\n```R\nlibrary(basf)\nread_ext(\"../measoshapes/inst/extdata/measo_regions_ll.gpkg\", c(100, 120, -80, -10))\nSimple feature collection with 8 features and 3 fields\ngeometry type:  POLYGON\ndimension:      XY\nbbox:           xmin: 30 ymin: -80 xmax: 170 ymax: -30\ngeographic CRS: WGS 84\n```\n\n---\n\nPlease note that this project is released with a [Contributor Code of Conduct](https://github.com/mdsumner/basf/blob/master/CODE_OF_CONDUCT.md).\n  By participating in this project you agree to abide by its terms.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsumner%2Fbasf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdsumner%2Fbasf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsumner%2Fbasf/lists"}