{"id":20667871,"url":"https://github.com/statnmap/geodist","last_synced_at":"2025-04-19T17:09:42.058Z","repository":{"id":117562848,"uuid":"109185351","full_name":"statnmap/GeoDist","owner":"statnmap","description":"Constrained distance calculation and associated geotools","archived":false,"fork":false,"pushed_at":"2020-01-29T16:44:17.000Z","size":98,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T10:43:13.285Z","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":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/statnmap.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-11-01T21:21:29.000Z","updated_at":"2022-02-20T11:51:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"fdfd823f-d679-4f3b-88dd-191a437da2ca","html_url":"https://github.com/statnmap/GeoDist","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/statnmap%2FGeoDist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statnmap%2FGeoDist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statnmap%2FGeoDist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statnmap%2FGeoDist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/statnmap","download_url":"https://codeload.github.com/statnmap/GeoDist/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249746040,"owners_count":21319581,"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-16T19:45:24.614Z","updated_at":"2025-04-19T17:09:42.030Z","avatar_url":"https://github.com/statnmap.png","language":"R","funding_links":[],"categories":[],"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\n# GeoDist: Constrained distance calculation and associated geotools\n\n\u003c!-- badges: start --\u003e\n\u003c!-- badges: end --\u003e\n\n**Work in progress**\n\nThis R-package allows the calculation of distances that are contrained by frontiers, islands, mountains,... Distances are calculated from a raster grid of the area.  \n_From A to B_\n       \n       A     XXX\n       |   XXXXXX\n       | XXXXXXXX\n       |XXXXXXXX\n       \\ XXXXXX\n        \\_XX_ _ B\n\nThese distances can then be implemented in classical geotools like inverse distance interpolation (`idw.dist`) or kriging with a modified version of `geoR` functions that accept custom calculated distances (`variog.dist`, `likfit.dist`, `krige.conv.dist`).\n\nCurrently distances are calculated using library `igraph`, but library `Rvcg` would be much more efficient (I keep that in mind for one day...). \n\n# Download and Install\n\nTo download the development version of the `GeoDist` package, type the following at the R command line:\n\n```r\ninstall.packages(\"devtools\")  \ndevtools::install_github(\"statnmap/GeoDist\")\n```\n\nNote that spatial libraries like `rgdal` and `sp` may require additional softwares to be installed on your computer if you work with Mac or Linux. Look how to install `proj4`, `geos` and `gdal` on your system.\n\n## Example\n\n```{r example}\nlibrary(GeoDist)\nlibrary(raster)\nlibrary(sp)\n\n## basic example code\ncrs_merc \u003c- \"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m\"\n# Create raster\nr \u003c- raster(ncol = 20, nrow = 20,\n            crs = crs_merc)\nvalues(r) \u003c- 1\nvalues(r)[125:127] \u003c- NA\nvalues(r)[145:147] \u003c- NA\nvalues(r)[165:167] \u003c- NA\nplot(r)\n\n# Create points\nfrom_coords \u003c- cbind(-150, 40)\nfrom_sp \u003c- SpatialPointsDataFrame(coords = from_coords, \n                                  data = data.frame(label = \"start\"),\n                                  proj4string = CRS(crs_merc))\n\nto_coords \u003c- matrix(c(50, 0, 100, -50), byrow = TRUE, ncol = 2)\nto_sp \u003c- SpatialPointsDataFrame(coords = to_coords, \n                                data = data.frame(label = c(\"end1\", \"end2\")),\n                                proj4string = CRS(crs_merc))\n\n\nplot(r)\npoints(from_sp, pch = 20, col = \"blue\")\npoints(to_sp, pch = 20, col = \"red\")\n\n# For \"from\" and \"to\" being SpatialPoints\nallpath \u003c- dist.obstacle(from = from_sp, to = to_sp, r.ref = r, keep.path = TRUE)\n\n# All path from \"from[1,]\" to all \"to\"\nlines(allpath$listLines)\n```\n\nPlease note that the 'GeoDist' project is released with a\n  [Contributor Code of Conduct](CODE_OF_CONDUCT.md).\n  By contributing to this project, you agree to abide by its terms.\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatnmap%2Fgeodist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatnmap%2Fgeodist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatnmap%2Fgeodist/lists"}