[QGIS-Developer] How to encode blobs in (Geo)JSON?
Alessandro Pasotti
apasotti at gmail.com
Thu Nov 7 09:44:48 PST 2019
On Thu, Nov 7, 2019 at 6:36 PM Even Rouault <even.rouault at spatialys.com>
wrote:
> On jeudi 7 novembre 2019 17:40:08 CET Alessandro Pasotti wrote:
> > Hi,
> >
> > I'm running into an issue with OAPIF and blob/binary fields, the
> > QgsJsonExporter does not currently handle that kind of field and just
> > convert them to string (whatever that means).
> >
> > This is clearly wrong in case the blob does not contain ascii or UTF-8, I
> > think the way to go might be to base64 the blob but I'd like to know if
> > anyone has a better idea.
>
> Initially, I was going to suggest perhaps to wrap it inside an object with
> an
> explicit base64 member
>
> like:
>
> "my_binary_property": {
> "base64": "...."
> }
>
> But after looking at
> https://json-schema.org/latest/json-schema-validation.html#rfc.section.8.3
> https://json-schema.org/latest/json-schema-validation.html#rfc.section.8.6
>
> perhaps just putting it at top level ( "my_binary_property":
> "base64contenthere" } is fine as you can tag this string property with
> "contentEncoding": "base64"
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
>
Thank you and Renè for the feedback!
Are you talking about the schema ?
this is the geojson payload I'm testing with:
{
"geometry": {
"coordinates": [[
7.247,
44.814
]],
"type": "MultiPoint"
},
"properties": {
"blob_1": "dGVzdA=="
},
"type": "Feature"
}
}
Full tests are here:
https://github.com/qgis/QGIS/pull/32694/files#diff-2ea9f4a74bb6c60e8e586fbc9ad808a2R522
--
Alessandro Pasotti
w3: www.itopen.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20191107/6349f303/attachment.html>
More information about the QGIS-Developer
mailing list