3liz / qgis-wfsOutputExtension

QGIS Server plugin to add Output Formats to WFS GetFeature request.
GNU General Public License v2.0
10 stars 6 forks source link

Add FlatGeobuf support #69

Closed rdewit closed 1 year ago

rdewit commented 1 year ago

FlatGeobuf is becoming a popular format and it would be nice to have it available as an output format.

It may be just as simple as adding the following to definitions.py:

    Fgb = Format(
        content_type='application/x-fgb',
        filename_ext='fgb',
        force_crs=None,
        ogr_provider='FlatGeobuf',
        ogr_datasource_options=(),
        zip=False,
        ext_to_zip=(),
    )

Adding the above code block works in our setup (Windows 2019 Server).

Happy to provide a PR if needed.

Gustry commented 1 year ago

Thanks, yes, you can do a PR ;-)

Best serve with a test if possible, there one per format https://github.com/3liz/qgis-wfsOutputExtension/blob/master/tests/test_feature.py

rdewit commented 1 year ago

Thanks @Gustry . I have installed the plugin from git on my Linux system (Ubuntu 23.04) but running make or make test fails for me and it's unclear why. Should I create a separate issue for this?

Here is some output:

rdewit@xps:~/git/3liz/qgis-wfsOutputExtension/tests[master*]$ make
mkdir -p $(pwd)/.local /home/rdewit/git/3liz/qgis-wfsOutputExtension/tests/.cache
docker run --rm --name qgis-wfsoutputextension-test-3.16-13961e1 -w /src/tests \
    -u 1000 \
    -v /home/rdewit/git/3liz/qgis-wfsOutputExtension:/src \
    -v $(pwd)/.local:/.local \
    -v /home/rdewit/git/3liz/qgis-wfsOutputExtension/tests/.cache:/.cache \
    -e PIP_CACHE_DIR=/.cache \
    -e PYTEST_ADDOPTS="" \
    3liz/qgis-platform:3.16 ./run-tests.sh
Creating virtualenv
Installing required packages...
============================= test session starts ==============================
platform linux -- Python 3.8.10, pytest-7.4.0, pluggy-1.2.0 -- /.local/venv/bin/python3
cachedir: .pytest_cache
QGIS : 31616
Python GDAL : 3000400
Python : 3.8.10 (default, Nov 26 2021, 20:14:08) 
[GCC 9.3.0]
QT : 5.12.8
rootdir: /src/tests
configfile: pytest.ini
collecting ... collected 15 items

test_describefeaturetype.py::test_describefeaturetype PASSED             [  6%]
test_feature.py::test_getfeature_gml FAILED                              [ 13%]
test_feature.py::test_getfeature_kml FAILED                              [ 20%]
test_feature.py::test_getfeature_gpkg FAILED                             [ 26%]
test_feature.py::test_getfeature_gpx FAILED                              [ 33%]
test_feature.py::test_getfeature_ods FAILED                              [ 40%]
test_feature.py::test_getfeature_geojson PASSED                          [ 46%]
test_feature.py::test_getfeature_excel FAILED                            [ 53%]
test_feature.py::test_getfeature_csv FAILED                              [ 60%]
test_feature.py::test_getfeature_shapefile FAILED                        [ 66%]
test_feature.py::test_getfeature_tab FAILED                              [ 73%]
test_feature.py::test_getfeature_mif FAILED                              [ 80%]
test_feature.py::test_getfeature_layer_name_with_accent FAILED           [ 86%]
test_feature.py::test_getfeature_geojson_with_selection PASSED           [ 93%]
test_getcapabilities.py::test_getcapabilties FAILED                      [100%]
=========================== short test summary info ============================
FAILED test_feature.py::test_getfeature_gml - AssertionError: assert {'(]~€ >...
FAILED test_feature.py::test_getfeature_kml - TypeError: argument of type 'No...
FAILED test_feature.py::test_getfeature_gpkg - TypeError: argument of type 'N...
FAILED test_feature.py::test_getfeature_gpx - TypeError: argument of type 'No...
FAILED test_feature.py::test_getfeature_ods - TypeError: argument of type 'No...
FAILED test_feature.py::test_getfeature_excel - TypeError: argument of type '...
FAILED test_feature.py::test_getfeature_csv - TypeError: argument of type 'No...
FAILED test_feature.py::test_getfeature_shapefile - TypeError: argument of ty...
FAILED test_feature.py::test_getfeature_tab - TypeError: argument of type 'No...
FAILED test_feature.py::test_getfeature_mif - TypeError: argument of type 'No...
FAILED test_feature.py::test_getfeature_layer_name_with_accent - TypeError: a...
FAILED test_getcapabilities.py::test_getcapabilties - AssertionError: SHP
========================= 12 failed, 3 passed in 1.17s =========================
ERROR 10: Pointer 'hDriver' is NULL in 'GDALGetDriverShortName'.

double free or corruption (!prev)
./run-tests.sh: line 30:    24 Aborted                 (core dumped) pytest -v --qgis-plugins=/src $@
make[1]: *** [Makefile:21: test] Error 134
make[1]: Leaving directory '/home/rdewit/git/3liz/qgis-wfsOutputExtension/tests'
make: *** [Makefile:4: test] Error 2
Gustry commented 1 year ago

Thanks for debugging.

3liz/qgis-platform:3.16

Hum I forgot to remove one reference to QGIS 3.16. I just removed it in the commit fc631b07913dc2d277840f3cc243d63521267ff8

As we can see, the CI is working well https://github.com/3liz/qgis-wfsOutputExtension/commits/master

Can you try to git pull ?

I just tried, it works for me make test either from the git root directory or from the tests directory (what you did).

Let me know, otherwise, I will try to do it.

rdewit commented 1 year ago

Beautiful. That solved it, @Gustry !

test_describefeaturetype.py::test_describefeaturetype PASSED             [  6%]
test_feature.py::test_getfeature_gml PASSED                              [ 13%]
test_feature.py::test_getfeature_kml PASSED                              [ 20%]
test_feature.py::test_getfeature_gpkg PASSED                             [ 26%]
test_feature.py::test_getfeature_gpx PASSED                              [ 33%]
test_feature.py::test_getfeature_ods PASSED                              [ 40%]
test_feature.py::test_getfeature_geojson PASSED                          [ 46%]
test_feature.py::test_getfeature_excel PASSED                            [ 53%]
test_feature.py::test_getfeature_csv PASSED                              [ 60%]
test_feature.py::test_getfeature_shapefile PASSED                        [ 66%]
test_feature.py::test_getfeature_tab PASSED                              [ 73%]
test_feature.py::test_getfeature_mif PASSED                              [ 80%]
test_feature.py::test_getfeature_layer_name_with_accent PASSED           [ 86%]
test_feature.py::test_getfeature_geojson_with_selection PASSED           [ 93%]
test_getcapabilities.py::test_getcapabilties PASSED                      [100%]