-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FlatGeobuf driver #1742
FlatGeobuf driver #1742
Conversation
0b8cdba
to
3578c7d
Compare
d365b68
to
9decad5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a partial and at a skyscrapper height review...
It wouldn't hurt to test the robustness of the driver against corrupted/hostile files,by running oss-fuzz run locally. Some instructions in fuzzers/README.TXT. You'll need to modify https://github.com/google/oss-fuzz/blob/master/projects/gdal/Dockerfile in your clone to point to the git URL of your GDAL fork. |
Thanks for the review @rouault, it's fair enough it's at high level for now. |
73811bf
to
626b543
Compare
Rebased and squashed. Remains to put it through oss-fuzz and probably other as of yet unknown shortcomings but otherwise ready for further scrutiny. :) |
I'll be at FOSS4G and might have time to hack on this there and if anyone interested want to join in or discuss don't hesitate to make contact. 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI errors should also be addressed
You mean that not even empty geometries like "GEOMETRYCOLLECTION EMPTY" are not supported? I know that they are nasty to handle but they still tend to appear in real world data. But if it's documented then users can select for example GeoPackage for delivering such data. |
@jratike80 I don't want to support geometry collections either :) However I have reconsidered null geoms and it is possible in the now stable spec. As for "empty" it should be equivalent to null as geometry type is given. I agree, limitations should be clearly documented. |
We considered a few years ago how to express empty geometries in OpenJUMP and we ended up to support all possible variations: POINT EMPTY, MULTIPOINT EMPTY etc. I think that the idea was something like to support "this feature does not have geometry yet, but once it is digitized it will be POINT" GEOMETRYCOLLECTION EMPTY was selected to mean just any empty geometry. I am pretty sure that this is off-topic in context of your innovative flat buffer format and driver. |
d77a1b6
to
81e3c62
Compare
bool m_hasM = false; | ||
bool m_hasZ = false; | ||
bool m_hasT = false; | ||
bool m_hasTM = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what means m_hasTM ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TM stands for "time measurement" introduced by the discussion at flatgeobuf/flatgeobuf#6 (comment). Note that T is for geodetic decimal year time, also discussed on that same issue. May be a futile attempt to support something not yet standardized. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, when compared to https://lists.osgeo.org/pipermail/proj/2019-August/008806.html, I guess T would be the "Epoch of Expression" , and TM the "Epoch of Observation". In any case adding somewhere a comment to explain the semantics wouldn't hurt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems right yes. It's somewhat documented uptream at https://github.com/bjornharrtell/flatgeobuf/blob/master/src/fbs/feature.fbs but deserve something more public if this becomes useful.
8c65498
to
be41b9e
Compare
For For ```./flatbuffers/base.h:354:1: error: unknown attribute 'no_sanitize' ignored [-Werror,-Wattributes] supress_ubsan("alignment") ^ ./flatbuffers/base.h:238:50: note: expanded from macro 'supress_ubsan' #define supress_ubsan(type) attribute((no_sanitize(type)))
or test for a minimum gcc / clang version For https://ci.appveyor.com/project/OSGeo/gdal/builds/27188300/job/or3lqhsxi570t0nb, missing cast For https://ci.appveyor.com/project/OSGeo/gdal/builds/27188300/job/43yd0vh885ws1f9u, |
a71341c
to
18303cf
Compare
Thanks the the help @rouault. I have been able to fix all of them and a few more cases but still have one failing build job at https://travis-ci.com/OSGeo/gdal/jobs/232126400 (BUILD_NAME=trusty_clang DETAILS="optimized build, no libtool") which again I have trouble interpreting what is actually wrong. |
The failure on gcore/vrt_read.py::test_vrt_shared_no_proxy_pool in trusty_clang is indeed a bit weird, and likely unrelated to your changes, so probably some 'random' issue that triggers due to the test suite being a bit different now. |
c0db9ce
to
0e7656f
Compare
ah sorry about that. Not obvious at first sight with of google/oss-fuzz vs oss-fuzz/oss-fuzz is the official repo. But indeed oss-fuzz/oss-fuzz is indicated as a fork... |
54e9840
to
0626feb
Compare
test_ogrsf -all_drivers leaks
|
auto org = crs->org(); | ||
auto code = crs->code(); | ||
auto wkt = crs->wkt(); | ||
m_poSRS->SetAuthority(nullptr, org->c_str(), code); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is likely useless. A SRS with just an authority node is invalid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm ok, the idea was to handle the case where org is something other than EPSG and no WKT is supplied and as such cannot be imported by the logic that follows.
The attached oss-fuzz generated file causes leaks
|
oss-fuzz sure is fun stuff :) |
Getting a timeout in fuzzing when calculating tree size, I thought it would go away with bounds checking introduced in 2b8dedf but it appears not to. Error is like follows:
Is there any way to find out what arguments is seemingly causing the algorithm at https://github.com/bjornharrtell/gdal/blob/2b8dedf3dfb75e5b9385633695d440c844cb6f3f/gdal/ogr/ogrsf_frmts/flatgeobuf/packedrtree.cpp#L310-L324 to go into an infinite loop or is it just that it tries it with so many permutations that it takes forever? |
It should normally generate a file that reproduces the issue in ./build/out/gdal/. |
Of course! 🤦 |
Not getting any errors from oss-fuzz anymore but the run never stops, left it running for more than 3 hours when the latest line it outputted was: #50736769 REDUCE cov: 2154 ft: 2775 corp: 103/54Kb lim: 4096 exec/s: 4107 rss: 95Mb L: 537/3120 MS: 2 ChangeBit-EraseBytes- Mabye it needs to be put though the real oss-fuzzer now. |
@bjornharrtell OK, if you're happy with this, I can merge it. |
@rouault I'm happy and hope it is in good enough shape for real world use. I will take care of it in the future to the best of my ability. |
I guess that the document page that is referred to in the code is to come because I could not find it yet: |
Good observation. Up to now we provided URIs to the old static HTML pages. Probably here we should provide as URI "drivers/vector/flatgeobuf.html" |
What does this PR do?
This PR implements initial support for FlatGeobuf (read/write) and is more or less feature complete. See https://github.com/bjornharrtell/flatgeobuf for more information about the format.
Tasklist
Known weaknesses