{"id":13736054,"url":"https://github.com/bevingtona/planetR","last_synced_at":"2025-05-08T12:31:55.133Z","repository":{"id":41994116,"uuid":"182562394","full_name":"bevingtona/planetR","owner":"bevingtona","description":"(early development) R tools to search, activate and download satellite imagery from the Planet API.","archived":false,"fork":false,"pushed_at":"2023-01-17T16:44:09.000Z","size":20062,"stargazers_count":45,"open_issues_count":5,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-17T04:39:37.033Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bevingtona.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"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}},"created_at":"2019-04-21T17:23:21.000Z","updated_at":"2025-03-22T08:13:43.000Z","dependencies_parsed_at":"2023-02-01T02:01:22.833Z","dependency_job_id":null,"html_url":"https://github.com/bevingtona/planetR","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/bevingtona%2FplanetR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bevingtona%2FplanetR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bevingtona%2FplanetR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bevingtona%2FplanetR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bevingtona","download_url":"https://codeload.github.com/bevingtona/planetR/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253068651,"owners_count":21848858,"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-03T03:01:15.090Z","updated_at":"2025-05-08T12:31:54.724Z","avatar_url":"https://github.com/bevingtona.png","language":"R","funding_links":[],"categories":["Resources for `R`"],"sub_categories":["Testing your code"],"readme":"# planetR\n\nSome R tools to search, activate and download satellite imagery from the Planet API (https://developers.planet.com/docs/api/). The current purpose of the package is to Search the API, batch activate all assets, and then batch download them. \n\nThere are two API's: \n- v1 Planet API\n- v2 Planet Orders API (can clip and pre-process scenes to AOI on server)\n\n### Functions\n\n```{r functions}\n\n## current functions (API v1)\nplanetR::planet_search()\nplanetR::planet_activate()\nplanetR::planet_download()\n\n## current functions (Orders API v2)\nplanetR::planet_order_request()\nplanetR::planet_order_download()\nplanetR::planet_order()\n\n```\n\n### Installation\n\nYou can install planetR directly from this GitHub repository. To do so, you will need the remotes package. Next, install and load the planetR package using remotes::install_github():\n\n```{r installation}\ninstall.packages(\"remotes\")\nremotes::install_github(\"bevingtona/planetR\")\nlibrary(planetR)\n```\n\n#### Example using Planet Orders API v2\n\nThis is an example of how to search, activate and download assets using `planetR`.\n\n```{r example}\n\n#### LIBRARIES ####\nlibrary(planetR)\nlibrary(httr)\nlibrary(jsonlite)\nlibrary(raster)\nlibrary(stringr)\nlibrary(sf)\n\n#### USER VARIABLES ####\n\n# Site name that will be used in the export folder name\nsite = \"MySite\"\n\n# Set Workspace (optional)\nsetwd(\"\")\n\n# Set API\napi_key = \"\" \n\n# Date range of interest\ndate_start \u003c- as.Date(\"2022-01-01\")\ndate_end   \u003c- as.Date(\"2022-04-01\")\n\n# Metadata filters\ncloud_lim \u003c- 0.02 # percent from 0-1\nitem_name \u003c- \"PSScene\" # (see https://developers.planet.com/docs/data/items-assets/)\nproduct_bundle \u003c- \"analytic_8b_sr_udm2\" # https://developers.planet.com/docs/integrations/gee/delivery/\nasset \u003c- \"ortho_udm2\" # (see https://developers.planet.com/docs/data/items-assets/)\n\n# Set AOI (many ways to set this!) ultimately just need an extent()\n# OPTION 1: Import feature\nmy_aoi       = read_sf(\"path_to_file.sqlite\") # KML, SHP, SQLITE, or other\nbbox         = extent(my_aoi)\n# OPTION 2: Digitize om map\nmy_aoi       = mapedit::editMap() # Set in GUI\nbbox         = extent(my_aoi)\n# OPTION 3: Set bounding box manually\nbbox         = extent(-129,-127,50,51)\n\n# Set/Create Export Folder\nexportfolder \u003c- paste(site, item_name, asset, lubridate::year(date_start), lubridate::year(date_end),  lubridate::yday(date_start),  lubridate::yday(date_end), sep = \"_\")\n\nif(!(dir.exists(\"exports\"))){\ndir.create(\"exports\", showWarnings = F)\n}\n\ndir.create(file.path(\"exports\", exportfolder), showWarnings = F)\n\n# Planet Orders API\n\nplanet_order(api_key = api_key, \n             bbox = bbox, \n             date_end = date_end,\n             date_start = date_start,\n             cloud_lim = cloud_lim, \n             item_name = item_name, \n             product_bundle = product_bundle,\n             asset = asset,\n             mostrecent = 1, # downloads the 1 most recent image\n             order_name = exportfolder)\n             \n\n[1] \"Found 6 suitable PSScene4Band analytic_sr images\"\n[1] \"Day of year: 290-300\"\n[1] \"Year: 2016-2020\"\n[1] \"Save the Order ID: cd16bf13-2f18-47e1-84ad-1d3d280326e3\"\n[1] \"You can restart the download with `planet_order_download(order_id, order_name)`\"\n[1] \"Order still being proccessed, trying again in 60 seconds...\"\n[1] \"queued\"\n[1] \"Order still being proccessed, trying again in 60 seconds...\"\n[1] \"running\"\n[1] \"Order still being proccessed, trying again in 60 seconds...\"\n[1] \"running\"\n[1] \"Order still being proccessed, trying again in 60 seconds...\"\n[1] \"running\"\n[1] \"Order still being proccessed, trying again in 60 seconds...\"\n[1] \"running\"\n[1] \"Order still being proccessed, trying again in 60 seconds...\"\n[1] \"running\"\n[1] \"Order still being proccessed, trying again in 60 seconds...\"\n[1] \"running\"\n[1] \"Order still being proccessed, trying again in 60 seconds...\"\n[1] \"running\"\n[1] \"Order still being proccessed, trying again in 60 seconds...\"\n[1] \"running\"\n[1] \"Starting download\"\n[1] \"Download: 4%\"\n[1] \"Download: 8%\"\n[1] \"Download: 10%\"\n[1] \"Download: 20%\"\n[1] \"Download: 20%\"\n[1] \"Download: 20%\"\n[1] \"Download: 30%\"\n[1] \"Download: 30%\"\n[1] \"Download: 40%\"\n[1] \"Download: 40%\"\n[1] \"Download: 40%\"\n[1] \"Download: 50%\"\n[1] \"Download: 50%\"\n[1] \"Download: 60%\"\n[1] \"Download: 60%\"\n[1] \"Download: 60%\"\n[1] \"Download: 70%\"\n[1] \"Download: 70%\"\n[1] \"Download: 80%\"\n[1] \"Download: 80%\"\n[1] \"Download: 80%\"\n[1] \"Download: 90%\"\n[1] \"Download: 90%\"\n[1] \"Download: 100%\"\n[1] \"Download: 100%\"\n[1] \"Download complete\"\n[1] \"Items located in ../MySite_PSScene4Band_analytic_sr_2016_2020_290_300\"\n\n```\n\n#### Example using Planet API v1\n\n```{r example_v1}\n\n# PLANET_SEARCH: Search API\n\n  response \u003c- planet_search(bbox = bbox,\n              date_end = date_end,\n              date_start = date_start,\n              cloud_lim = cloud_lim,\n              item_name = item_name,\n              asset = asset,\n              api_key = api_key)\n              \n  print(paste(\"Images available:\", length(response), item_name, asset))\n\n# PLANET_ACTIVATE: Batch Activate \n\nfor(i in 1:nrow(response)) {\n  planet_activate(i, item_name = item_name)\n  print(paste(\"Activating\", i, \"of\", nrow(response)))}\n\n# PLANET_DOWNLOAD: Batch Download \n\nfor(i in 1:nrow(response)) {\n  planet_download(i)\n  print(paste(\"Downloading\", i, \"of\", nrow(response)))}\n  \n```\n![](images/download_example.png)\n\n\n### Project Status\n\nVery early/experimental status. \n\n### Getting Help or Reporting an Issue\n\nTo report bugs/issues/feature requests, please file an [issue](https://github.com/bevingtona/planetR/issues/).\n\n### How to Contribute\n\nIf you would like to contribute to the package, please see our \n[CONTRIBUTING](CONTRIBUTING.md) guidelines.\n\nPlease note that this 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### License\n\n```\nLicensed under the Apache License, Version 2.0 (the \u0026quot;License\u0026quot;);\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \u0026quot;AS IS\u0026quot; BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbevingtona%2FplanetR","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbevingtona%2FplanetR","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbevingtona%2FplanetR/lists"}