{
  "openapi": "3.1.1",
  "info": {
    "title": "GISela Coordinate Reprojection API",
    "version": "1.0.0",
    "summary": "Convert GeoJSON, KML, GPX, CSV or shapefiles between WGS 84, UTM, LV95, British Grid and more.",
    "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://giselareproject.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Convert GeoJSON, KML, GPX, CSV or shapefiles between WGS 84, UTM, LV95, British Grid and more.",
        "description": "Reprojects vector data between coordinate systems with GISela’s own projection maths: WGS 84, ETRS89, Web Mercator, every UTM zone, ETRS89-LAEA, German Gauss–Krüger zones, Swiss LV95/LV03 and the British National Grid. Reads the coordinate system from .prj files and GeoJSON, and shows sample coordinates before and after.\n\nMethodology:\n- The data is read into WGS 84 longitude/latitude, then projected to the target system. Readers: GeoJSON (also the old “crs” member), TopoJSON (arcs decoded with the transform), KML/KMZ, GPX, CSV with coordinate or WKT columns, WKT and zipped shapefiles with .prj detection by EPSG authority, name or Transverse Mercator parameters.\n- Transverse Mercator (UTM, Gauss–Krüger, British National Grid) uses Karney’s 6th-order Krüger series on the system’s own ellipsoid; ETRS89-LAEA uses the ellipsoidal Lambert azimuthal equal-area formulas of IOGP Guidance Note 7-2; LV95/LV03 use swisstopo’s rigorous oblique Mercator formulas; Web Mercator uses the spherical formulas on the WGS 84 radius.\n- Datum changes (OSGB 1936, DHDN, CH1903/CH1903+) go through geocentric coordinates with a published 7-parameter Helmert transformation. ETRS89 is treated as equal to WGS 84 (well under 1 m in Europe).\n- Outputs are rounded to 8 decimals for degrees and 3 decimals (millimetres) for metres.\n\nHelmert datum shifts are good to about 1–5 m. For survey work use the national grid transformations (OSTN15, BeTA2007, FINELTRA).",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "gisela_reproject",
        "x-owner-app": "gisela",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GiselaReprojectInput"
              },
              "examples": {
                "example1": {
                  "summary": "Tram stops (WGS 84) to Swiss LV95",
                  "value": {
                    "data": "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":[7.992,47.1215]},\"properties\":{\"name\":\"Weiher\"}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":[7.999,47.126]},\"properties\":{\"name\":\"Altstadt\"}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":[8.006,47.129]},\"properties\":{\"name\":\"Marktplatz\"}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":[8.012,47.1335]},\"properties\":{\"name\":\"Bahnhof\"}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":[8.018,47.137]},\"properties\":{\"name\":\"Nordring\"}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":[8.025,47.14]},\"properties\":{\"name\":\"Rebhalde\"}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":[8.031,47.1405]},\"properties\":{\"name\":\"Endstation Ost\"}}]}",
                    "to": "EPSG:2056"
                  }
                },
                "example2": {
                  "summary": "Five bus stops in LV95 (CSV with E/N columns) to WGS 84",
                  "value": {
                    "data": "stop;E;N;boardings\nBus Seefeld;2643240;1219692;640\nBus Moosmatt;2643899;1219730;410\nBus Nordwest;2642892;1220545;380\nBus Industrie;2643559;1220628;720\nBus Rebhalde;2644031;1220442;290\n",
                    "from": "2056",
                    "to": "EPSG:4326",
                    "format": "csv"
                  }
                },
                "example3": {
                  "summary": "District polygons to ETRS89-LAEA (equal-area Europe)",
                  "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\"}}]}",
                    "to": "EPSG:3035"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GiselaReprojectResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "GiselaReprojectInput": {
        "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"
          },
          "to": {
            "title": "Convert to",
            "description": "Other zones: type the code below.",
            "type": "string",
            "enum": [
              "EPSG:4326",
              "EPSG:4258",
              "EPSG:3857",
              "EPSG:3035",
              "EPSG:2056",
              "EPSG:21781",
              "EPSG:27700",
              "EPSG:31466",
              "EPSG:31467",
              "EPSG:31468",
              "EPSG:31469",
              "EPSG:25831",
              "EPSG:25832",
              "EPSG:25833"
            ],
            "default": "EPSG:4326"
          },
          "toOther": {
            "title": "Or another EPSG code",
            "description": "For example 32633 (WGS 84 / UTM 33N) or 25831. Overrides the list when filled.",
            "type": "string",
            "maxLength": 20,
            "default": ""
          },
          "format": {
            "title": "Output format",
            "type": "string",
            "enum": [
              "geojson",
              "csv",
              "wkt"
            ],
            "default": "geojson"
          }
        },
        "required": []
      },
      "GiselaReprojectResult": {
        "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"
              }
            }
          }
        }
      }
    }
  }
}