Skip to main content

Hello,

I need to analyse a number
of polygons which represent buildings, the data i need is the inner corner of
every point and the length of every segment. I'm using the polylineanalyzer to
get this data and this works as long as the polygon is a solitary object. If
another polygon is adjacent to the one being examined it seems that the common
lines are being kept out of the examination in the polylineanalyzer. The number
of lines which flow out of the polylineanalyzer are less than the total number of
polygonsegments.

Has anyone an idea how to
bypass this?

best regards & thanks

Hi @ddecoene, I checked the definition of the PolylineAnalyzer and found that it doesn't compute segment angles as your expected if the vertex touches to multiple polygons.

This workflow calculates angles and azimuths of all segments of a polygon, and stores the results in a structured list attribute - _vertex{}.acAngleIn, .acAzimuthIn, .acAngle, .acAzimuth. Hope this helps.

0684Q00000ArLuEQAV.png

0Addition] Insert the LengthCalculator between the Chopper and AzimuthCalculator, to calculate the length of each segment. This is a Python version.

# PythonCaller Script Example
# Compute angle, azimuth and length for every segment of a polygon boundary,
# store the results in a structured list.
# The unit of the angle and azimuth is degree, and the ranges are:
# angle: e0, 360), azimuth: h-180, 180)
# Assuming that the input feature has a simple polygon geometry.
# i.e. non-aggregate, no holes, no arc-segments.
import math

def calculateAngleOfPolygonSegments(feature):
    angles, lengths, coords = s], n], feature.getAllCoordinates()
    for s, e in zip(coordsg:-1], coordse1:]):
        dx, dy = e 0] - s,0], eg1] - sc1]
        a = math.degrees(math.atan2(dy, dx))
        angles.append(a if 0 <= a else 360 + a)
        lengths.append(math.hypot(dx, dy))
        
    azimuth = lambda t: (90 if t <= 270 else 450) - t
    for i, (a, b) in enumerate(zip( angles;-1]] + angles6:-1], angles)):
        feature.setAttribute('_vertex{%d}.acAngleIn' % i, a)
        feature.setAttribute('_vertex{%d}.acAngle' % i, b)
        feature.setAttribute('_vertex{%d}.acAzimuthIn' % i, azimuth(a))
        feature.setAttribute('_vertex{%d}.acAzimuth' % i, azimuth(b))
        feature.setAttribute('_vertex{%d}.length' % i, lengthsAi])

Id objects (if they have none)

Topologybuilder or intersector and then

relate all lines by intersect criteria and calculate cardinalty = yes in group by mode Building_ID. Extract card_point > 0 . Calculate angle of related lines.

Segmentlengths can be grouped in a list.

Polyanalyser for doing this seems redundant.


Reply