agentsvc.io

services / satellite-compare

visualoperational · 291 ms

Satellite Before/After Comparison (NASA)

Before/after satellite comparison of the same area on two dates from NASA GIBS true-color imagery (MODIS or VIIRS, about 250 m per pixel): one side-by-side JPEG with date labels plus pixel-based change metrics (share of changed pixels, brightness change) and a cloud, haze and snow estimate for each date, with a plain-language reading that says whether the change is likely real or just weather. For floods, wildfires and burn scars, drought and lake levels, snow cover, deforestation or construction at regional scale. Params: place ("Valencia, Spain") or lat + lon + radius_km (5 to 500, default 50) or bbox, date_before (default one year before date_after), date_after (default yesterday), layer, width (64 to 768 per image, default 384), include_separate.

Run free trial ↗1 free call per day with the example input. Paid: $0.015 USDC, no limit.

Call it

import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agentsvc.io/api/v1/proxy/satellite-compare", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"lat":-18.75,"lon":-67.1,"radius_km":50,"date_before":"2014-05-10","date_after":"2016-05-10","width":256}),
});
const { data, payment } = await res.json();  // payment.transaction = on-chain receipt

Input

FieldTypeDescription
bboxarray
latnumber
lonnumber
radius_kmnumber = 50
layermodis_terra | modis_aqua | viirs_snpp | viirs_noaa20 = "modis_terra"
widthinteger = 384Width of each of the two images; the composite is 2 x width + 8 px
placestringPlace name instead of coordinates, e.g. "Valencia, Spain" (GeoNames, cities and towns)
date_beforestringYYYY-MM-DD, default 365 days before date_after
date_afterstringYYYY-MM-DD, default yesterday
include_separateboolean = falseAlso return both images separately as base64

Output

FieldTypeDescription
image_base64string
mime_typestring
widthinteger
heightinteger
layoutstring
bboxobject
date_beforestring
date_afterstring
layerstring
layer_idstring
changeobject
size_bytesinteger
attributionstring
notestring

Example response (data)

{
  "image_base64": "/9j/2wBDAAYEBAUEBAYFBQUG…",
  "mime_type": "image/jpeg",
  "width": 520,
  "height": 264,
  "layout": "side_by_side: left = date_before, right = date_after, date labels on top",
  "bbox": {
    "min_lat": -19.2005,
    "min_lon": -67.5757,
    "max_lat": -18.2995,
    "max_lon": -66.6243
  },
  "date_before": "2014-05-10",
  "date_after": "2016-05-10",
  "layer": "modis_terra",
  "layer_id": "MODIS_Terra_CorrectedReflectance_TrueColor",
  "change": {
    "mean_brightness_change_pct": 7.3,
    "changed_pixels_pct": 20.1,
    "before": {
      "cloud_or_snow_pct": 0.5,
      "cloud_haze_or_snow_pct": 8.6,
      "no_data_pct": 13,
      "mean_brightness": 42.6
    },
    "after": {
      "cloud_or_snow_pct": 6.4,
      "cloud_haze_or_snow_pct": 18.3,
      "no_data_pct": 0,
      "mean_brightness": 49.8
    },
    "reliable": true,
    "reading": "Visible change in part of the area (for example water level, burn scars, flooding, snow or fields). Check the image."
  },
  "size_bytes": 22150,
  "attribution": "NASA EOSDIS GIBS / Worldview",
  "note": "Daily true-color mosaics at about 250 m per pixel. Change metrics are computed from pixels and are indicative only; seasons, sun angle, clouds and smoke all count as change."
}