6

I used the "polygon to line" tool from QGIS, to get a line-layer from this polygon-layer:

polygon-layer

Unfortunately this causes overlapping and duplicate lines, after I broke the qgis-export via GRASS into primitive lines (2 vertices). I need to have just one line, because two identical or overlapping lines are causing problems in CityEngine. I found no way to identify those features that are within other longer lines. I know, in QGIS there is a function called "within", but i have no idea if it works with line layers or how to use it.

many thanks in advance

  • Do the polygons align perfectly? ie do adjacent polygons have perfectly aligned vertices? If so it should be somewhat straight forward if not it becomes very much harder. If they do then you should be able to match up and eliminate duplicate line segments. – Mr Purple Sep 24 '14 at 23:02
  • The polygons do align perfectly. I already removed duplicates using GRASS and QGis. Unfortunatly, there are lines completly containing shorter lines, so i got overlapping elements that are not real duplicates. – user6193 Sep 25 '14 at 6:17
  • What do you think to use some postGIS functions like ST_overlaps or ST_equals? – MickyInTheSky Sep 25 '14 at 6:30
  • Looks good, but this is for two layers, isnt it? How can i perform a query for every feature on one layer/table, that compares the particular feature with the rest? – user6193 Sep 25 '14 at 13:08
  • 1
    Okay, got it. I found out, that your purpose works fine. I found out, that my source layer lines are not exactly matching and use the v.clean/snap tool to fix it. – user6193 Sep 27 '14 at 18:23
3

@user6193 question was solved by himself (in the comments)

I found out that my source layer lines are not exactly matching and use the (GRASS) v.clean/snap tool to fix it

More info on v.clean here : https://grass.osgeo.org/grass73/manuals/v.clean.html

The snap tool snaps vertices to another vertex not farther away than thresh. If there is no other vertex within thresh, no snapping will be done. The type option can have a strong influence on the result. A too large threshold and type=boundary can severely damage area topology, beyond repair.

Threshold gives maximum distance to another vertex in map units, for latitude-longitude locations in degree.

Snapped boundaries may need to be cleaned with break,rmdupl,rmsa. If the -c flag is used with v.clean tool=snap, the sequence of break,rmdupl,rmsa is automatically repeated after snapping until no more small angles a left. Additional cleaning with e.g. tool=rmdanglemay be necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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