For argicultural applications

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

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

Get your API key


Preparation 1. Setup coordinates of your field

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

We use GeoJSON format for assigning of the polygon.

In our examples we will use the polygon of the San Francisco area.

Query template

{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-121.32,37.65],[-121.32,37.72],[-121.11,37.72],[-121.11,37.65],[-121.32,37.65]]]}}&APPID={APIKEY}


Preparation 2. Get a list of dates with available images

We will ask an API for searching of all available images for the polygon in our database.

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

Query template

http://api.sat.owm.io/api/2.5/search?poly={"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-121.32,37.65],[-121.32,37.72],[-121.11,37.72],[-121.11,37.65],[-121.32,37.65]]]}}&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 one day, October 1, 2016, as an example and calculate NDVI for our polygon.

Query template

http://sat.owm.io/sql?select=b5,b4&where=day=2016-10-01&op=ndvi&polygon={"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-121.32,37.65],[-121.32,37.72],[-121.11,37.72],[-121.11,37.65],[-121.32,37.65]]]}}&APPID={APIKEY}

Result:

...

Workout 2. Setup your color scheme of NDVI

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 - HTML colors

Query template

http://sat.owm.io/sql?select=b5,b4&where=day=2016-10-01&op=ndvi&polygon={"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-121.32,37.65],[-121.32,37.72],[-121.11,37.72],
[-121.11,37.65],[-121.32,37.65]]]}}
&color=0:04123cff;0.03:fcfefcff;0.06:c4baa4ff;0.1:b4966cff;0.13:a4824cff;0.16:94723cff;0.2:7c9e2cff;
0.25:94b614ff;0.3:74aa04ff;0.35:64a204ff;0.4:549604ff;0.45:3c8604ff;0.5:1c7204ff;
0.6:046204ff;0.7:044a04ff;0.8:043a04ff;0.9:042a04ff;1:041204ff;&APPID={APIKEY}

Result:

...

Query template

http://sat.owm.io/sql?select=b5,b4&where=day=2016-10-01&op=ndvi&polygon={"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-121.32,37.65],[-121.32,37.72],[-121.11,37.72],
[-121.11,37.65],[-121.32,37.65]]]}}
&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 3. Get RGB image

For October 1, 2016, we get RGB with correction of the brightness by &color=brightness>5000,brightness< 13000 .

For RGB processing you need to choose three bands of b4,b3 and b2 byselect=b4,b3,b2 and type of the processing as&op=rgb

Query template

http://sat.owm.io/sql?select=b4,b3,b2&where=day=2016-10-01&op=rgb&color=brightness>5000,brightness<13000&polygon={"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-121.32,37.65],[-121.32,37.72],[-121.11,37.72],[-121.11,37.65],[-121.32,37.65]]]}}&APPID={APIKEY}

Result:

...


Workout 4. False RGB

For RGB processing with false colors you need to choose another bands of b7,b4 and b3 byselect=b7,b4,b3 and type of the processing as&op=rgb

Query template

http://sat.owm.io/sql?select=b7,b4,b3&where=day=2016-10-01&op=rgb&color=brightness>5000,brightness<13000&&APPID={APIKEY}&polygon=

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

http://{s}.sat.owm.io/sql/{z}/{x}/{y}?select=b5,b4&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

http://{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

Workout 7. Weekly NDVI map with tile server

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

Query template

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

Result:

viewer