Solved

Calculate length of a polygon

  • 8 March 2016
  • 8 replies
  • 32 views

Badge +6

Hello world,

Okay so I have a layer of highway resurfacing schemes, every scheme is represented by a polygon and contains the usual attributes including a USRN (unique street reference number). I also have a polyline dataset of highway centerlines, every centerline has a USRN. If I cut the highway centerline dataset using the clipper transformer using the polygon dataset as the clipper, outputs a clipped line dataset with the merged attributes. As centerlines from intersecting roads are also included I can exclude these by a simple query where USRN <> clipped_USRN and run a total length calculation.

However the polygons from the highway resurfacing scheme layer overlaps in places and the clipper only outputs a single level i.e. it doesn't stack/duplicate lines (one for each scheme) and the merged attributes contains only the details from one scheme. Anybody have the solution to this problem? I've tried tweaking the parameters and tried pushing the clipped centerline files into a spatial relator but no luck so far. Also tried the CentreLineReplacer with no luck.

icon

Best answer by mark2atsafe 8 March 2016, 19:46

View original

8 replies

Userlevel 2
Badge +12

I think the LineonAreaOverlayer will give you all line - area combinations and will clip on the area boundaries. It will also merge the atributes.

Badge +3

You can use a spatialrelator first and then use a clipper in groupby mode (use the result from spatialrelator to create groupby attribute.)

The you can use statisticcalculator to sum the lengths, again in groupby mode.

Userlevel 4
Badge +25

Yes, LineOnAreaOverlayer. Use the Generate List option and follow up with a ListExploder (Attribute Accumulation = Only Use Incoming List). That should do what you need.

I created an example - you can download it here

Badge +6

You can use a spatialrelator first and then use a clipper in groupby mode (use the result from spatialrelator to create groupby attribute.)

The you can use statisticcalculator to sum the lengths, again in groupby mode.

Thanks for this, however the spatial relator still outputs a single level of centerlines?

Badge +6

Yes, LineOnAreaOverlayer. Use the Generate List option and follow up with a ListExploder (Attribute Accumulation = Only Use Incoming List). That should do what you need.

I created an example - you can download it here

Thanks for this however i'm using FME version 2014. I've played around with the list generation in the LineOnAreaOverLayer followed by a list explorer howver not entirely sure what i'm doing with this.

Badge +6

I think the LineonAreaOverlayer will give you all line - area combinations and will clip on the area boundaries. It will also merge the atributes.

Thanks for this however it still outputs a single level of centerlines?

Badge +6

Thanks everyone for your contributions. The key was to create a bespoke list parameter in the LineOnAreaOverlayer transformer followed by the ListExploder Transformer. A tester was then employed to exclude Centerline segments where the centerline.USRN <> the matched polygon USRN. Using the Aggregator transformer I was able to calculate the total length for each scheme by merging the centerline segments on the unique scheme ID, in this instance the ogc_fid.

Thanks,

Chris

Userlevel 2
Badge +12

Thanks for this however it still outputs a single level of centerlines?

Yes, but if you use the list option, the list will contain the attributes of all overlapping polygons the line segment is in.

Reply