I imported polylines and annotations from DGN file. Polylines are pipelines. Annotation layer contains pipe diameters. There is no common ID's. The goal is to assign diameters from annotation to nearest pipe. Anybody knows how to do that? enter image description here

  • 1
    what GIS software are you using to do this? The method may depend on what you are using. Commented Apr 22, 2016 at 17:01

1 Answer 1


Your best bet to solve this will be to use some version of a spatial join.

There are a couple of ways to make it work, and the best method will depend on your existing data. In both cases, the lines need to have a unique ID. This will enable joining of annotation attributes back to line attributes after spatial join is completed.

  1. Spatial Join from Lines to Annotation: Perform a spatial join operation from the lines to the annotation layer. This should add the attributes of the lines to the closest annotation. Spatial Join to Annotation Note, this will only work if you have lines that are relatively separated and don't get close to overlapping annotation. If lines are too close together, and thus the annotation is close, it may be have the attributes of the wrong line joined to it. Incorrect spatial join to annotation
  2. Spatial join from midpoint of line to annotation: Generate a point layer with the midpoints of the lines in question and their attributes. Do spatial join to annotation using this point layer. This will reduce the likelihood of annotation being assigned incorrect line attributes because one end of the line is too close to the annotation of another line. Spatial join from centroid of line to annotation

The Spatial Join using the midpoint will work best if the annotation is located near the midpoint of the line. This is a common labeling area from CAD systems, so is likely to work. Another common label point is to the midpoint of the first segment of the line. This is something else that can be pulled out with a bit of python wizardry on the line.

As with anything, your mileage may vary. There will need to be an error checking process, especially in areas with a large concentration of lines, like through pump stations or at congested intersections. In general though, this method should give you pretty solid results. This should be a pretty easy operation that may be performed using any of the common GIS packages out there, so no need to specify commands, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.