{"id":13482307,"url":"https://github.com/brycejohnston/sentinel2-search-api","last_synced_at":"2025-04-07T10:51:32.980Z","repository":{"id":112212292,"uuid":"114694550","full_name":"brycejohnston/sentinel2-search-api","owner":"brycejohnston","description":"Simple API to query Sentinel-2 data by MRGS on AWS","archived":false,"fork":false,"pushed_at":"2018-04-07T15:14:08.000Z","size":1437,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-23T10:20:34.487Z","etag":null,"topics":["api","aws","mgrs","satellite","sentinel-2"],"latest_commit_sha":null,"homepage":"https://sentinel2.satgateway.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brycejohnston.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-12-18T22:36:51.000Z","updated_at":"2020-04-16T12:13:40.000Z","dependencies_parsed_at":"2023-05-11T08:15:32.191Z","dependency_job_id":null,"html_url":"https://github.com/brycejohnston/sentinel2-search-api","commit_stats":{"total_commits":31,"total_committers":1,"mean_commits":31.0,"dds":0.0,"last_synced_commit":"7a605812f8decd4010ce474c6b73d1bcd0c3d99b"},"previous_names":["beaorn/sentinel2-search-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brycejohnston%2Fsentinel2-search-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brycejohnston%2Fsentinel2-search-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brycejohnston%2Fsentinel2-search-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brycejohnston%2Fsentinel2-search-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brycejohnston","download_url":"https://codeload.github.com/brycejohnston/sentinel2-search-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247640557,"owners_count":20971555,"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":["api","aws","mgrs","satellite","sentinel-2"],"created_at":"2024-07-31T17:01:00.736Z","updated_at":"2025-04-07T10:51:32.886Z","avatar_url":"https://github.com/brycejohnston.png","language":"Ruby","funding_links":[],"categories":["Tools"],"sub_categories":["Search \u0026 Download"],"readme":"# Sentinel-2 MGRS Tile Search API\n\nSimple Ruby on Rails based API to query Sentinel-2 data by MGRS on AWS. Data imported daily from AWS with\nthe [sentinel2_aws gem](https://github.com/beaorn/sentinel2_aws).\n\nLive version is deployed at https://sentinel2.satgateway.com\n\nTile Preview Viewer implementing this API: [sentinel2-search-viewer](https://github.com/beaorn/sentinel2-search-viewer)\n\n## Setup\n\nPrerequisites: Ruby, Bundler, Ruby on Rails, PostgreSQL, PostGIS, and Redis\n\nClone project, copy database and secrets example configs and set them up.\n```bash\ncp config/database.example.yml config/database.yml\ncp config/secrets.example.yml config/secrets.yml\n```\n\nInstall gems, setup database, run migrations, and seed database\n```bash\nbundle install\ncreatedb sentinel2-search-api_development\npsql sentinel2-search-api_development\n```\n\n```sql\nCREATE SCHEMA postgis;\nCREATE EXTENSION postgis WITH SCHEMA postgis;\n\\q\n```\n\n```bash\nrails db:migrate\nrails import_mgrs_grids\n```\n\n## Running Project\n\nStart server\n```bash\nbundle exec rails server\n```\n\nStart sidekiq (requires redis server to be running)\n```bash\nbundle exec sidekiq\n```\n\n### Import product and tile data by date\n```ruby\nSentinelWorker.perform_async(\"2017-12-14\")\n```\n\n### Import product and tile data by date range\n```ruby\n(Date.new(2017, 12, 1)..Date.new(2017, 12, 31)).each do |date|\n  date_str = date.strftime(\"%Y-%m-%d\")\n  SentinelWorker.perform_async(date_str)\nend\n```\n\n### Scheduled Daily Imports\nAdd scheduled calls to SentinelWorker in `config/schedule.rb`.\n\n## Tile API Examples\n\n- mgrs parameter format is utm_zone + latitude_band + grid_square\n- start_date and end_date parameter formats are YYYY-MM-DD\n\n### Get all tiles for 36RUU\nhttp://localhost:3000/api/v1/tiles?mgrs=36RUU\n\n### Get all tiles for 36RUU with date \u003e= 2017-01-01\nhttp://localhost:3000/api/v1/tiles?mgrs=36RUU\u0026start_date=2017-01-01\n\n### Get all tiles for 36RUU with date \u003c= 2017-10-15\nhttp://localhost:3000/api/v1/tiles?mgrs=36RUU\u0026end_date=2017-10-15\n\n### Get all tiles for 36RUU between 2017-01-01 and 2017-10-15\nhttp://localhost:3000/api/v1/tiles?mgrs=36RUU\u0026start_date=2017-01-01\u0026end_date=2017-10-15\n\n### Get all tiles for 36RUU with \u003c= 50% cloud coverage\nhttp://localhost:3000/api/v1/tiles?mgrs=36RUU\u0026cloud_max=50\n\n### Get all tiles for 36RUU with \u003e= 10% data coverage\nhttp://localhost:3000/api/v1/tiles?mgrs=36RUU\u0026data_min=10\n\n### Tile API Response Format\n```json\n[\n  {\n    \"mgrs_grid_name\": \"36RUU\",\n    \"utm_zone\": 36,\n    \"latitude_band\": \"R\",\n    \"grid_square\": \"UU\",\n    \"path\": \"tiles/36/R/UU/2018/1/7/0\",\n    \"date\": \"2018-01-07\",\n    \"timestamp\": \"2018-01-07T08:49:36.450Z\",\n    \"epsg\": \"32636\",\n    \"product_name\": \"S2B_MSIL1C_20180107T084329_N0206_R064_T36RUU_20180107T110727\",\n    \"product_path\": \"products/2018/1/7/S2B_MSIL1C_20180107T084329_N0206_R064_T36RUU_20180107T110727\",\n    \"data_coverage_percentage\": \"17.6\",\n    \"cloudy_pixel_percentage\": \"0.0\",\n    \"thumbnail\": \"https://sentinel-s2-l1c.s3.amazonaws.com/tiles/36/R/UU/2018/1/7/0/preview.jpg\"\n  },\n]\n```\n\n## MGRS API Example\n\n### Find MGRS tile identifier for a given latitude and longitude\nhttp://localhost:3000/api/v1/mgrs_grids/closest?latitude=29.979235\u0026longitude=31.134202\n\n### MGRS API Response Format\n```json\n{\n  \"name\": \"36RUU\",\n  \"utm_zone\": \"36\",\n  \"latitude_band\": \"R\",\n  \"grid_square\": \"UU\",\n  \"latitude\": 31.4893138415,\n  \"longitude\": 30.2278496385,\n  \"epsg\": \"32636\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrycejohnston%2Fsentinel2-search-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrycejohnston%2Fsentinel2-search-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrycejohnston%2Fsentinel2-search-api/lists"}