Give 3D buildings that have 0m height data a random height between 2 values
Closed this issue · 2 comments
Hey awesome team, I'm trying to attribute buildings that have 0m value for height, with a height value of a random number between two values. I appreciate your help!
hi @messiosmarios , thanks for the issue.
You can replace buildings with no height with a single value, but unfortunately not a random value (see https://github.com/heremaps/harp.gl/blob/master/@here/harp-datasource-protocol/StyleExpressions.md for the list of available expressions, but we could definitely add this).
In your style file, you need to go to the extruded-polygon
technique and change the height to something like: "height": ["case", ["<=", ["get", "height"], 0], 1000, ["get", "height”]]
(I set it to 1000 just so you can see it works, but you can change to whatever value you want in meters).
I.e. here is the height value defined:
you would need to change this to what I mentioned above.Does that help?
hi @messiosmarios , thanks for the issue.
You can replace buildings with no height with a single value, but unfortunately not a random value (see https://github.com/heremaps/harp.gl/blob/master/@here/harp-datasource-protocol/StyleExpressions.md for the list of available expressions, but we could definitely add this).
In your style file, you need to go to the
extruded-polygon
technique and change the height to something like:"height": ["case", ["<=", ["get", "height"], 0], 1000, ["get", "height”]]
(I set it to 1000 just so you can see it works, but you can change to whatever value you want in meters).I.e. here is the height value defined:
you would need to change this to what I mentioned above.
Does that help?
Hey @nzjony thank you for that! It works perfectly. Just a small note, the last height word in the command uses the wrong quotation mark ("height”) -> "height"