fix: let -link-pylovo re-link and report already-linked buildings - #155
Merged
Merged
Conversation
-link-pylovo batches only buildings without a building_link row, so a run after a small import touches just the new buildings. Two things were wrong with that. When every building was already linked, the run logged "No LOD2 or LOD3 buildings with footprints found", although the buildings and footprints exist. And nothing could re-link after the PyLovo data changed: the link script deletes and re-inserts the rows of its batch, but the Go batching never gave it a linked building, so the only route was truncating building_link by hand. A run that finds every building linked now says so, with the count, and points at the new -relink flag. `-link-pylovo -relink` batches every building, linked or not (RunPyLovoRelink, GetGridBatches with includeLinked), so the script's delete-and-re-insert recomputes the links against the current PyLovo data. -relink on its own is rejected. The script header and the link docs now say which run re-links. Closes #154
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.
Closes #154.
What
-link-pylovoreports correctly when every building is already linked.-link-pylovo -relinkre-links buildings that already have abuilding_linkrow, for example after the PyLovo data changed.Why
-link-pylovobatches only buildings without abuilding_linkrow. That is deliberate, and it is kept: a run after a small import links just the new buildings. But:No LOD2 or LOD3 buildings with footprints found, although the buildings and their footprints exist;building_linkby hand.How
GetGridBatchestakesincludeLinked. When it is set, the anti-join onbuilding_linkis dropped.RunPyLovoRelinkruns the link withincludeLinked.RunPyLovoLinkBuildis unchanged for its callers: the CLI without-relink, and the on-request server.All N buildings with footprints already have a building_link row. Nothing to link; run -link-pylovo -relink to re-link them.-relinkwithout-link-pylovoexits with an error.docs/code/pylovo-link/index.mdand the README flag table say which run re-links.Tests
TestRunPyLovoLinkBuild_ReportsAlreadyLinked: the second run's warning names already-linked buildings. Fails on main with the footprint message; passes here.TestRunPyLovoRelink_UpdatesExistingLinks: after the PyLovo row a building matched is replaced, a plain run keeps the old link, andRunPyLovoRelinkswitches it to the new one. It fails ifRunPyLovoRelinkkeeps the anti-join (checked by wiring it toincludeLinked=false).TestGetGridBatches_ExcludesAlreadyLinkedBuildingsalso coversincludeLinked: the linked building is back in the batches.go vet, the unit suites and the integration suites pass.Real data (Vienna, Josefstadt; a copy linked over postgres_fdw)
-link-pylovoon the fully linked copy: logsAll 1318 buildings … already have a building_link row; all 1,318 rows keep theircreated_at.-link-pylovo -relink: all 1,318 rows rewritten, identical result: 1,219 matched, 1,198 distinct OSM ids, 15 OSM ids linked to more than one building, 0 changed.