I'm trying to cast a geography Polygon to a MultiPolygon resulting from a 'geographic' intersection with a circle on Earth of a 10'000m radius, but PostGIS is raising this error when using ST_Multi
on that resulting Polygon:
ERROR: function st_multi(geography) does not exist
LINE 2: ST_Multi(
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
SQL state: 42883
Character: 15
The message is not 100% clear to me, because ST_Multi
does exist as I successfully used it on many other queries on that same database.
So, I have the feeling that it is simply not able to work on a 'geography' polygon (or maybe the error lies somewhere else?).
Here's a minimal reproducible code snippet (postgis 3.1 / postgres 13.1):
SELECT CAST(
ST_Multi(
ST_Intersection(
ST_Simplify(
ST_MakePolygon(
ST_Force2D(
ST_GeomFromGeoJSON(
'{"type":"LineString",
"coordinates":[
[8,48,45],
[8.1,47.2,45],
[8.2,47.3,45],
[8,48,45]
],
"crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'
)
)
),
0.001
),
ST_buffer(
ST_SetSRID(
CAST(ST_MakePoint(8.1, 47.2) AS GEOGRAPHY), '4326'),
10000
)
)
) AS GEOMETRY
);
How would you cast a Polygon to a MultiPolygon in that particular case?
SELECT ST_AsEWKT(ST_Multi(ST_Buffer(ST_GeomFromText('POINT (1 1)',4326),0.1))::geography);