{
  "openapi": "3.1.1",
  "info": {
    "title": "GISela Shapefile to GeoJSON API",
    "version": "1.0.0",
    "summary": "Turn a zipped shapefile (.shp, .dbf, .prj) into GeoJSON in WGS 84 or another coordinate system.",
    "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://giselashapefiletogeojson.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Turn a zipped shapefile (.shp, .dbf, .prj) into GeoJSON in WGS 84 or another coordinate system.",
        "description": "Reads a zipped ESRI shapefile with GISela’s own parser — points, lines, polygons with holes, multipoints, Z/M records flattened to 2-D — with its attribute table (dBASE, code page from .cpg or the header) and the coordinate system from the .prj file, and writes GeoJSON. Several shapefiles in one ZIP give several files.\n\nMethodology:\n- The ZIP is unpacked in memory (stored and DEFLATE entries). Files with the same base name form one shapefile.\n- .shp records are read after the ESRI technical description: Point, MultiPoint, PolyLine and Polygon with their Z and M variants (Z and M are dropped). Polygon rings are sorted into outer rings (clockwise) and holes (counter-clockwise) and nested by point-in-polygon tests.\n- .dbf: dBASE III field types C, N/F, L and D; text decoded with the .cpg code page, else the header’s language driver id, else UTF-8 when it decodes cleanly, else Windows-1252.\n- .prj: EPSG AUTHORITY codes first, then well-known ESRI names (UTM, ETRS89, Gauss–Krüger, LV95, British National Grid, Web Mercator), then Transverse Mercator parameters.\n\nMultiPatch (3-D surfaces) and coordinate systems outside GISela’s list are not supported; such files are reported, not guessed.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "gisela_shapefile_to_geojson",
        "x-owner-app": "gisela",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GiselaShapefileToGeojsonInput"
              },
              "examples": {
                "example1": {
                  "summary": "Districts of a sample town (LV95 shapefile) to WGS 84",
                  "value": {
                    "file": {
                      "filename": "districts.zip",
                      "contentType": "application/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Do5WcvYwtDQw1o73CbM0VdJxd/V3B4kCiXiojJKOi2NIqG+0kgtCJDjAwzXI39MlWskptbg4NSfe0MLEUEnHzNjc3NjSXM/Q1FTHyNISSBtZGBpZxMbqBAR5+roCzXAvSk3NK89MzlDSMdAziNUJ9fMMAZqcmg4UBwsZmpuYGhtZGpkaWlqaGBuDtfp7uTqHePr7RSt55Jdk5qXG+yflZBaWpsb7phYlJ5bkF8U7VmXmlpZkxDun5pWkFikBNTkGOfq6hrgGRSu5JeYUp8a7JhYDtaYr6RiZGYAAyHIMRX75RSUZYFWGRthUBScn5qTGuyUmA+0EqkGThTpCSccSXZ9Pfl56ZklpCtDlaTA36pjrmRhbmloYwwGqlsQSDB0mZnqWpkYmBqZQYAYLP99UsDzIQbEAUEsDBBQAAAgIAAAAIQBQPIEOBwAAAAUAAAANAAAAZGlzdHJpY3RzLmNwZwsNcdO1AABQSwECFAAUAAAICAAAACEAJCysIkwBAACUAwAADQAAAAAAAAAAAAAAAAAAAAAAZGlzdHJpY3RzLnNocFBLAQIUABQAAAgIAAAAIQAJMKFYSQAAAJQAAAANAAAAAAAAAAAAAAAAAHcBAABkaXN0cmljdHMuc2h4UEsBAhQAFAAACAgAAAAhAGUNE3zMAAAAbgEAAA0AAAAAAAAAAAAAAAAA6wEAAGRpc3RyaWN0cy5kYmZQSwECFAAUAAAICAAAACEAiiYOYzoBAADYAQAADQAAAAAAAAAAAAAAAADiAgAAZGlzdHJpY3RzLnByalBLAQIUABQAAAgIAAAAIQBQPIEOBwAAAAUAAAANAAAAAAAAAAAAAAAAAEcEAABkaXN0cmljdHMuY3BnUEsFBgAAAAAFAAUAJwEAAHkEAAAAAA=="
                    }
                  }
                },
                "example2": {
                  "summary": "Same shapefile kept in LV95",
                  "value": {
                    "file": {
                      "filename": "districts.zip",
                      "contentType": "application/zip",
                      "contentBase64": "UEsDBBQAAAgIAAAAIQAkLKwiTAEAAJQDAAANAAAAZGlzdHJpY3RzLnNocGNgUOdiwAoYT71gZmB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SXM/Q1FTHyNISSBtZGBpZxMbqBAR5+roCzXAvSk3NK89MzlDSMdAziNUJ9fMMAZqcmg4UBwsZmpuYGhtZGpkaWlqaGBuDtfp7uTqHePr7RSt55Jdk5qXG+yflZBaWpsb7phYlJ5bkF8U7VmXmlpZkxDun5pWkFikBNTkGOfq6hrgGRSu5JeYUp8a7JhYDtaYr6RiZGYAAyHIMRX75RSUZYFWGRthUBScn5qTGuyUmA+0EqkGThTpCSccSXZ9Pfl56ZklpCtDlaTA36pjrmRhbmloYwwGqlsQSDB0mZnqWpkYmBqZQYAYLP99UsDzIQbEAUEsDBBQAAAgIAAAAIQBQPIEOBwAAAAUAAAANAAAAZGlzdHJpY3RzLmNwZwsNcdO1AABQSwECFAAUAAAICAAAACEAJCysIkwBAACUAwAADQAAAAAAAAAAAAAAAAAAAAAAZGlzdHJpY3RzLnNocFBLAQIUABQAAAgIAAAAIQAJMKFYSQAAAJQAAAANAAAAAAAAAAAAAAAAAHcBAABkaXN0cmljdHMuc2h4UEsBAhQAFAAACAgAAAAhAGUNE3zMAAAAbgEAAA0AAAAAAAAAAAAAAAAA6wEAAGRpc3RyaWN0cy5kYmZQSwECFAAUAAAICAAAACEAiiYOYzoBAADYAQAADQAAAAAAAAAAAAAAAADiAgAAZGlzdHJpY3RzLnByalBLAQIUABQAAAgIAAAAIQBQPIEOBwAAAAUAAAANAAAAAAAAAAAAAAAAAEcEAABkaXN0cmljdHMuY3BnUEsFBgAAAAAFAAUAJwEAAHkEAAAAAA=="
                    },
                    "to": "EPSG:2056"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GiselaShapefileToGeojsonResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "GiselaShapefileToGeojsonInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "file": {
            "title": "Shapefile (ZIP)",
            "description": "A ZIP with at least the .shp file; .dbf (attributes), .prj (coordinate system) and .cpg (text encoding) are read when present. Upload as {filename, contentType?, contentBase64}. Max 19531 KiB. Accepts .zip,application/zip.",
            "type": "object",
            "additionalProperties": false,
            "required": [
              "filename",
              "contentBase64"
            ],
            "properties": {
              "filename": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "contentBase64": {
                "type": "string"
              }
            }
          },
          "from": {
            "title": "Coordinate system of the shapefile",
            "description": "“auto” = from the .prj file. Without a .prj the coordinates are read as WGS 84 unless you give an EPSG code.",
            "type": "string",
            "maxLength": 20,
            "default": "auto"
          },
          "to": {
            "title": "Write GeoJSON in",
            "description": "RFC 7946 GeoJSON is WGS 84; other systems are written with the older “crs” member.",
            "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"
          }
        },
        "required": []
      },
      "GiselaShapefileToGeojsonResult": {
        "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"
              }
            }
          }
        }
      }
    }
  }
}