Repository navigation
feat: import only the files whose extent a bbox reaches - #223
Merged
Merged
Conversation
A bbox import passed citydb-tool the whole dataset folder, which read and parsed every file and kept the features in the bbox. With a whole provider on disk, every region import cost a full read of the folder, and since the import was recorded against the fingerprint of the whole folder, adding any tile invalidated every region's record. A bbox import now reads each model file's declared extent first: a CityGML boundedBy envelope, searched in the first 16 KiB and then up to 1 MiB, or a CityJSON metadata.geographicalExtent with its referenceSystem. The bbox is transformed into each file's CRS once, and only the intersecting files are passed to citydb-tool, through an argument file. A file without a readable extent or a recognised CRS is always passed, so citydb-tool's own filter decides for it; a bbox no file reaches runs no import. The bbox is recorded against the fingerprint of the selected files alone, and a new record replaces only earlier ones of the same bbox and mode, so tiles added elsewhere leave a region's record valid. A whole-folder import of the current files still covers any bbox. On all 18,297 Bavarian tiles (142 GB) in one folder, a region of about 2 by 1 km selects 4 files and imports in 9 s; a repeat run takes about 1 s, and 3 s after another region was added.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A bbox import passed citydb-tool the whole dataset folder, so with a whole provider on disk every region import read and parsed every file, and adding any tile invalidated every region's import record.
Change
POST /api/v1/runs,-import-data -bbox) reads each model file's declared extent:boundedByenvelope, searched in the first 16 KiB, then up to 1 MiB;metadata.geographicalExtentandreferenceSystem, scanned through the file, as metadata may come afterCityObjects.docs/deployment/adding-data.md;CHANGELOG.md.Tests
TestReadFileExtent(unit): gzipped CityGML with attributes on the corner elements; CityJSON whose metadata extent comes after a CityObject's owngeographicalExtent; files without an extent.TestImportCityDBData_SelectsFilesInTheBbox(integration, fake citydb-tool logging the files it is given):With every file treated as intersecting it fails:
region A: last import got files "a.gml b.gml", want "a.gml".go vet ./...,go test ./..., the integration suites (importer, process, onrequest with real citydb-tool, db, api) andmkdocs build --strictpass.End to end on all 18,297 Bavarian tiles (142 GB) in one folder:
3,873 buildings, every object id once.