Select to view content in your preferred language

Deleting small faces/polygons in multipatch datasetts and issues with multipatch footprint

928
1
Jump to solution
01-20-2022 01:01 AM
Labels (1)
AndreasLorentzen
Regular Contributor

Hi,

Problem:

I've noticed that several times when i use the CAD to Geodatabase tool and get a multipatch feature it works quite well, utill i use the "Multipatch footprint" tool to create a 2D version of said multipatch feature.

What happens is that the tool sometimes create squares (extent areas?) around certain features, normally when they are really thin (See figure):

AndreasLorentzen_1-1642668760844.png

 

in cad file: 

AndreasLorentzen_0-1642668457722.png

 

Possible Culprit:

It seems like the culprit is small/ vertical (?) poly-faces that bugs up in the tool. I have no other ideas.

Solution:
The best solution would be to remove all multipatch-features or poly-faces smaller or thinner that some critical value. However, i do not know of any tool, method of doing this, does anyone have an idea?

I am also open for arcpy-solutions.

Another solution is of-course to remove all square features later by analyzing either squareness or Areal to border ratio. However, i hope there is a somewhat better method.

Another question:
Is there any word of when we can get the possibility to write and read  multipatch-geometry in arcpy? or any help-files on this topic?

0 Kudos
1 Solution

Accepted Solutions
AndreasLorentzen
Regular Contributor

As nobody replied, i had to fix it.

What causes the problem?:
thin/vertical elements in the multipatch dateset. When using multipatch footprint, the tool cant create a polygon with vertices on top of each other, and therefore creates a bounding box.

How to implement a fix
So the solution is to remove all squares, taking advantage that bounding-boxes always has the two first vertices share X coordinate and the second and third share Y-coordinate.
Note that you cant use the "group by" option for this to work.

Code

number_of_squares_removed = 0
with arcpy.da.UpdateCursor(in_table=in_features, field_names=["SHAPE@"]) as cur:
for row in cur:
try:
array = row[0].getPart(0)
if len(array) == 5: # the fifth is the first again...
#print(str([f"({x.X},{x.Y})" for x in array]))
if round(array[0].X,1) == round(array[1].X,1) and round(array[1].Y,1) == round(array[2].Y,1):
number_of_squares_removed += 1
#print("Deleted")
cur.deleteRow()
except:
print("WARNING: COULD NOT CHECK AND DELETE FROM SQUARE")

View solution in original post

0 Kudos
1 Reply
AndreasLorentzen
Regular Contributor

As nobody replied, i had to fix it.

What causes the problem?:
thin/vertical elements in the multipatch dateset. When using multipatch footprint, the tool cant create a polygon with vertices on top of each other, and therefore creates a bounding box.

How to implement a fix
So the solution is to remove all squares, taking advantage that bounding-boxes always has the two first vertices share X coordinate and the second and third share Y-coordinate.
Note that you cant use the "group by" option for this to work.

Code

number_of_squares_removed = 0
with arcpy.da.UpdateCursor(in_table=in_features, field_names=["SHAPE@"]) as cur:
for row in cur:
try:
array = row[0].getPart(0)
if len(array) == 5: # the fifth is the first again...
#print(str([f"({x.X},{x.Y})" for x in array]))
if round(array[0].X,1) == round(array[1].X,1) and round(array[1].Y,1) == round(array[2].Y,1):
number_of_squares_removed += 1
#print("Deleted")
cur.deleteRow()
except:
print("WARNING: COULD NOT CHECK AND DELETE FROM SQUARE")
0 Kudos