Functions / PostGIS / ST_Letters
PostGISGeometry Constructors

ST_Letters

What is ST_Letters?

ST_Letters is a PostGIS function (added in 3.3) that renders a text string into a MULTIPOLYGON geometry using a built-in Unicode font. The output is a geometry you can treat like any other vector shape — transform, buffer, intersect, or union with the rest of your data.

SQL
ST_Letters(text input, json font = null)geometry

Each letter becomes one polygon (or multipolygon for disjoint glyphs like "i"). The default baseline starts at (0, 0) and letter height is 100 CRS units. The result has SRID 0; use ST_Translate and ST_Scale to position and resize, and ST_SetSRID to pin the CRS.

When would you use ST_Letters?

Use ST_Letters for label geometry inside spatial pipelines — rendering chainable place names, adding text watermarks to vector tiles, or stamping human-readable identifiers directly into geometry outputs:

SQL
1SELECT ST_SetSRID(
2  ST_Translate(
3    ST_Scale(ST_Letters('ATLAS'), 10, 10),
4    500000, 4500000
5  ),
6  3857
7) AS label_geom;

Because the output is a geometry, the letters participate in normal spatial operations — you can union them with a polygon to create cut-outs, difference them against a map feature to produce stencil labels, or simplify them for low-zoom rendering. It is not a replacement for proper cartographic labeling engines, but it is invaluable when text must live in the vector data layer.

FAQs

Can I choose the font?

The default is a built-in Unicode-capable font. The optional font JSON argument lets you pass an alternate font specification, but in practice most users rely on the default. Check the PostGIS manual for supported font configurations.

What size are the letters?

Default height is 100 CRS units with baseline at y=0. Use ST_Scale to resize proportionally before translating into map coordinates.

Does ST_Letters return valid geometry?

The output is usually valid but always run ST_IsValid before combining with other data; kerning edge cases can occasionally produce self-touching rings. Repair with ST_MakeValid if needed.

Which PostGIS version introduced ST_Letters?

PostGIS 3.3. It requires a build with font support compiled in — check SELECT PostGIS_Full_Version(); if the function is missing.