2

I have a shapefile which reads its geometry type as "multipatch". I tried to perform the clip function using this layer and it does not work.

How can I convert this multipatch layer into a polygon shapefile?

I am using ArcGIS 10.3.

4

If you have a 3D Analyst license, there is a tool in the 3D Analyst Toolbox called "Multipatch Footprint". Using this tool will

Create polygon footprints representing the two-dimensional area occupied by a multipatch feature class

See tool help at Multipatch Footprint - ArcGIS Desktop Help

You can find the Multipatch Footprint tool in ArcToolbox > 3D Analyst > Conversion > From Feature Class > MultiPatch Footprint

enter image description here

You just point to your Multipatch file as in put and specify an output to save the polygons to.

enter image description here

1

For those who don't have 3D Analyst, here is the python code I'm using as a workaround.

# Initialize the variables (choose your folder and names)
out_path = arcpy.env.workspace
out_name = 'new_layer'
multipatch_layer = <insert_layer_name>

# Select all fields to be present in the output layer as well
# (except FID [created automatically] and Shape [we are constructing it])
fields = [f.name for f in arcpy.ListFields(multipatch_layer) if f.type != 'OID' and f.type != 'Geometry']

# Read the data with a search cursor
data = []
for row in arcpy.da.SearchCursor(multipatch_layer, ['SHAPE@'] + fields):
    for arr in row[0]:
        # At least one element has to be non-vertical for the results to be correct (i.e. conversion to polygon yieds a partCount > 0)
        # If all elements are vertical, arcpy somehow returns the bounding box -> don't add these elements
        if arcpy.Polygon(arr).partCount > 0:

            # Option 1: Union the multipatch with an empty polygon -> converts it to polygon
            poly = row[0].union(arcpy.Polygon(arcpy.Array(None)))

            # Option 2: Take the difference of multipatch with empty polygon -> converts it to polygon
            poly = row[0].difference(arcpy.Polygon(arcpy.Array(None)))

            data.append([poly] + list(row[1:]))
            break      

# Create the output feature class (fields copied from the multipatch_layer)
arcpy.CreateFeatureclass_management(out_path, out_name, 'POLYGON', multipatch_layer)

# Insert the data into the output layer
ic = arcpy.da.InsertCursor(out_name, ['SHAPE@'] + fields)
for row in data:
    ic.insertRow(row)
del ic

Unfortunately, since there is no arcpy documentation for multipatch objects I don't know if it always works; but it did in the cases I was testing. Additionally, I have to say that I'm using ArcGIS pro 2.3 and can only hope that it works in other versions as well.

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.