{"id":15527139,"url":"https://github.com/workingdog/agroapi","last_synced_at":"2026-04-29T18:34:03.603Z","repository":{"id":63921246,"uuid":"281302737","full_name":"workingDog/AgroAPI","owner":"workingDog","description":"Swift Agro API library for satellite imagery","archived":false,"fork":false,"pushed_at":"2020-08-31T05:14:37.000Z","size":147,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-06T02:36:40.091Z","etag":null,"topics":["agro-api","openweather","swift","swiftui"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/workingDog.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}},"created_at":"2020-07-21T05:20:30.000Z","updated_at":"2024-05-26T02:50:08.000Z","dependencies_parsed_at":"2023-01-14T14:15:40.190Z","dependency_job_id":null,"html_url":"https://github.com/workingDog/AgroAPI","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workingDog%2FAgroAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workingDog%2FAgroAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workingDog%2FAgroAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workingDog%2FAgroAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/workingDog","download_url":"https://codeload.github.com/workingDog/AgroAPI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246100561,"owners_count":20723479,"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":["agro-api","openweather","swift","swiftui"],"created_at":"2024-10-02T11:04:36.894Z","updated_at":"2026-04-29T18:34:03.549Z","avatar_url":"https://github.com/workingDog.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Swift OpenWeather Agro API library\n\n[**OpenWeather Agro API**](https://agromonitoring.com/) brings satellite images to farmers. \n\"Through our simple and fast API, you can easily get multi-spectrum images of the crop for the most recent day or for a day in the past; we have the most useful images for agriculture such as NDVI, EVI, True Color and False Color.\"\n\nThe concept in using **Agro API** satellite imagery is to first create one or more polygons representing for example, agricultural crop fields or forestry areas. Once the polygons are setup, satellite images such as; true color, false color, NDVI, EVI etc... can be retrieved from the **Argo API server** for those polygons. Those images are used to estimate the amount and health of the vegetation and crop development over time in those polygons.\n\n**AgroApi** is a small Swift library to connect to the [**OpenWeather Agro API**](https://agromonitoring.com/api) and retrieve the chosen data. Made easy to use with SwiftUI.\n\nIncludes, the Polygons, Weather, Satellite Imagery and Historical NDVI APIs.\n\n#### Polygons API\n\nThe Agro Polygons API provides for polygon creation, adding data, removing a polygon and listing information about one or more polygons. \nYou can also retrieve the list of all polygons from your account page.\n\nReference: [Polygons](https://agromonitoring.com/api/polygons)\n\n#### Satellite Imagery API\n\nAfter the creation of polygons, the satellite imagery can be used for retrieving images for those polygons, such as; \nimages in True Color, False Color, NDVI, and EVI in png, and get the meta data for your polygon or image in tiff.\n\nReference: [Satellite Imagery](https://agromonitoring.com/api/images)\n\n#### Agro weather API\n\nThe Agro weather API provides information on the current, forecast and historical weather for your polygons.\n\nReference: [Current weather](https://agromonitoring.com/api/current-weather)\n\nReference: [Forecast weather](https://agromonitoring.com/api/forecast-weather)\n\nReference: [Historical weather](https://agromonitoring.com/api/history-weather)\n\n#### Agro historical NDVI API \n\nThe Agro historical NDVI API provides for previously observed (historical) NDVI values for your polygons.\n\nReference: [Historical NDVI API ](https://openweather.co.uk/blog/post/dive-agro-api-part-3-historical-ndvi-api)\n\nReference: [Historical NDVI API by polygon ](https://agromonitoring.com/api/history-ndvi)\n\n### Usage\n\nAll interactions with the Agro API server is done through the use of a single **AgroProvider**.\n\nData, such as satellite imagery from  [**Agro API**](https://agromonitoring.com/api) is accessed through the **AgroProvider** \nusing a set of simple asynchronous functions, for example:\n\n    import AgroApi\n    \n    struct ContentView: View {\n        let agroProvider = AgroProvider(apiKey: \"your key\")\n        @State var uiImage = UIImage()\n        \n        var body: some View {\n            Image(uiImage: uiImage).onAppear { self.loadData() }\n        }\n        \n        func loadData() {\n           let options = AgroOptions(polygon_id: \"5f45273c734b52667be0bb1e\",\n                              start: Date().addingTimeInterval(-60*60*24*20),\n                              end: Date())\n    \n           agroProvider.getImagery(options: options) { imagery in\n              if let sat = imagery?.first, let img = sat.image, let theUrl = img.ndvi {\n                 self.agroProvider.getPngUIImage(urlString: theUrl, paletteid: 1, reponse: self.$uiImage)\n              }\n          }\n       }\n    }\n   \nFor example use, see:\n\n-    [**AgroDonkey**](https://github.com/workingDog/AgroDonkey)\n\n-    [*AgroApiExample*](https://github.com/workingDog/AgroApiExample)\n\n\n**AgroProvider** has the following asynchronous functions, together with their equivalent callback methods:\n\nNote, **AgroProvider** should be strongly referenced.\n\n**Polygons**\n\n- createPoly(poly: AgroPolygon, reponse: Binding\\\u003cAgroPolyResponse\u003e)\n- getPoly(id: String, reponse: Binding\\\u003cAgroPolyResponse\u003e) \n- getPolyList(reponse: Binding\\\u003c[AgroPolyResponse]\u003e) \n- deletePoly(id: String, reponse: Binding\\\u003cAgroPolyResponse\u003e)\n- updatePoly(id: String, name: String, reponse: Binding\\\u003cAgroPolyResponse\u003e)\n\n**Satellite**\n\n- getImagery(options: AgroOptions, reponse: Binding\\\u003c[AgroImagery]\u003e) \n- getStatsInfo(urlString: String, reponse: Binding\\\u003cAgroStatsInfo\u003e)\n- getTile(urlString: String, reponse: Binding\\\u003cData\u003e) \n- getPngImageData(urlString: String, paletteid: Int, reponse: Binding\\\u003cData\u003e) \n- getPngUIImage(urlString: String, paletteid: Int, reponse: Binding\\\u003cUIImage\u003e) \n- getGeoTiffData(urlString: String, paletteid: Int, reponse: Binding\\\u003cData\u003e)\n- getGeoTiffUIImage(urlString: String, paletteid: Int, reponse: Binding\\\u003cUIImage\u003e)\n  \n**Weather**\n\n- getCurrentWeather(id: String, reponse: Binding\\\u003cCurrent\u003e)\n- getForecastWeather(id: String, reponse: Binding\\\u003c[Current]\u003e)\n- getHistoricalWeather(options: AgroWeatherOptions, reponse: Binding\\\u003c[Current]\u003e)\n\n**Historical NDVI**\n\n- getHistoricalNDVI(options: AgroOptions, reponse: Binding\\\u003c[AgroHistoryNDVI]\u003e)\n\n\n### Installation\n\nInclude the files in the **./Sources/AgroApi** folder into your project or preferably use **Swift Package Manager**. \n\n#### Swift Package Manager  (SPM)\n\nCreate a Package.swift file for your project and add a dependency to:\n\n    dependencies: [\n      .package(url: \"https://github.com/workingDog/AgroApi.git\", from: \"0.1.4\")\n    ]\n\n#### Using Xcode\n\n    Select your project \u003e Swift Packages \u003e Add Package Dependency...\n    https://github.com/workingDog/AgroApi.git\n\nThen in your code:\n\n    import AgroApi\n    \n\n### References\n\n-    [**OpenWeather Agro API**](https://agromonitoring.com/api)\n\n\n### Requirement\n\nRequires a valid OpenWeather key, see:\n\n-    [OpenWeather how to start](https://openweathermap.org/appid)\n\n-    [Agro API](https://agromonitoring.com/api/get)\n\n### License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkingdog%2Fagroapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworkingdog%2Fagroapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkingdog%2Fagroapi/lists"}