for Developers

for Developers

  • Docs
  • Help

›API References

Introduction

  • Description
  • Available Services

Get Started

  • Integration Example (google maps js, leafletjs, mapbox)
  • Using Raster Files
  • Variable Rate Application using the Demo
  • Variable Rate Application using API

API References

  • Login
  • Register Fields
  • Update Fields
  • Delete Fields
  • List Fields
  • List Files
  • Download Files
  • Register Webhooks For Notifications
  • Upload Raster Files
  • Get Processed Raster Files
  • Value at Location
  • Field Boundary Detection
  • Register Field Metadata

VRA (Beta)

  • Variable Rate Application (Beta)
  • GeoJson to Shapefile

Download Files

For a better understanding of how you can implement the API into your software see Get Started

Description

This route is used to download files under a service (ndvi,ndwi,'chi' etc.) for a given {field_name}. The files are download as a PNG or Json file. Without a {service_name} in extention, it will default to ndvi service.

When you enter a date, it will look for the closest date to the input date if the specific date has no data because of clouds.

Endpoints

  • /download/{service_name}/{file_type}
  • /files/get/{service_name}/{file_type}

Method type

POST

Parameters

namedescriptiontypeRequiredDefault Value
tokenYour identification tokenstringrequired
field_nameName of the fieldstringrequired
dateSelect files from this date or the closest. Format:YYYY-MM-DDstringoptional
extSpecified file type to download. If not specied, both files will be downloaded (png, json)stringoptional

Response Details | JSON

namedescription
boundsArray containing latitude and longitude to place the png image in google maps/ leaflet API
<index>Like “ndvi”, “evi” etc. It is an array of absolute index values at all pixels.
meanStatistical mean value of the index
medianmedian value of the index
stdStandard deviation
minMinimum index value
maxMaximum index value
p2525th Percentile value
p7575th Percentile value
numNumber of pixels containing the field
mean_variation% change of current mean value from the previous image mean value

Responses

status codedescription
200Your request is successful
400Wrong inputs or there are required parameters missing
403Forbidden request or acces denied
500Unexpected error
404Resource was not found (It means that there are clouds and we have no data)

Examples :

======

Image

Example Request Image

POST https://spacesense-api.ew.r.appspot.com/download/ndwi/image?token=__myToken__&field_name=farm_1

Example Response Image

This request returns a PNG file of the latest available imagery since no date is specied.

Response image ndvi 20200730

Color map

{"colormaps":
  [
    {
      "index": "ndvi",
      "scale": ["#a50026", "#d3322b", "#f16d43", "#fcab63", "#fedc8c", "#f9f7ae", "#d7ee8e", "#a4d86f", "#64bc61", "#23964f", "#23964f"],
      "start": 0.0,
      "stop": 1.0
    },
    {
      "index": "ndwi",
      "scale" : [ "#d3322b", "#f16d43", "#fcab64", "#fedc90", "#faf8c0", "#dcf1ec", "#abd6e8", "#76abd0", "#4a74b4", "#4a74b4"],
      "start": 0.0,
      "stop": 1
    },
    {
      "index": "chi",
      "scale": ["#a50026", "#d3322b", "#f16d43", "#fcab63", "#fedc8c", "#f9f7ae", "#d7ee8e", "#a4d86f", "#64bc61", "#23964f", "#23964f"],
      "start": 0.0,
      "stop": 3.0    
    },
    {
      "index": "ndre",
      "scale": ["#a50026", "#d3322b", "#f16d43", "#fcab63", "#fedc8c", "#f9f7ae", "#d7ee8e", "#a4d86f", "#64bc61", "#23964f", "#23964f"],
      "start": 0.0,
      "stop": 1.0
    },
    {
      "index": "savi",
      "scale": ["#a50026", "#d3322b", "#f16d43", "#fcab63", "#fedc8c", "#f9f7ae", "#d7ee8e", "#a4d86f", "#64bc61", "#23964f", "#23964f"],
      "start": 0.0,
      "stop": 1.0    
    },
    {
      "index": "lai",
      "scale": ["#a50026", "#d3322b", "#f16d43", "#fcab63", "#fedc8c", "#f9f7ae", "#d7ee8e", "#a4d86f", "#64bc61", "#23964f", "#23964f"],
      "start": 1.0,
      "stop": 7.0
    },
    {
      "index": "evi",
      "scale": ["#a50026", "#d3322b", "#f16d43", "#fcab63", "#fedc8c", "#f9f7ae", "#d7ee8e", "#a4d86f", "#64bc61", "#23964f", "#23964f"],
      "start": 0.0,
      "stop": 1.0 
    },
    {
      "index": "nirv",
      "scale": ["#A50026", "#D3322B", "#F16D43", "#FCAB63", "#FEDC8C", "#F9F7AE", "#D7EE8E", "#A4D86F", "#64BC61", "#23964F", "#23964F"],
      "start": 100,
      "stop": 2000
    } 
  ]
}

Json

Example Request json

POST https://spacesense-api.ew.r.appspot.com/download/ndwi/json?token=__myToken__&field_name=farm_1

Example Response json

{
    "bounds": [[45.068, 8.59], [45.07, 8.60]]
    "ndvi":[[],[],[]........],
    "mean":0.56,
    "median":0.54,
    "std":
}
← List FilesRegister Webhooks For Notifications →
  • Description
  • Endpoints
  • Method type
  • Parameters
  • Response Details | JSON
  • Responses
  • Examples :
    • Image
    • Color map
    • Json
for Developers
Docs
Supported featuresGuidesAPI Reference
Community
User ShowcaseTwitterLinkedIn
More
SpaceSense.aiGitHub
Facebook Open Source
Copyright © 2022 SpaceSense.ai