kekscom / osmbuildings

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

Feature Collection geometries with same long/lat coordinates only draws first geometry regardless of minHeight #44

Closed NightmaresWithin closed 11 years ago

NightmaresWithin commented 11 years ago

I've noticed that geometries that consist of the exact same long/lat coordinates only draw the first geometry. These geometries, of course, do have the proper minHeight/height properties set. This seems like a bug.

example of non-functioning issue: var geoJSON = { "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [[ [-82.66179263591766, 27.887153515841682], [-82.66148686408997, 27.887272052051173], [-82.66126692295074, 27.886987564930365], [-82.661492228508, 27.886887994261496], [-82.66179263591766, 27.887153515841682] ]] }, "properties": { "wallColor": "rgb(255,0,0)", "roofColor": "rgb(255,128,0)", "height": 20, "minHeight": 0 } }, { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [[ [-82.66179263591766, 27.887153515841682], [-82.66148686408997, 27.887272052051173], [-82.66126692295074, 27.886987564930365], [-82.661492228508, 27.886887994261496], [-82.66179263591766, 27.887153515841682] ]] }, "properties": { "wallColor": "rgb(255,0,0)", "roofColor": "rgb(255,128,0)", "height": 40, "minHeight": 20 } }] }; var twostory = osmb.setData(geoJSON);

but changing a single digit of percision in each subsequent geometry will output proper results (second geometry, first long is altered): var geoJSON = { "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [[ [-82.66179263591766, 27.887153515841682], [-82.66148686408997, 27.887272052051173], [-82.66126692295074, 27.886987564930365], [-82.661492228508, 27.886887994261496], [-82.66179263591766, 27.887153515841682] ]] }, "properties": { "wallColor": "rgb(255,0,0)", "roofColor": "rgb(255,128,0)", "height": 20, "minHeight": 0 } }, { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [[ [-82.66179263591765, 27.887153515841682], [-82.66148686408997, 27.887272052051173], [-82.66126692295074, 27.886987564930365], [-82.661492228508, 27.886887994261496], [-82.66179263591766, 27.887153515841682] ]] }, "properties": { "wallColor": "rgb(255,0,0)", "roofColor": "rgb(255,128,0)", "height": 40, "minHeight": 20 } }] }; var twostory = osmb.setData(geoJSON);

Thanks for looking. :)

kekscom commented 11 years ago

For identifying objects, I either take a property id or the first lon/lat pair as reference. I could incorporate height/minHeight for the latter case, or you just add an id.

NightmaresWithin commented 11 years ago

Thanks for the information, although I've attempted to add "id": "Floor_x" property to each Feature to no avail. I've also tried on Geometry and both.

kekscom commented 11 years ago

Feature properties are the right place for id, but it shouldn't be just Floor_n as it's not unique over all buildings. That should work then. Anyway, I'm going to take height into account too.

Am 01.08.2013 um 16:55 schrieb Nightmares Within notifications@github.com:

Thanks for the information, although I've attempted to add "id": "Floor_x" property to each Feature to no avail. I've also tried on Geometry and both.

— Reply to this email directly or view it on GitHub.

NightmaresWithin commented 11 years ago

Thanks. :) I've even generated GUID's for the id property and was not able to get it to work. Thanks again for looking into this and what you've done is very impressive. :)

kekscom commented 11 years ago

Thanks too :-) I've testet an id property and it worked fine. However, by latest commit 32fd63e2663d6772757c0a0799ad89458c2dbb3d it also takes height and minHeight into account. There could be extremely rare cases with adjacent buildings where this happens again.

You need to do a build yourself for the moment.