Bug? GeomFromGeoJSON returns null for 2.5D GeometryCollections

59 views
Skip to first unread message

Adrian Batzill

unread,
Feb 8, 2022, 9:16:02 AM2/8/22
to SpatiaLite Users
Hi,
I noticed a strange thing with Spatialite 5.0.1 today:
when calling GeomFromGeoJSON for a 2.5D GeometryCollection, it returns null for some reason.
The individual LineStrings can be read without problems when not having the GeometryCollection around it.
Also, the GeometryCollection seems to parse fine if I remove all the Z coordinates.

Is there any workaround for this?/am I missing something?

Thanks
Adrian

Example call:

SELECT AsText(GeomFromGeoJSON('
{
"type": "GeometryCollection",
"geometries": [
{
"type": "LineString",
"coordinates": [
[
9.05618268003033,
47.8205085371546,
501.0
],
[
9.05592594023042,
47.8202476728863,
501.0
],
[
9.05589510917812,
47.8202621648322,
501.2
]
]
},
{
"type": "LineString",
"coordinates": [
[
9.05601815334443,
47.8203413635765,
501.2
],
[
9.0559909008558,
47.8203542702468,
501.3
]
]
}
]
}
'));
Message has been deleted
Message has been deleted
Message has been deleted

Alessandro Furieri

unread,
Mar 7, 2022, 2:35:41 AM3/7/22
to SpatiaLite Users
I confirm: there was a bug affecting the GeoJSON parser that made
impossible to correctly identify any GeometryCollection of the
3D type lacking an explicit definition of the CRS and/or BBOX.  

possible workaround: just adding the CRS and/or BOOX members
apparently resolves this issue.

since my last commit in the Fossil repository, the GeoJSON parser
has been corrected appropriately.

bye Sandro
Reply all
Reply to author
Forward
0 new messages