GeomFromEWKB Multi

17 views
Skip to first unread message

Filip Arlet

unread,
Sep 8, 2022, 5:52:30 AM9/8/22
to SpatiaLite Users
I think there is a problem with GeomFromEWKB function. It converts MultiPolygons to Polygons when there is only one polygon in definition. But I cannot insert that Polygon into table defined with MultiPolygon geom type (geom-type or SRID not allowed). It can be quickly tested on any MultiPolygon by calling

GeomFromEWKB(AsEWKB(geometry))

Example of MultiPolygon EWKB:
GeomFromEWKB('01060000A0B38E01000100000001030000800100000005000000CDCCCC4CEB9023C17F6ABC749CC92FC100000000000000004569D6A03E9123C19E6879D473C92FC100000000000000004FF25D7A2E9223C19E6879D473C92FC100000000000000004FF25D7A2E9223C19F6879D479C92FC10000000000000000CDCCCC4CEB9023C17F6ABC749CC92FC10000000000000000')

a.fu...@lqt.it

unread,
Sep 8, 2022, 6:15:45 AM9/8/22
to spatiali...@googlegroups.com
On Thu, 8 Sep 2022 02:52:30 -0700 (PDT), Filip Arlet wrote:
> I think there is a problem with GeomFromEWKB function. It converts
> MultiPolygons to Polygons when there is only one polygon in
> definition. But I cannot insert that Polygon into table defined with
> MultiPolygon geom type (geom-type or SRID not allowed).
>

Hi Filip,

the safest and simplest way in SpatiaLite for avoiding any
simple/multi issue when inserting into a multi<something>
column is to always explicitly call a cast function,
as e.g.

SELECT CastToMulti(GeomFromEWKB(....))

bye Sandro
Reply all
Reply to author
Forward
0 new messages