It can be due to incorrect "pixel_type". If your "pixel_type" is an integer you will not be getting variation (-1 to 1), you will be getting only two values, 0 or 1. In a lot of cases, it will be only 0 (due to rounding of floating values to integer values).
Planet API allows users to do on the fly NDVI Calculation. This requires users to have a valid Planet API key. The sample code is based on analytic and basic_analytic asset types of the following item_types:
- PSOrthoTile
- REOrthoTile
- PSScene4Band
- PSScene8Band
You can use this sample code to try the NDVI calculation on PlanetScope 4 Band image.
{
“name”:“ndvi_bandmath”,
“products”:[
{
“item_ids”:[
“20210306_042752_52_2276”
],
“item_type”:“PSScene4Band”,
“product_bundle”:“analytic”
}
],
“tools”: [
{
“bandmath”: {
“b1": “b1”,
“b2": “b2”,
“b3": “b3”,
“b4": “b4”,
“b5": “(b4-b3)/(b4+b3)“,
“pixel_type”: “32R” }
}
],
“delivery”:{
“archive_type”:“zip”,
“single_archive”: true,
“archive_filename”:“{{name}}_{{order_id}}.zip”
}
}
The output of this tool will be an asset that includes all four bands of the original file and the fifth band with NDVI values.
Note: You can change the item_ids to desired Planet Imagery. The "32R" signifies a 32bit floating-point data type.
Comments
Please sign in to leave a comment.