ST_GeomFromText (and ST_GeomFromWKB?) cannot create empty geometries

34 views
Skip to first unread message

Pieter Roggemans

unread,
Oct 7, 2023, 5:03:21 AM10/7/23
to SpatiaLite Users
Hello!

It seems that creating empty geometries from WKT doesn't work, they always end up as NULL.

I'm not 100% sure, but I think I noticed the same problem with WKB in the past (spatialite 5.0.1), but it is not so easy to create a trivial test case while it is not possible to use  ST_GeomFromText() for it :-).

Some examples:
SELECT ST_AsText(ST_GeomFromText('POINT EMPTY'));
Result: NULL

SELECT ST_AsText(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY'));
Result: NULL

SELECT ST_IsEmpty(ST_AsText(ST_GeomFromText('POINT EMPTY')));
Result: -1, should be 1

Regards,
Pieter

a.fu...@lqt.it

unread,
Oct 7, 2023, 5:12:59 AM10/7/23
to spatiali...@googlegroups.com
it's simply another of the peculiarities of SpatiaLite; empty
geometries are not supported and are considered NULL

Like it or not, it's something so deeply rooted that any
attempt to modify it would shatter the entire architecture.

bye Sandro

Pieter Roggemans

unread,
Oct 7, 2023, 5:17:39 AM10/7/23
to SpatiaLite Users
OK, I'll look for a way around it...

Op zaterdag 7 oktober 2023 om 11:12:59 UTC+2 schreef a.fu...@lqt.it:
Reply all
Reply to author
Forward
0 new messages