OSMBuilding icon indicating copy to clipboard operation
OSMBuilding copied to clipboard

Feature Request: Integrate OSMBuilding into iD to preview buildings

Open canavan opened this issue 8 months ago • 12 comments

It would be very helpful especially for less experienced users if OSMBuilding could be used to preview building shapes and colors while editing them in the iD editor. Such an integration may be possible using Tampermonkey.

canavan avatar Apr 23 '25 19:04 canavan

You’ve pretty much hit on exactly what I was hoping would happen with this project if it caught on. I imagined it could be used within an online editor or even at the openstreetmap object viewer:

https://www.openstreetmap.org/way/294867466

If the way is a building, it could be rendered right there.

Beakerboy avatar Apr 24 '25 12:04 Beakerboy

This would be a great idea, and since somebody in the OSM community is already building a tampermonkey script for enhancing the OSM.org website, it might be a good idea to talk to this person?

(I don't really know much about tampermonkey and/or this script, but I know it's there and being developed, so I thought I'd mention it!)

mtwente avatar Apr 24 '25 12:04 mtwente

@deevroman is this something you think could work?

Beakerboy avatar Apr 24 '25 12:04 Beakerboy

Looks cool! Maybe I could add this to Rapid. We have had a MapLibre-based 3d viewer for a while now.

https://github.com/facebook/Rapid/discussions/993

I think at this point it doesn’t make sense to add new features to iD, but I am glad to see that it still exists and people like it. I was forcibly removed from the maintainer position in 2020. In the years since then, we have mostly rewritten the code and now Rapid is faster and more stable. Most users really would be better off upgrading from iD to Rapid.

bhousel avatar Apr 24 '25 13:04 bhousel

I looked quickly through the code and I think what we'd really need is just the parts that convert the OSM feature into the mesh. We wouldn't need the parts that download the data, or parse the xml, or render to three.js.

bhousel avatar Apr 24 '25 13:04 bhousel

As already said, the alternative could be the 3D view in Rapid. I'm still afraid to add new functions to iD using userscript. It's safer and easier to fork iD and replace it with a fork.

Speaking of osm.org, I might consider adding a link/hotkey that opens that building viewer.

deevroman avatar Apr 24 '25 14:04 deevroman

The 3D view in Rapid is indeed really close to what I was suggesting, however, it does have some drawbacks compared to OSMBuilding. For example, it doesn't appear to work with the building (relation https://www.openstreetmap.org/relation/4594998) I was testing it with but that ones is ok in OSMBuilding: https://beakerboy.github.io/OSMBuilding/index.html?type=relation&id=4594998

And if I'm not mistaken, it's not working with gabled roofs (but there may be issues in OSMBuilding as well. e.g. https://beakerboy.github.io/OSMBuilding/index.html?id=285102551)

canavan avatar Apr 24 '25 23:04 canavan

The 3D view in Rapid is indeed really close to what I was suggesting, however, it does have some drawbacks compared to OSMBuilding. For example, it doesn't appear to work with the building (relation https://www.openstreetmap.org/relation/4594998) I was testing it with but that ones is ok in OSMBuilding: https://beakerboy.github.io/OSMBuilding/index.html?type=relation&id=4594998

Oh yeah , Rapid's viewer is still very limited - it can only show simple extruded buildings.
It doesn't support multipolygons or roof shapes, or proper meshes like OSMBuilding can generate, but it would be great to improve this.

We have some of these limitations tracked here: https://github.com/facebook/Rapid/issues/1109 https://github.com/facebook/Rapid/issues/1061

bhousel avatar Apr 25 '25 00:04 bhousel

@canavan OSMBuilding must be broken somewhere. Gabled roofs used to work great but I see they are no longer rendering.

Beakerboy avatar Apr 25 '25 11:04 Beakerboy

Is there anything that needs to be done to my codebase to allow someone else to integrate it into their app? If not, I can close this and we can move the conversation into the discussion area.

Beakerboy avatar Apr 25 '25 15:04 Beakerboy

If iD allows you to export the map state to .osm, then it doesn't look so crazy anymore (:

https://github.com/user-attachments/assets/6c330cf1-3453-442a-8c5c-91ccf4f14ef0

Is there anything that needs to be done to my codebase to allow someone else to integrate it into their app?

Merge PRs :)

deevroman avatar Apr 29 '25 02:04 deevroman

Believe this is complete on my side, correct?

Beakerboy avatar Jul 17 '25 15:07 Beakerboy