How to make online products on satellite images and integrate them to agricultural applications

It is a scope of workouts that might be useful for precision agriculture applications. You can learn how to query satellite images to form scenes in RGB, NDVI with any color scheme with flexible customization of any parameters for any crops. Just integrate any query into the application to get instant result.


How to start

Sign up to get your API key and always use it in each query as &APPID={APIKEY}. Query language detailed specification with more examples is here.


Preparation 1. Setup coordinates of your field

You can use the visual tool to form a polygon. Draw a polygon on the map and then get a list of coordinated in the popup window that you can copy and paste into the query.

We use GeoJSON format for assigning of the polygon.

Query template

&where=day=2016-07-10&op=ndvi&polygon={"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-102.73,34.43],[-102.73,34.49],[-102.57,34.49],[-102.57,34.43],[-102.73,34.43]]]}}&APPID={APIKEY}


Preparation 2. Get a list of dates with available images

Ask the Search API to search for all available images for the polygon in our database.

You can also setup a filter for the cloudiness. If you like to get dates when images had cloudiness less than 40% just add a filter &where=clouds< 40

Query template

//api.sat.owm.io/api/3.0/search?poly={"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-102.73,34.43],[-102.73,34.49],[-102.57,34.49],[-102.57,34.43],[-102.73,34.43]]]}}&APPID={APIKEY}

Example of the respond:

                [
                {"date":"2013-12-12","day":"2013-346","time":1386874046,"clouds":0.76,
                "sun":{"elevation":27.06930431,"azimuth":160.64830388},
                "intersection":100,
                "bands":["B2","B3","B4","B5","B7"],
                "scenes":["LC80440342013346LGN00"],
                "status":"loaded"},
                
                {"date":"2016-04-01","day":"2016-092","time":1459535960,"clouds":0.59,
                "sun":{"elevation":51.94210445,"azimuth":143.49839958},
                "intersection":100,
                "bands":["B2","B3","B4","B5","B7"],
                "scenes":["LC80430342016092LGN00"],
                "status":"loaded"},
                ...
                ]

Workout 1. Compute NDVI for any date

We choose satellite source Sentinel2 for one day, July 10, 2016, as an example, and calculated NDVI for our polygon.

Query template

//sat.owm.io/sql?from=s2&select=b8,b4&where=day=2016-07-10&op=ndvi&polygon={"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-102.73,34.43],[-102.73,34.49],[-102.57,34.49],[-102.57,34.43],[-102.73,34.43]]]}}&APPID={APIKEY}

Result:

...

Workout 2. Setup your color scheme of NDVI

We choose satellite image for one day as an example, and calculated NDVI for our polygon.

You can setup your color scheme absolutely flexibely by playing with a parameter &color=0.03:fcfefcff; .... This parameter consists of pairs of numbers like 0.03:fcfefcff separated by semicolons where:

0.03 - NDVI value from 0 to 1

fcfefcff - hex code for colors

Query template

//sat.owm.io/sql?from=s2&select=b8,b4&where=day=2016-07-10&op=ndvi&polygon={"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-102.73,34.43],[-102.73,34.49],[-102.57,34.49],[-102.57,34.43],[-102.73,34.43]]]}}&color=0:d93f2aff;0.05:df452cff;0.1:e66c2eff;0.15:e4622dff;0.2:f2b331ff; 0.25:f7d932ff;0.3:eff630ff;0.35:b0f321ff;0.4:80f116ff;0.45:76f013ff; 0.5:74ed17ff;0.55:6cde28ff;0.6:50ab56ff;0.65:317b83ff;0.7:0648b3ff; 0.75:1f46f0ff;0.8:2d45e9ff;0.85:533dcaff;0.9:783bb1ff;1:a342aeff;&APPID={APIKEY}

Result:

...



Workout 5. The most recent NDVI with tile server

You should call a tile server with /{z}/{x}/{y}, setup processing type as &op=ndvi and choose the most recent images with &order=last

Query template

//{s}.sat.owm.io/sql/{z}/{x}/{y}?select=b8,b4&from=s2&op=ndvi&order=last&APPID={APIKEY}

Result:

viewer

Workout 6. Season NDVI map with tile server

You should call a tile server with /{z}/{x}/{y}, setup processing type as &op=ndvi and indicate a period,e.g. April, as &where=between(2016-04-01:2016-04-30). We choose only cloudiness images with &order=best

Query template

//{s}.sat.owm.io/sql/{z}/{x}/{y}?select=b5,b4&op=ndvi&where=between:(2016-04-01,2016-04-30)&order=best&APPID={APIKEY}

Result:

viewer