Re: [QGIS-Developer] QgsJsonUtils does not parse fields - bug or a feature?

2020-07-23 Thread Aron Gergely

Thanks Nyall, I reproduced that GDAL issue.
It seems to be the culprit in my case as well!

On 23/07/2020 11:12, Nyall Dawson wrote:

On Thu, 23 Jul 2020 at 18:01, Áron Gergely  wrote:

Hi list,

I am parsing a larger (about 200k characters) GeoJSON FeatureCollection string 
via QgsJsonUtils.stringToFields().
It contains polygon features, each with many coordinate pairs.
Despite the string being valid GeoJSON, no fields are returned.


Quite possibly you're hitting this recently fixed GDAL bug:
https://github.com/OSGeo/gdal/issues/2787

Does that sound possible to you?

Nyall


--
Email Signature Kind Regards,

Aron Gergely
+31 (0) 6 38 70 97 66

*Rasterra* | www.rasterra.nl 
<>___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] QgsJsonUtils does not parse fields - bug or a feature?

2020-07-23 Thread Nyall Dawson
On Thu, 23 Jul 2020 at 18:01, Áron Gergely  wrote:
>
> Hi list,
>
> I am parsing a larger (about 200k characters) GeoJSON FeatureCollection 
> string via QgsJsonUtils.stringToFields().
> It contains polygon features, each with many coordinate pairs.
> Despite the string being valid GeoJSON, no fields are returned.
>

Quite possibly you're hitting this recently fixed GDAL bug:
https://github.com/OSGeo/gdal/issues/2787

Does that sound possible to you?

Nyall
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] QgsJsonUtils does not parse fields - bug or a feature?

2020-07-23 Thread Áron Gergely

Hi list,

I am parsing a larger (about 200k characters) GeoJSON FeatureCollection 
string via QgsJsonUtils.stringToFields().

It contains polygon features, each with many coordinate pairs.
Despite the string being valid GeoJSON, no fields are returned.

However, if I save the string to a .geojson file and open it as vector 
layer, it opens with the attribute fields.


I am working with both QGIS 3.10.8 and 3.14.1 on Ubuntu.
Here is a simplified example of the GeoJSON structure:

{
    "features": [
    {
    "geometry": {
    "coordinates": [
    [
    [
    0.0,
    1.0
    ],
 .
                 .
 .
    [
    0.0,
    1.0
    ]
    ]
    ],
    "type": "Polygon"
    },
    "id": "abcd",
    "type": "Feature",
    "properties": {
    "attrib_a": "a text",
    "attrib_b": 1
    }
    }
    ],
"type": "FeatureCollection"
}


I found that if I do either of the below steps before calling 
QgsJsonUtils.stringToFields(), it does return the fields:


 *   significantly reduce the number of coordinate pairs
 *   Change the order of objects so that "type"  is ahead of "geometry"
   in the features.

I looked at the unit tests of QgsJsonUtils but only short geojson 
strings are tested there..


So it looks like large geometry objects in the GeoJSON feature would 
prevent reading its fields... unless "type" is parsed before them?


Is this buggy behavior? Or am I missing something?

Should I open an issue on GitHub?



Best regards,
Aron
<>___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer