Skip to main content
Question

Neighbors at angle


deanhowell
Influencer
Forum|alt.badge.img+23

I have lines in a cad drawing that have labels that represent the line length. This label is not always the closest label to the line but is normally parallel to the line.

Is there a way to find labels that share the same angle as the line?

4 replies

redgeographics
Celebrity
Forum|alt.badge.img+50

Sort of... if the text label has a rotation attribute you can use that. Chop the lines into single segments and calculate their angles using the HorizontalAngleCalculator and then run them through the Neighborfinder. I would not match on the angle attribute directly, in case the values are slightly different but rather select the neighboring label whose angle is closest to the line segment's angle.

Which, depending on the local situation, may still not be the right one...


Forum|alt.badge.img+2

@deanhowell2009 This is one of our earliest demos at Safe! Originally done in a 'mapping file' (pre-workbench) and was also presented as CAD Woman in our FME 2011 World Tour!

But... Before you go this route, check that there is not something else you can use to identify the text such as color, style, layer etc. I've attached the original demo and data. Workspace and sample data: CAD to GIS - something from nothing.fmwt


deanhowell
Influencer
Forum|alt.badge.img+23
  • Author
  • Influencer
  • June 2, 2019
markatsafe wrote:

@deanhowell2009 This is one of our earliest demos at Safe! Originally done in a 'mapping file' (pre-workbench) and was also presented as CAD Woman in our FME 2011 World Tour!

But... Before you go this route, check that there is not something else you can use to identify the text such as color, style, layer etc. I've attached the original demo and data. Workspace and sample data: CAD to GIS - something from nothing.fmwt

Thanks @markatsafe, it is very close to what I need but picking up labels a long way from the line even when a label exists very close. This is only happening in a small number of cases so might be more related to that I have multiple line features coming into the reader.


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • June 3, 2019

@deanhowell2009

 

Hi,

 

Assuming that the labels are derived from the lines.

It is clearly visible in the data that the labels have a igds_element_id (string) which is 1 more than the igds_element_id of the line (

So basically you can simply use a featuremerger and have igds_element_id = igds_element_id-1 (or visa versa; as you prefer)

 

 

You end up, in your sample data with some that can't merge or are suppliers that are not used. This might be, because you have a sample data, due to relevant pieces missing.

Also multi label pieces where the line seem to be dissolved and information destroyed. (this can be countered by not dissolving or keeping the paths.)

 

 

result:

(purple and red are not merged)


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings