This documentation is available to agents as Markdown at https://docs.synthesized.io/tdk/latest/user_guide/080_troubleshooting/type_handling/geometric_types.md. For the complete documentation index, see llms.txt.

Geometric Types

Handle PostgreSQL geometric and spatial data types.

Overview

PostgreSQL geometric types include:

  • Point: (x,y) coordinates

  • Line: Linear equations

  • Box: Rectangular boxes

  • Path: Connected points

  • Polygon: Closed paths

  • Circle: Center and radius

Geometric Type Support

Geometric columns can be copied unchanged, or changed with a script.

Common Issues

Issue: Geometric Type Not Preserved

Symptom: Geometric values become NULL or corrupted.

Solution: Copy the column unchanged with the passthrough transformation (available in MASKING mode only):

tables:
  - table_name_with_schema: "public.places"
    transformations:
      - columns: ["location"]
        params:
          type: passthrough

Issue: Cannot Transform Geometric Data

Symptom: "Cannot transform geometric type" errors.

Solution: Use scripting transformer for custom geometric transformations:

transformations:
  - columns: ["location"]  # POINT type
    params:
      type: scripting_transformer
      language: JAVASCRIPT
      script:
        code: |
          (ctx, originalRecord) => {
            // Offset point by random amount
            const location = originalRecord.get("location");
            if (location == null) {
              return location;
            }
            const parts = location.toString().replace('(', '').replace(')', '').split(',');
            const x = parseFloat(parts[0]) + Math.random() * 0.01;
            const y = parseFloat(parts[1]) + Math.random() * 0.01;
            return '(' + x + ',' + y + ')';
          }

PostGIS Spatial Types

For PostGIS extension (geography, geometry):

Enable PostGIS Support

-- Check PostGIS is installed
SELECT PostGIS_Version();

Preserve Spatial Data

tables:
  - table_name_with_schema: "public.locations"
    transformations:
      - columns: ["geom"]  # geometry/geography column
        params:
          type: passthrough