VFK: Fix solving circle parcel geometry (fixes #8993)
What does this PR do?
It seems that current code generates in some situation wrong shaped parcels. Probably due to unexpected point order which is not in VFK format guaranteed.
Because it is not obvious how to fix current algorithm it was replaces with new one based on solving 3 equations by computing determinant of system. The percentage of circle shaped parcel is very low so computing time is not so important.
The advantage of the solution with determinant is, it does not need to care about points order or their configuration. Only the value of determinant should be tested. If it is too small (the area off 3 point triangle) means invalid configuration. If determinant is too large no reasonable size of circle in case of VFK data.
These situation should be handle in method GetCircleCenterFrom3Points() but it is not clear to me how to do it directly in method.
The fix should be confirm by @landam as the author of original code.
To test the code run:
/usr/local/gdal/test/bin/ogr2ogr --config OGR_VFK_DB_OVERWRITE YES --config OGR_VFK_DB_NAME 616397.db --config OGR_VFK_DB_READ_ALL_BLOCKS N0 -f SHP 616397_PAR.SHP 2020-09-01_sgi/616397.vfk PAR
/usr/local/gdal/test/bin/ogr2ogr --config OGR_VFK_DB_OVERWRITE NO --config OGR_VFK_DB_NAME 616397.db --config OGR_VFK_DB_READ_ALL_BLOCKS N0 616397_PAR.SHP 2020-09-01_spi/616397.vfk PAR
What are related issues/pull requests?
Tasklist
Environment
The circle parcel ID is 1390618203
Code formatting issues:
If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`. To run `pre-commit` as part of git workflow, use `pre-commit install`.
Cf https://gdal.org/development/dev_practices.html#commit-hooks how to install and configure pre-commit
coverage: 68.748% (-0.004%) from 68.752% when pulling 8bcb36c2a05afc8f3d33858a881379c65e882a8a on seidlmic:master into 527b897e632fc83457c9cf0c6a8221a48519c23c on OSGeo:master.
some linting issues remaining: https://github.com/OSGeo/gdal/actions/runs/7308961912/job/19916097431?pr=8995
cf my comment https://github.com/OSGeo/gdal/pull/8995#issuecomment-1868266258 how to solve them automatically
I have installed pre-commit and hopefully fix clang formatting issue
Things look good to me. Hopefully @landam can give it some review too
OK, I'm merging this... There are likely potential optimizations like the one I suggested in https://github.com/OSGeo/gdal/pull/8995#pullrequestreview-1866404386 , but this should be good enough as it for now.