kekscom / osmbuildings

OSM Buildings Classic 2.5D
http://osmbuildings.org
BSD 2-Clause "Simplified" License
505 stars 140 forks source link

How to create buildings with complex shapes? #41

Closed Krb686 closed 10 years ago

Krb686 commented 11 years ago

I know this is a work in progress but I think this could benefit greatly from some better documentation on how exactly this is done. I've looked just about everywhere and cannot figure out how to create a building with another substructure on the top of it.

I'm using a GeoJson data set, and one feature looks like this:

        "type": "Feature",
        "geometry": {
            "type": "Polygon",
            "coordinates": [[
                [-77.306579, 38.830296],
                [-77.306628, 38.830375],
                [-77.306715, 38.830340],
                [-77.306970, 38.830706],
                [-77.306890, 38.830737],
                [-77.306931, 38.830819],
                [-77.306579, 38.830947],
                [-77.306244, 38.830440],
                [-77.306579, 38.830296],
                [-77.30666, 38.830418],
                [-77.306774, 38.830585],
                [-77.306615, 38.830639],
                [-77.306501, 38.830460],
                [-77.30666, 38.830418]

            ]]
        },
        "properties": {
            "name": "David King Hall",
            "wallColor": "rgb(217,22,48)",
            "roofColor": "rgb(158, 147, 122)",
            "height": 20,
            "minHeight":"10"
        }
    }

The last 5 coordinates are the smaller substructure, that are supposed to be on top of the outer structure. As you can see I've used minHeight. All this does is create a smaller structure inside the larger one. Again, yet to see any good documentation on GeoJson data sets, and what all of the possible options are.

Do I literally have to create a new feature and specify its own minHeight and height to place it hovering in the air? I'd rather not do that, cause I'm using leaflet-search to index all my features, and I don't want random blocks indexed everywhere.

kekscom commented 10 years ago

Not sure where my reply has been gone to :-) From what I can say, one polygon makes one block of equal height. In theory you could mis-use multipolygons for that, but thats not what GeoJSON is designed for. And I don't see OSM Buildings allowing that.

Option is to allow general 3D models, COLLADA may be a format...

Krb686 commented 10 years ago

Hey allowing 3D models sounds cool.

But when I opened this ticket, I knew there was already a way to specify the shapes that I needed at the time.

For instance, how was the cylindrical shape on the top of St. Paul's Church specified here? Really I just wanted to know how it was already done since it's poorly documented, not that I was requesting some sort of new feature.

screenshot

kekscom commented 10 years ago

Got it :-) It's basically multiple related polygon objects from OSM or alike data. You can specify a min_height (height over ground) for each in oder to stack them. => http://wiki.openstreetmap.org/wiki/Key:min_height

In your case, you need to split the GeoJSON, one feature without and the other one with minHeight set.