<@U0A71G31CDV> should I be able to do geometryfrom...
# questions-and-troubleshooting
g
@Rocky should I be able to do geometryfromtext on multipolygons like SELECT *ST_AsText*(*ST_GeometryFromText*( 'MULTIPOLYGON( and if so, can you give me an example of one that would work?
r
Based on the StarRocks documentation, currently, the
GEOMETRY
functions (like
ST_GeometryFromText
and
ST_Polygon
) officially support POINT, LINESTRING, and POLYGON types, as well as a special CIRCLE type. MULTIPOLYGON is not currently supported in StarRocks spatial functions. If you try to use a
MULTIPOLYGON
WKT, it will likely result in an error or a NULL value. Supported Example (POLYGON) If you can represent your data as a single polygon, here is an example of a working query:
Copy code
sql
SELECT ST_AsText(ST_GeometryFromText('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))'));
Why MULTIPOLYGON isn't working StarRocks' spatial engine is primarily optimized for basic shapes to support functions like
ST_Contains
and
ST_Distance_Sphere
. If you have multiple polygons, you would currently need to store them as separate rows or simplify them into a single
POLYGON
if they are contiguous. Summary of Supported WKT Types: * POINT:
POINT (1 1)
* LINESTRING:
LINESTRING (1 1, 2 2)
* POLYGON:
POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))
* CIRCLE:
CIRCLE ((111 64), 10000)
(Center longitude/latitude and radius in meters) If you have a specific use case requiring
MULTIPOLYGON
, I recommend keeping the data in a
VARCHAR
column for storage and performing complex spatial operations in a dedicated GIS tool or using StarRocks'
ST_Contains
on individual polygon components. Referencessql-reference/data-types/README.mdtable_design/StarRocks_table_design.mdsql-reference/data-types/semi_structured/VARIANT.mdknowledge/usage/best-practice.mdsql-reference/data-types/semi_structured/Array.mdsql-reference/sql-functions/spatial-functions/st_point.mddevelopers/type_checker_xml_configuration.mdsql-reference/sql-functions/spatial-functions/st_astext.md
1