Click on your picture in the top right corner, go to Edit Profile and select your notification preferences.

Please keep in mind:

1. To only comment on the topic where the discussion is about. Do you have a new question or topic? Please start a new discussion.

2. Be kind to other users!

# A few first steps towards calculating with walls

The Tygron Platform is optimized for spatial calculation based on 2D data. Constructions are polygons, water stress we model on a grid, and even points and lines are (unless they are abstract concepts) converted to polygons through buffering. However, sometimes you might find you want to approach a certain challenge from a different direction. It's encouraged to think outside the box, as most problems really can be solved, albeit perhaps in a slightly more roundabout way.

What if you need to know the exposed walls of a construction?

For context, a question from @jpueyo came up regarding vertical gardens. Using the walls of a construction to plant gardens and provide green-related benefits to the environment. His use-case had 2 manageable constraints:

- A vertical garden should
*only*count the walls of a construction. Not the full lotsize. - A vertical garden cannot function if that wall is right up against another construction.

We can approach the definition of a wall with a bit of 2D math. Imagine we have a generic polygon. We want to know approximately how much edge this box has.

However, we cannot query the line directly. What we can do, is draw a slightly larger box around it.

If we know exactly how much larger the second box is, we can:

Subtract the smaller box from the larger box, leaving us with a line with an approximately fixed width.

Divide the surface area of the line by that fixed width, to obtain the approxiate length of the line.

So that would give us the an approximation of the circumference of the box we started with.

We can automatically create such a box using a distance zone in Tygron. Try the following steps:

- Add a construction to your project, and draw it somewhere in the 3D world
- Add an attribute "WALL_DISTANCE" to the construction, with a value of 2
- Add a Distance Zone Overlay to the project, and set it's distance key (the attribute it's looking for) to WALL_DISTANCE
- Set the grid size to 2 meters
- Notice that the overlay highlights the cosntruction red (distance = 0), and an area around it green (distance is more than 0). There's your line! You can query the surface area of that line by using the following query:
- SELECT_LANDSIZE_WHERE_GRID_IS_3_AND_MINGRIDVALUE_IS_0.1
- Divide the result by 2 (the width we've configured for the distance zone), to get a fair approximation of the length of the walls.

My construction was 50m by 50m, which should have an edge of 400m. This method gixes 416, which isn't exact, but is a reasonable approximation.

So for a free-standing construction, this can help approximate the length of walls. Looking at the second constraint, the walls should not be up against another construction. If we say that "2 meters" is too close by, then we're already haldway there. Because we can easily query how much of the surface area of the land that we find is in fact occupied by another construction:

SELECT_LOTSIZE_WHERE_GRID_IS_3_AND_MINGRIDVALUE_IS_0.1

So try the following:

- Run the following query SELECT_LOTSIZE_WHERE_GRID_IS_3_AND_MINGRIDVALUE_IS_0.1, and note that the resullt is 0.
- Now add another construction to the project, right up to one of the walls of your first construction.
- Rerun the query, and you will see some lotsize was found.
- Subtracting this found lotsize from the total landsize of the entire line, yields only as much line as _isn't_ blocked by aother construction.

Now, this approach isn't complete yet. What if the construction is next to a road? or a park? You'll have to fine-tune the query so that only the "blocking" functions or categories are found. But this I leave as an excersize to the reader ;).

See if you can recreate these steps, and experiment from there!

Sprawling spreadsheets so intricate Alexander the Great cuts them in half.