{"id":13423741,"url":"https://github.com/sckott/geoops","last_synced_at":"2025-04-23T20:25:07.805Z","repository":{"id":140973484,"uuid":"56098820","full_name":"sckott/geoops","owner":"sckott","description":"UNSUPPORTED - geoops does spatial operations on GeoJSON","archived":false,"fork":false,"pushed_at":"2024-11-06T19:04:08.000Z","size":9417,"stargazers_count":25,"open_issues_count":3,"forks_count":4,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-18T04:55:55.239Z","etag":null,"topics":["geojson","geospatial","polygon","r","r-package","rstats"],"latest_commit_sha":null,"homepage":"http://sckott.github.io/geoops/","language":"C++","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/sckott.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":"codemeta.json","zenodo":null}},"created_at":"2016-04-12T21:25:23.000Z","updated_at":"2025-01-11T19:53:29.000Z","dependencies_parsed_at":"2025-04-12T05:15:29.754Z","dependency_job_id":null,"html_url":"https://github.com/sckott/geoops","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckott%2Fgeoops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckott%2Fgeoops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckott%2Fgeoops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckott%2Fgeoops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sckott","download_url":"https://codeload.github.com/sckott/geoops/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250507456,"owners_count":21441997,"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":["geojson","geospatial","polygon","r","r-package","rstats"],"created_at":"2024-07-31T00:00:41.573Z","updated_at":"2025-04-23T20:25:07.796Z","avatar_url":"https://github.com/sckott.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"geoops\n======\n\n```{r echo=FALSE}\nlibrary(\"knitr\")\nhook_output \u003c- knitr::knit_hooks$get(\"output\")\nknitr::knit_hooks$set(output = function(x, options) {\n  lines \u003c- options$output.lines\n  if (is.null(lines)) {\n    return(hook_output(x, options)) # pass to default hook\n  }\n  x \u003c- unlist(strsplit(x, \"\\n\"))\n  more \u003c- \"...\"\n  if (length(lines) == 1) { # first n lines\n    if (length(x) \u003e lines) {\n      # truncate the output, but add ....\n      x \u003c- c(head(x, lines), more)\n    }\n  } else {\n    x \u003c- c(\n      if (abs(lines[1]) \u003e 1) more else NULL,\n      x[lines],\n      if (length(x) \u003e lines[abs(length(lines))]) more else NULL\n    )\n  }\n  # paste these lines together\n  x \u003c- paste(c(x, \"\"), collapse = \"\\n\")\n  hook_output(x, options)\n})\n\nknitr::opts_chunk$set(\n  comment = \"#\u003e\",\n  collapse = TRUE,\n  warning = FALSE,\n  message = FALSE,\n  fig.path = \"man/figures/\"\n)\n```\n\n[![Project Status: Unsupported – The project has reached a stable, usable state but the author(s) have ceased all work on it. A new maintainer may be desired.](https://www.repostatus.org/badges/latest/unsupported.svg)](https://www.repostatus.org/#unsupported)\n[![R-CMD-check](https://github.com/sckott/geoops/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/sckott/geoops/actions/workflows/R-CMD-check.yaml)\n[![codecov](https://codecov.io/gh/sckott/geoops/branch/main/graph/badge.svg)](https://codecov.io/gh/sckott/geoops)\n\n`geoops` does spatial operations on GeoJSON.\n\n`geoops` is inspired by the JS library turf (http://turfjs.org/). It's\ntagline is _Advanced geospatial analysis for browsers and node_.\nTurf works only with GeoJSON, as does `geoops`. I don't know JS that well,\nbut it's easy enough to understand the language, so I've been porting\nTurf to C++ wrapped up in R. The C++ so we can have fast performance. We've\nalso wrapped the Turf JS library itself in the package\nlawn (https://github.com/ropensci/lawn), but we should be able to get better\nperformance out of C++.\n\n`geoops` has a ways to go to include all the methods that Turf has, but\nwe'll get there eventually.\n\nAll data is expected to be in WGS-84.\n\nWe use a library from Niels Lohmann (https://github.com/nlohmann/json)\nfor working with JSON in C++.\n\nSee also:\n\n* geojson: https://github.com/ropensci/geojson\n\nPackage API:\n\n```{r echo=FALSE}\ncat(paste(\" -\", paste(getNamespaceExports(\"geoops\"), collapse = \"\\n - \")))\n```\n\n\n## Installation\n\nStable version\n\n```{r eval=FALSE}\ninstall.packages(\"geoops\")\n```\n\nDev version\n\n```{r eval=FALSE}\nremotes::install_github(\"sckott/geoops\")\n```\n\n```{r}\nlibrary(\"geoops\")\n```\n\nSee the vignette (link here) to get started.\n\n\n## comparison to rgeos\n\nFIXME!!! remove `rgeos` stuff as that pkg is gone\n\n### distance\n\n```{r eval=FALSE}\npt1 \u003c- '{\"type\":\"Feature\",\"properties\":{\"marker-color\":\"#f00\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-75.343,39.984]}}'\npt2 \u003c- '{\"type\":\"Feature\",\"properties\":{\"marker-color\":\"#0f0\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-75.534,39.123]}}'\nlibrary(rgeos)\nrgeospt1 \u003c- rgeos::readWKT(\"POINT(0.5 0.5)\")\nrgeospt2 \u003c- rgeos::readWKT(\"POINT(2 2)\")\n```\n\n```{r eval=FALSE}\nmicrobenchmark::microbenchmark(\n  rgeos = rgeos::gDistance(rgeospt1, rgeospt2),\n  geoops = geoops::geo_distance(pt1, pt2, units = \"miles\"),\n  times = 10000L\n)\n```\n\n### nearest\n\n```{r eval=FALSE}\npoint1 \u003c- '{\"type\":[\"Feature\"],\"properties\":{\"marker-color\":[\"#0f0\"]},\"geometry\":{\"type\":[\"Point\"],\"coordinates\":[28.9658,41.0101]}}'\npoint2 \u003c- '{\"type\":[\"FeatureCollection\"],\"features\":[{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[28.9739,41.0111]}},{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[28.9485,41.0242]}},{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[28.9387,41.0133]}}]}'\npoints \u003c- '{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[28.9739,41.0111]}},{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[28.9485,41.0242]}},{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[28.9387,41.0133]}}]}'\ng1 \u003c- readWKT(\"MULTILINESTRING((34 54, 60 34), (0 10, 50 10, 100 50))\")\ng2 \u003c- readWKT(\"POINT(100 30)\")\n```\n\n```{r eval=FALSE}\nmicrobenchmark::microbenchmark(\n  rgeos = rgeos::gNearestPoints(g1, g2),\n  geoops = geoops::geo_nearest(point1, points),\n  times = 10000L\n)\n```\n\n## Example use case\n\n\u003cdetails\u003e \u003csummary\u003e\u003cstrong\u003eexpand\u003c/strong\u003e\u003c/summary\u003e\n\nGet some GeoJSON data, a FeatureCollection of Polygons\n\n```{r}\nfile \u003c- system.file(\"examples/zillow_or.geojson\", package = \"geoops\")\nx \u003c- paste0(readLines(file), collapse = \"\")\n```\n\nBreak each polygon into separate JSON string\n\n```{r}\nlibrary(\"jqr\")\npolys \u003c- unclass(jq(x, \".features[]\"))\n```\n\nUsing `geo_area`, calculate the area of the polygon\n\n```{r}\nareas \u003c- vapply(polys, geo_area, 1, USE.NAMES = FALSE)\n```\n\nVisualize area of the polygons as a histogram\n\n```{r}\nhist(areas, main = \"\")\n```\n\nVisualize some of the polygons, all of them\n\n```{r}\nlibrary(leaflet)\nleaflet() %\u003e%\n  addProviderTiles(provider = \"OpenStreetMap.Mapnik\") %\u003e%\n  addGeoJSON(geojson = x) %\u003e%\n  setView(lng = -123, lat = 45, zoom = 7)\n```\n\nJust one of them\n\n```{r}\nleaflet() %\u003e%\n  addProviderTiles(provider = \"OpenStreetMap.Mapnik\") %\u003e%\n  addGeoJSON(geojson = polys[1]) %\u003e%\n  setView(lng = -122.7, lat = 45.48, zoom = 13)\n```\n\u003c/details\u003e\n\n\n\n\n## Meta\n\n* Please [report any issues or bugs](https://github.com/sckott/geoops/issues).\n* License: MIT\n* Get citation information for `geoops` in R doing `citation(package = 'geoops')`\n* Please note that this project is released with a [Contributor Code of Conduct][coc].\nBy participating in this project you agree to abide by its terms.\n\n[coc]: https://github.com/sckott/geoops/blob/main/CODE_OF_CONDUCT.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsckott%2Fgeoops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsckott%2Fgeoops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsckott%2Fgeoops/lists"}