Skip to content

Fix crash when processing type=building with outline being a multipolygon#124

Merged
Beakerboy merged 3 commits intoBeakerboy:mainfrom
deevroman:support-multipolygon-outline
May 8, 2025
Merged

Fix crash when processing type=building with outline being a multipolygon#124
Beakerboy merged 3 commits intoBeakerboy:mainfrom
deevroman:support-multipolygon-outline

Conversation

@deevroman
Copy link
Copy Markdown
Contributor

@deevroman deevroman commented May 7, 2025

fix #88
https://beakerboy.github.io/OSMBuilding/?type=relation&id=19046126 It doesn't work for two reasons

  1. In this relation, all members are relations. The API call /full does not load the child relations recursively, so we do not get nodes. getExtends() then returns a bbox spanning the entire world, and /map fails.

  2. But that's not all. The current implementation of buildShape() doesn't take into account that inner can be open ways individually, but together form a ring. This is only taken into account for outer ways, so I moved this logic into the makeRings() function, and call it to get both outerShapes and innerShapes

This problem looks like this:

Before

After

And I wrote a test that tests the downloading of child relations and checks that the correct number of holes are created in the building.

Visually the test looks like this:

@Beakerboy Beakerboy merged commit 3a31a0e into Beakerboy:main May 8, 2025
2 checks passed
Beakerboy added a commit that referenced this pull request Jun 4, 2025
* Split data downloading and building creating (#118)

* Outer building visibility (#119)

* Visibility (#120)

* Update building.js (#121)

* Tests for API (#122)

* check HTTP code status and show alert with error

* tests for API errors

* Show validation errors  (#123)

* show validation errors + tests

* fix typo

* Skip incompleted ways, skip non-way members, prevent global modification of way object (#100)

* skip non-way members, skip incompleted ways, prevent global modification of Document with way

* add test

* better colors for MeshPhysicalMaterial (#126)

* Fix crash when processing type=building with outline being a multipolygon (#124)

* #88 initial support type=building with multipolygon outline

* support multiple ways in inner rings

* add test

* Hipped roof (#128)

* Update BuildingShapeUtils.js (#129)

* Update BuildingShapeUtils.js (#130)

* Update utils.test.js (#132)

---------

Co-authored-by: Roman Deev <roman.deev06@gmail.com>
Beakerboy added a commit that referenced this pull request Jun 8, 2025
* Update BuildingShapeUtils.js

* Update utils.test.js

* Update utils.test.js

* Update buildingpart.test.js

* Update BuildingShapeUtils.js

* Update buildingpart.test.js

* Update from main (#133)

* Split data downloading and building creating (#118)

* Outer building visibility (#119)

* Visibility (#120)

* Update building.js (#121)

* Tests for API (#122)

* check HTTP code status and show alert with error

* tests for API errors

* Show validation errors  (#123)

* show validation errors + tests

* fix typo

* Skip incompleted ways, skip non-way members, prevent global modification of way object (#100)

* skip non-way members, skip incompleted ways, prevent global modification of Document with way

* add test

* better colors for MeshPhysicalMaterial (#126)

* Fix crash when processing type=building with outline being a multipolygon (#124)

* #88 initial support type=building with multipolygon outline

* support multiple ways in inner rings

* add test

* Hipped roof (#128)

* Update BuildingShapeUtils.js (#129)

* Update BuildingShapeUtils.js (#130)

* Update utils.test.js (#132)

---------

Co-authored-by: Roman Deev <roman.deev06@gmail.com>

* Update building.test.js

* Update buildingpart.js

* Fixed direction bug (#136)

* Update utils.test.js

---------

Co-authored-by: Roman Deev <roman.deev06@gmail.com>
Beakerboy added a commit to Mosaic-NFT/OSMBuilding that referenced this pull request Jun 11, 2025
* Hipped roof (Beakerboy#128)

* Update BuildingShapeUtils.js (Beakerboy#129)

* Update BuildingShapeUtils.js (Beakerboy#130)

* Update utils.test.js (Beakerboy#132)

* Dev (Beakerboy#137)

* Update BuildingShapeUtils.js

* Update utils.test.js

* Update utils.test.js

* Update buildingpart.test.js

* Update BuildingShapeUtils.js

* Update buildingpart.test.js

* Update from main (Beakerboy#133)

* Split data downloading and building creating (Beakerboy#118)

* Outer building visibility (Beakerboy#119)

* Visibility (Beakerboy#120)

* Update building.js (Beakerboy#121)

* Tests for API (Beakerboy#122)

* check HTTP code status and show alert with error

* tests for API errors

* Show validation errors  (Beakerboy#123)

* show validation errors + tests

* fix typo

* Skip incompleted ways, skip non-way members, prevent global modification of way object (Beakerboy#100)

* skip non-way members, skip incompleted ways, prevent global modification of Document with way

* add test

* better colors for MeshPhysicalMaterial (Beakerboy#126)

* Fix crash when processing type=building with outline being a multipolygon (Beakerboy#124)

* Beakerboy#88 initial support type=building with multipolygon outline

* support multiple ways in inner rings

* add test

* Hipped roof (Beakerboy#128)

* Update BuildingShapeUtils.js (Beakerboy#129)

* Update BuildingShapeUtils.js (Beakerboy#130)

* Update utils.test.js (Beakerboy#132)

---------

Co-authored-by: Roman Deev <roman.deev06@gmail.com>

* Update building.test.js

* Update buildingpart.js

* Fixed direction bug (Beakerboy#136)

* Update utils.test.js

---------

Co-authored-by: Roman Deev <roman.deev06@gmail.com>

* Update README.md

* Update building.test.js

* Update building.test.js

* Update building.test.js

* Update building.js

* Update building.js

* Update building.js

* Update building.js

* Update building.js

* Update building.js

---------

Co-authored-by: Roman Deev <roman.deev06@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash when processing type=building with outline being a multipolygon

2 participants