-
-
Notifications
You must be signed in to change notification settings - Fork 772
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
Mutipolygon buildings do not work well with 3d terrain, show floating or underground. #3313
Comments
If I needed to guess it has to do with the fact that it probably treats the entire multiploygon with the same elevation. |
I did notice that with the geojson source. in the second example with full planet file it seems to be floating at all zoom levels and they don't jump around like that. I'm not quite sure the difference though since that geojson was pulled from the tile...maybe something to do with being stiched with other tiles in the full planet example. |
Hi, yes, elevation is pulled per feature only once. I dont know if this is a bug or not? More a design decision? Why there is a difference between geojson and normal vectortile, i also dont know. |
@prozessor13 how complicated it would be to split the elevation calculation to be per polygon? |
Hi Harel, it should be simple: https://github.com/maplibre/maplibre-gl-js/blob/main/src/data/bucket/fill_extrusion_bucket.ts#L163
but i am not sure if thats the way to go. Think about multipolygon buildings, like churches or other complex buildings in heavy terrain. |
I see, thanks for the input! |
Thanks! It might be useful to find one counterexample multipolygon building here that you want to retain this behavior. To me it seems like we've got these cases:
Maybe what we're getting at here is the need to explicitly group several |
Ah, did not thought about this, you are right. Changing grabbing elevation for each polygon is definitely worth to try. |
Fixed by #3841 |
When using a planetiler 0.7.0 generated pmtiles file in maplibre-js with 3d terrain enabled, I observed floating buildings and buildings going under the ground. With a file generated with planetiler 0.6.0, this issue did not occur. After discussion on slack in https://osmus.slack.com/archives/C03TFH5NE83/p1698949699781319 , I think this relates to a change in planetiler 0.7.0 which merges buildings with the same tags into a single multipolygon to save space. In 0.6.0 each building was it's own polygon and each was tagged individually.
0.6.0
![image](https://private-user-images.githubusercontent.com/3792408/280444256-df0c2333-00a6-4452-ab50-b6daf5db651a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6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UMDIwNDA1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NGNmOGEyNWQzMTYwYzcxYTMwNTRjMGM2YTRkNjE4OWEzMWM4YzE4MmZkYTY4NjEwMTcyYWYxNWU4NWZkMjMxMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.1wry7-RzS0SYgrqM_9zjzpKPVM0GvOFy48HmY937l4c)
While this could be considered a planetiler issue, I am also not sure that maplibre-js is handling the multipolygon properly with 3d terrain enabled.
For example, I pulled this building geojson out of a planetiler 0.7.0 pbf file with vt2geojson
![multipolygon](https://private-user-images.githubusercontent.com/3792408/280443321-dbaa5152-a7b6-4686-b006-683a2c675ce9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNTMzNDUsIm5iZiI6MTczOTE1MzA0NSwicGF0aCI6Ii8zNzkyNDA4LzI4MDQ0MzMyMS1kYmFhNTE1Mi1hN2I2LTQ2ODYtYjAwNi02ODNhMmM2NzVjZTkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTBUMDIwNDA1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzhiMTAzMDM1YWE3ZjQxZDNlZDc2MjU3ZGM2NTFjOGQxYTg3ZjI1NWU3M2ZhOGU3OWFkNGQxYWEyYWFiYWM5NyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.qqh3bue3GGFDnXslIRifknwmtTqNovpuHaNc5KDxQE8)
vt2geojson --layer building https://tiles.wifidb.net/data/planetiler-0-7-0_pmtiles/14/3094/6569.pbf > 14-3094-6569.geojson
this makes a multipolygon like
14-3094-6569.geojson.txt
If I put that into the maplibre building example I get this stackblitz example page
![floating_buildings](https://private-user-images.githubusercontent.com/3792408/280443382-4f5dec57-caf6-4efd-9b4d-88f3f5345e01.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNTMzNDUsIm5iZiI6MTczOTE1MzA0NSwicGF0aCI6Ii8zNzkyNDA4LzI4MDQ0MzM4Mi00ZjVkZWM1Ny1jYWY2LTRlZmQtOWI0ZC04OGYzZjUzNDVlMDEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTBUMDIwNDA1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZjgxYzdhZWNhZWFkYWFiMTk4NDZmY2U3NmE2NzdmNTZiNzJhNTJlNjUwOGFiMTAwYTc3ZGI1YzQ0NzlkMjBiZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.AuEZfcIcVbUOzQAmUD17K-Ui2ku8JtG3ZUJKxPTx8Mc)
https://stackblitz.com/edit/web-platform-zaxezv?file=index.html
In this example you can see these buildings floating in the zoom 14 range
it looks like they get placed at a height in the center of the multipolygon above, which is much higher than the terrain where the building sits, causing them to float.
I also made this example using a live planetiler 0.7.0 pmtiles file, you can see it looks much worse than the geojson example, with this issue showing past zoom 14
![image](https://private-user-images.githubusercontent.com/3792408/280444013-8a510fea-5338-481a-8395-88466d74b004.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNTMzNDUsIm5iZiI6MTczOTE1MzA0NSwicGF0aCI6Ii8zNzkyNDA4LzI4MDQ0NDAxMy04YTUxMGZlYS01MzM4LTQ4MWEtODM5NS04ODQ2NmQ3NGIwMDQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTBUMDIwNDA1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MmQzMjYxY2EyMTA1NWM1MzFhZjhjOGFmMTc1ODcwZmFlZjY1YzljNTZhNmJiNDk2NzMzZmE5N2Y3OWRjOWMwYSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.n-IqfKz_k2IX5qsIDJ_PyqMFhWuQH9erWIrTuWiQAx0)
https://stackblitz.com/edit/web-platform-qmqmrs?file=index.html
not only do you see building floating, but you also see large groups of buildings completely or partially underground
maplibre-gl-js version: 3.5.2
browser: chrome
The text was updated successfully, but these errors were encountered: