transform-coordinates
Convert spatial coordinates between systems using WKT geometry, source SRID, and target SRID for accurate mapping and analysis with the PostGIS MCP Server.
Instructions
Koordinat sistemini dönüştür
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| geometry_wkt | Yes | WKT formatında geometri | |
| source_srid | Yes | Kaynak koordinat sistemi SRID | |
| target_srid | Yes | Hedef koordinat sistemi SRID |
Implementation Reference
- server.js:352-376 (handler)Executes the transform-coordinates tool: validates input using TransformCoordinatesSchema, runs PostGIS ST_Transform query to convert geometry from source_srid to target_srid, returns transformed WKT and GeoJSON.case "transform-coordinates": { const { geometry_wkt, source_srid, target_srid } = TransformCoordinatesSchema.parse(args); const result = yield client.query(` SELECT ST_AsText(ST_Transform(ST_GeomFromText($1, $2), $3)) as transformed_wkt, ST_AsGeoJSON(ST_Transform(ST_GeomFromText($1, $2), $3)) as transformed_geojson, $2 as source_srid, $3 as target_srid `, [geometry_wkt, source_srid, target_srid]); const response = { original_geometry: geometry_wkt, source_srid: source_srid, target_srid: target_srid, transformed_wkt: result.rows[0].transformed_wkt, transformed_geojson: JSON.parse(result.rows[0].transformed_geojson), }; return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; }
- server.js:44-48 (schema)Zod schema defining input parameters for the transform-coordinates tool: geometry_wkt (string), source_srid (number), target_srid (number).const TransformCoordinatesSchema = zod_1.z.object({ geometry_wkt: zod_1.z.string(), source_srid: zod_1.z.number(), target_srid: zod_1.z.number(), });
- server.js:145-157 (registration)Registers the transform-coordinates tool in the ListTools response, including name, description, and input schema matching the Zod schema.{ name: "transform-coordinates", description: "Koordinat sistemini dönüştür", inputSchema: { type: "object", properties: { geometry_wkt: { type: "string", description: "WKT formatında geometri" }, source_srid: { type: "number", description: "Kaynak koordinat sistemi SRID" }, target_srid: { type: "number", description: "Hedef koordinat sistemi SRID" }, }, required: ["geometry_wkt", "source_srid", "target_srid"], }, },