Hi Devs,

I'm using a geojson url from an external service to retrieve features in a plugin.

But this service wants me to set an 'Accept-Encoding' header to be able to retrieve GEOjson (instead of json)...

Is there a way to do this using the QgsVectorLayer-constructor?

I've had a quick look into the code and could not find any header related stuff.

And gdal itself in the geojson driver is not mentioning any headers:
https://gdal.org/drivers/vector/geojson.html
The wfs driver seems to have some file to be able to 'set headers' using a GDAL_HTTP_HEADER_FILE (https://gdal.org/drivers/vector/wfs.html)
but that seems a little overkill.

My last resort off course is to do the request myself using for example a QgsBlockingNetworkRequest (setting the headers), and then feed the geojson to a QgsVectorLayer.

But given REST-full api's nowadays favour content-negotiation via headers over the use of an extension [0] I think gdal/QGIS should maybe be able to set headers in the constructor/context?

Regards,

Richard Duivenvoorde

https://www.baeldung.com/spring-mvc-content-negotiation-json-xml
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to