0

I have had a look at the existing Q&As but none of them seem to be addressing this in detail.

I have a building footprint shapefile which contains a height field. I would like to group buildings according to height and store them in separate layers. For example I would like to iterate a Select By Attribute SQL query that selects any building between 6 and 9 metres or any building <3 metres. There is thousands of building so doing it by hand is rather unpractical.

I don't mind whether ModelBuilder or Python is used to achieve the result but I am quite new to Python.

2

To do this I would create a simple Model Tool in ModelBuilder that

  1. Adds a text field (perhaps named CLASS)
  2. Uses a Calculate Field tool that calculates CLASS based on HEIGHT (if that is the name of your height field) with the Python Parser

def calculate(height):
  if height < 3:
    return "A"
  elif 6 < height < 0.645051:
    return "B"
  else:
    return "X"

CLASS = calculate(!HEIGHT!)

  1. Uses Split By Attribute based on field CLASS to create feature classes named A, B, and X. If your version does not have that tool then there are workarounds in Exporting feature class into multiple feature classes based on field values using ArcGIS Desktop?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.