{
  "openapi": "3.1.0",
  "info": {
    "title": "measurements",
    "description": "HTTP-сервис измерений по GeoTIFF-растрам (DEM/thermal), читаемым напрямую из S3/MinIO через GDAL.\n\nВсе эндпоинты — POST под префиксом `/api`. `path` в теле запроса указывается в формате `<bucket>:<путь/к/файлу.tif>`; система координат задаётся строкой `proj` (proj4). Пустой `proj` означает, что точки уже в системе координат растра.\n\nАутентификация (JWT в заголовках `authorization`/`identity`) включается переменной `AUTH=1`.",
    "version": "0.0.1"
  },
  "paths": {
    "/api/point": {
      "post": {
        "summary": "Height/temperature at a single point",
        "description": "Возвращает высоту (h) и/или температуру (t) в одной точке по DEM/термо-растру из S3.",
        "operationId": "point_api_point_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TiffPoint"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "type": "object",
                  "title": "Response Point Api Point Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/points": {
      "post": {
        "summary": "Height/temperature at multiple points",
        "description": "Батч-версия /point: массив высот/температур для списка точек.",
        "operationId": "points_api_points_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TiffPoints"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "type": "object"
                  },
                  "type": "array",
                  "title": "Response Points Api Points Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/profile": {
      "post": {
        "summary": "Elevation profile along a polyline",
        "description": "Профиль высот вдоль ломаной; между вершинами добавляются промежуточные точки.",
        "operationId": "profile_api_profile_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TiffProfile"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "type": "object"
                  },
                  "type": "array",
                  "title": "Response Profile Api Profile Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/volume": {
      "post": {
        "summary": "Volume inside a polygon",
        "description": "Объём внутри полигона. mode=cv2 (по умолчанию) или pillow (DEM-режим, требует > 2 точек).",
        "operationId": "volume_api_volume_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TiffVolume"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "additionalProperties": {
                        "type": "number"
                      },
                      "type": "object"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "title": "Response Volume Api Volume Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/multiple": {
      "post": {
        "summary": "Volume difference between two DEMs",
        "description": "Разница объёмов между master- и slave-растром в пределах полигона.",
        "operationId": "multiple_api_multiple_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TiffMultiple"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "number"
                  },
                  "type": "object",
                  "title": "Response Multiple Api Multiple Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/transform": {
      "post": {
        "summary": "GeoTIFF affine transform",
        "description": "Возвращает 6 коэффициентов GDAL GeoTransform растра.",
        "operationId": "transform_api_transform_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Tiff"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "prefixItems": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "number"
                    }
                  ],
                  "type": "array",
                  "maxItems": 6,
                  "minItems": 6,
                  "title": "Response Transform Api Transform Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/info": {
      "post": {
        "summary": "GeoTIFF metadata",
        "description": "Метаданные растра (размер, проекция, geotransform и т.п.).",
        "operationId": "info_api_info_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Tiff"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "title": "Response Info Api Info Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/statistics": {
      "post": {
        "summary": "Raster min/max statistics",
        "description": "Пара (min, max) значений растра.",
        "operationId": "statistics_api_statistics_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Tiff"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "prefixItems": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "number"
                    }
                  ],
                  "type": "array",
                  "maxItems": 2,
                  "minItems": 2,
                  "title": "Response Statistics Api Statistics Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/bounds": {
      "post": {
        "summary": "Tile bounds by zoom range",
        "description": "Границы тайлов (XYZ) для диапазона zoom_from..zoom_to.",
        "operationId": "bounds_api_bounds_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Tiff"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "items": {
                      "items": {
                        "type": "integer"
                      },
                      "type": "array"
                    },
                    "type": "array"
                  },
                  "type": "object",
                  "title": "Response Bounds Api Bounds Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "Tiff": {
        "properties": {
          "path": {
            "type": "string",
            "title": "Path"
          },
          "zoom_to": {
            "type": "integer",
            "title": "Zoom To",
            "default": 21
          },
          "zoom_from": {
            "type": "integer",
            "title": "Zoom From",
            "default": 14
          }
        },
        "type": "object",
        "required": [
          "path"
        ],
        "title": "Tiff"
      },
      "TiffMultiple": {
        "properties": {
          "master_path": {
            "type": "string",
            "title": "Master Path"
          },
          "slave_path": {
            "type": "string",
            "title": "Slave Path"
          },
          "proj": {
            "type": "string",
            "title": "Proj",
            "default": ""
          },
          "points": {
            "items": {
              "prefixItems": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "type": "array",
              "maxItems": 2,
              "minItems": 2
            },
            "type": "array",
            "title": "Points"
          }
        },
        "type": "object",
        "required": [
          "master_path",
          "slave_path",
          "points"
        ],
        "title": "TiffMultiple",
        "example": [
          {
            "master_path": "geotiff_dems/NTG030521_DEM.tif",
            "points": [
              [
                37.34743572357015,
                55.68881158675471
              ],
              [
                37.347128864435845,
                55.6888704629146
              ],
              [
                37.34719182945381,
                55.68896771656465
              ],
              [
                37.34732057806979,
                55.688942063559054
              ]
            ],
            "proj": "+proj=tmerc +lat_0=0 +lon_0=60.05 +k=1 +x_0=1500000 +y_0=-5911057.63 +ellps=krass +towgs84=23.57,-140.95,-79.8,0,0.35,0.79,-0.22 +units=m +no_defs",
            "slave_path": "geotiff_dems/NTG030521_DEM.tif"
          }
        ]
      },
      "TiffPoint": {
        "properties": {
          "altitude_path": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Altitude Path"
          },
          "temperature_path": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Temperature Path"
          },
          "proj": {
            "type": "string",
            "title": "Proj",
            "default": ""
          },
          "point": {
            "prefixItems": [
              {
                "type": "number"
              },
              {
                "type": "number"
              }
            ],
            "type": "array",
            "maxItems": 2,
            "minItems": 2,
            "title": "Point"
          }
        },
        "type": "object",
        "required": [
          "point"
        ],
        "title": "TiffPoint",
        "example": [
          {
            "altitude_path": "geotiff_dems/ALTITUDE_DEM.tif",
            "point": [
              59.95821631734607,
              57.9660901731621
            ],
            "proj": "+proj=tmerc +lat_0=0 +lon_0=60.05 +k=1 +x_0=1500000 +y_0=-5911057.63 +ellps=krass +towgs84=23.57,-140.95,-79.8,0,0.35,0.79,-0.22 +units=m +no_defs",
            "temperature_path": "geotiff_dems/THERMAL_DEM.tif"
          },
          {
            "point": [
              1494214.348999979,
              516505.3900003205
            ],
            "proj": "",
            "temperature_path": "geotiff_dems/THERMAL_DEM.tif"
          },
          {
            "altitude_path": "geotiff_dems/ALTITUDE_DEM.tif",
            "point": [
              1494214.348999979,
              516505.3900003205
            ],
            "proj": ""
          }
        ]
      },
      "TiffPoints": {
        "properties": {
          "altitude_path": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Altitude Path"
          },
          "temperature_path": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Temperature Path"
          },
          "proj": {
            "type": "string",
            "title": "Proj",
            "default": ""
          },
          "points": {
            "items": {
              "prefixItems": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "type": "array",
              "maxItems": 2,
              "minItems": 2
            },
            "type": "array",
            "title": "Points"
          }
        },
        "type": "object",
        "required": [
          "points"
        ],
        "title": "TiffPoints",
        "example": [
          {
            "altitude_path": "geotiff_dems/ALTITUDE_DEM.tif",
            "points": [
              [
                59.95821631734607,
                57.9660901731621
              ],
              [
                59.95452603553467,
                57.96567474229709
              ],
              [
                59.95563056285039,
                57.966613723012216
              ]
            ],
            "proj": "+proj=tmerc +lat_0=0 +lon_0=60.05 +k=1 +x_0=1500000 +y_0=-5911057.63 +ellps=krass +towgs84=23.57,-140.95,-79.8,0,0.35,0.79,-0.22 +units=m +no_defs",
            "temperature_path": "geotiff_dems/THERMAL_DEM.tif"
          },
          {
            "points": [
              [
                1494221.1549999786,
                516495.86600015266
              ],
              [
                1494214.348999979,
                516505.3900003205
              ]
            ],
            "proj": "",
            "temperature_path": "geotiff_dems/THERMAL_DEM.tif"
          }
        ]
      },
      "TiffProfile": {
        "properties": {
          "path": {
            "type": "string",
            "title": "Path"
          },
          "proj": {
            "type": "string",
            "title": "Proj",
            "default": ""
          },
          "points": {
            "items": {
              "prefixItems": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "type": "array",
              "maxItems": 2,
              "minItems": 2
            },
            "type": "array",
            "title": "Points"
          }
        },
        "type": "object",
        "required": [
          "path",
          "points"
        ],
        "title": "TiffProfile",
        "example": [
          {
            "path": "geotiff_dems/NTG030521_DEM.tif",
            "points": [
              [
                59.95821631734607,
                57.9660901731621
              ],
              [
                59.95452603553467,
                57.96567474229709
              ]
            ],
            "proj": "+proj=tmerc +lat_0=0 +lon_0=60.05 +k=1 +x_0=1500000 +y_0=-5911057.63 +ellps=krass +towgs84=23.57,-140.95,-79.8,0,0.35,0.79,-0.22 +units=m +no_defs"
          },
          {
            "path": "geotiff_dems/BLG_080122_DEM.tif",
            "points": [
              [
                3334617.713961677,
                590691.7743950449
              ],
              [
                3334977.6348458366,
                590688.296080064
              ]
            ]
          }
        ]
      },
      "TiffVolume": {
        "properties": {
          "path": {
            "type": "string",
            "title": "Path"
          },
          "proj": {
            "type": "string",
            "title": "Proj",
            "default": ""
          },
          "level": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Level"
          },
          "points": {
            "items": {
              "prefixItems": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "type": "array",
              "maxItems": 2,
              "minItems": 2
            },
            "type": "array",
            "title": "Points"
          },
          "mode": {
            "allOf": [
              {
                "$ref": "#/components/schemas/VolumeMode"
              }
            ],
            "default": "cv2"
          }
        },
        "type": "object",
        "required": [
          "path",
          "points"
        ],
        "title": "TiffVolume",
        "example": [
          {
            "path": "geotiff_dems/NTG030521_DEM.tif",
            "points": [
              [
                59.95821631734607,
                57.9660901731621
              ],
              [
                59.95452603553467,
                57.96567474229709
              ],
              [
                59.95563056285039,
                57.966613723012216
              ]
            ],
            "proj": "+proj=tmerc +lat_0=0 +lon_0=60.05 +k=1 +x_0=1500000 +y_0=-5911057.63 +ellps=krass +towgs84=23.57,-140.95,-79.8,0,0.35,0.79,-0.22 +units=m +no_defs"
          },
          {
            "mode": "pillow",
            "path": "geotiff_dems/NTG030521_DEM.tif",
            "points": [
              [
                1494221.1549999786,
                516495.86600015266
              ],
              [
                1494214.348999979,
                516505.3900003205
              ]
            ],
            "proj": ""
          }
        ]
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "VolumeMode": {
        "type": "string",
        "enum": [
          "cv2",
          "pillow"
        ],
        "title": "VolumeMode"
      }
    }
  }
}