{
  "openapi": "3.1.1",
  "info": {
    "title": "GISela Area \u0026 Length API",
    "version": "1.0.0",
    "summary": "True area, perimeter and length of polygons and lines on the WGS 84 ellipsoid, per feature.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://giselaarealength.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "True area, perimeter and length of polygons and lines on the WGS 84 ellipsoid, per feature.",
        "description": "Measures every polygon and line of GeoJSON, KML, GPX, CSV/WKT or shapefile data on the WGS 84 ellipsoid with Karney’s geodesic algorithms — the same numbers as GISela’s measure tool and attribute fields. Holes are subtracted; results in metric or imperial units.\n\nMethodology:\n- Polygon area and perimeter: Karney’s geodesic polygon algorithm (edges are geodesics on WGS 84), outer rings minus holes. Line length: sum of geodesic distances (Karney inverse problem).\n- Input in a projected coordinate system is first converted to WGS 84 longitude/latitude, so the result does not depend on the map projection.\n- Units: 1 ha = 10,000 m², 1 acre = 4046.8564224 m², 1 mi = 1609.344 m, 1 ft = 0.3048 m.\n\nAreas are on the ellipsoid surface (sea level), not along the terrain.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "gisela_area_length",
        "x-owner-app": "gisela",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GiselaAreaLengthInput"
              },
              "examples": {
                "example1": {
                  "summary": "Six districts of a sample town",
                  "value": {
                    "data": "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[7.99,47.12],[8.004,47.1205],[8.0052,47.1303],[7.9891,47.131],[7.99,47.12]]]},\"properties\":{\"name\":\"Altstadt\",\"population\":4820,\"households\":2410,\"zone\":\"mixed\"}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[8.004,47.1205],[8.019,47.1205],[8.0181,47.1303],[8.0052,47.1303],[8.004,47.1205]]]},\"properties\":{\"name\":\"Seefeld\",\"population\":3150,\"households\":1490,\"zone\":\"residential\"}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[8.019,47.1205],[8.033,47.12],[8.0342,47.131],[8.0181,47.1303],[8.019,47.1205]]]},\"properties\":{\"name\":\"Moosmatt\",\"population\":2280,\"households\":1010,\"zone\":\"residential\"}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[7.9891,47.131],[8.0052,47.1303],[8.004,47.1425],[7.99,47.142],[7.9891,47.131]]]},\"properties\":{\"name\":\"Bahnhof\",\"population\":3900,\"households\":2050,\"zone\":\"mixed\"}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[8.0052,47.1303],[8.0181,47.1303],[8.019,47.1425],[8.004,47.1425],[8.0052,47.1303]]]},\"properties\":{\"name\":\"Industrie Nord\",\"population\":640,\"households\":210,\"zone\":\"industrial\"}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[8.0181,47.1303],[8.0342,47.131],[8.033,47.142],[8.019,47.1425],[8.0181,47.1303]]]},\"properties\":{\"name\":\"Rebhalde\",\"population\":1720,\"households\":760,\"zone\":\"residential\"}}]}"
                  }
                },
                "example2": {
                  "summary": "Tram line length in miles",
                  "value": {
                    "data": "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[7.992,47.1215],[7.999,47.126],[8.006,47.129],[8.012,47.1335],[8.018,47.137],[8.025,47.14],[8.031,47.1405]]},\"properties\":{\"name\":\"Line 1\"}}]}",
                    "units": "imperial"
                  }
                },
                "example3": {
                  "summary": "A WKT triangle of about 76 hectares",
                  "value": {
                    "data": "POLYGON ((8 47, 8.0132 47, 8.0066 47.0136, 8 47))"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GiselaAreaLengthResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "GiselaAreaLengthInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "data": {
            "title": "Data",
            "description": "GeoJSON, TopoJSON, KML, GPX, CSV (lat/lon, x/y or a WKT column) or WKT lines. Or upload a file below.",
            "type": "string",
            "maxLength": 5000000,
            "default": ""
          },
          "file": {
            "title": "File (optional)",
            "description": "Used instead of the pasted text. Shapefiles: put .shp, .dbf and .prj into one ZIP. Upload as {filename, contentType?, contentBase64}. Max 19531 KiB. Accepts .geojson,.json,.topojson,.kml,.kmz,.gpx,.csv,.txt,.wkt,.zip.",
            "type": "object",
            "additionalProperties": false,
            "required": [
              "filename",
              "contentBase64"
            ],
            "properties": {
              "filename": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "contentBase64": {
                "type": "string"
              }
            }
          },
          "from": {
            "title": "Coordinate system of the data",
            "description": "“auto” reads it from the file (.prj, GeoJSON crs); otherwise an EPSG code such as 2056, 25832 or 27700. Without information the data is read as WGS 84 longitude/latitude.",
            "type": "string",
            "maxLength": 20,
            "default": "auto"
          },
          "units": {
            "title": "Units",
            "type": "string",
            "enum": [
              "metric",
              "imperial"
            ],
            "default": "metric"
          }
        },
        "required": []
      },
      "GiselaAreaLengthResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object"
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}