6

I have a street map where one street(consisting of 2 lanes each) is shown as one line. If I click on that line, there are two objects (one object for each lane) listed like in the following image:

enter image description here

For each object, I do have the From/To Node which gives me the direction of the lane. What I want to do is to assign street signs (which are represented as blue points) to the nearest lane. That is why I need to move both Lane objects in the opposite direction so they approach the proper street sign. In the end, it should look like this.

enter image description here

So, with respect to the direction of the vector, the vector must always be shifted to the right.

Is there some sort of algorithm to achieve this?

As I have to do this which 6000 other streets, I will probably have to write a python script to do this.

Is there a possibility to move curved lines too without converting them to points?

What I have tried so far is a QGIS plugin called "Line Offset" which creates a parallel line of a selected polyline feature at a given distance. I do not know if this plugin solves my problem, but I would like to give it a try. I unchecked all layers in my layer window except the street map layer. Furthermore, I selected (in the attribute table) all objects I want to move. In the plugin's interface, I have the following options set:

enter image description here

But it always stops running and gives me the following error:

enter image description here

Maybe someone has already worked with this plugin and can figure out what I am doing wrong. It says "QgsRasterLayer" object has no attribute.. but isn't my streetmap layer a polyline-layer?

This doesn't make sense to me.


I have selected both the layer and the objects of the layer, but I still get the same error.

enter image description here

7
  • 1
    Did you make sure your vector layer is selected (i.e. highlighted in the Layers Panel) before you ran the plugin?
    – Joseph
    Commented Jan 24, 2018 at 13:09
  • @Joseph, I have indeed selected the layer and the layer objects (on which the plugin should do its work on). But I am still getting the error unfortunately.
    – applebrown
    Commented Jan 24, 2018 at 13:18
  • Try removing the raster layers from the project. Re-highlighting the layer in the layers panel and trying again.
    – HeikkiVesanto
    Commented Jan 29, 2018 at 11:45
  • @applebrown - Before using the Line Offset plugin, you need to make sure your line layer is at the bottom of the layers panel and you need to select the lines in your line layer. Also ensure you are using a projected CRS with metres as units.
    – Joseph
    Commented Jan 29, 2018 at 11:46
  • 1
    For some reason Line Offsest plugin did not work for me in QGIS 2.18.16. Alternatively I used Single sided buffers (and offset lines) for lines tool, which is in the Processing toolbox | GDAL/OGR | [OGR] Geoprocessing. Hope this works for you too. (Just choose Offset curve option for the "Operation" option).
    – Kazuhito
    Commented Jan 29, 2018 at 13:22

1 Answer 1

2

I have been thinking about a similar project involving assigning street signs to a road network, primarily for stop sign and speed limit purposes, but my data is a bit different than yours. I am mostly spit balling here, but I hope it will at least get you somewhere until someone can get you a better answer.

If you are aiming to identify which signs go on which roads. I would suggest using a buffer and a spatial select and avoid shifting lanes all together. I would break all lines (if not already) at each intersection, so you have good topology. That way each road segment goes from intersection to intersection. I would then assign each segment a unique ID (you may already have this, if please disregard). Then buffer all your lines (with a mitered end instead of a rounded one to avoid issues at intersections) and use a union or spatial join to determine which polygon street segment each street sign falls into. I would also recommend performing a spatial join on the street signs to road signs to get a distance measurement for distance from all signs to roads to get an idea of what is a reasonable buffer zone.

Now is where it gets dicey, you will now have each sign assigned to each “piece” of road but you won’t necessarily know which lane it is in. In order to identify which lane segment it is a part of, I would propose using python to parse through your list of street segments. For each segment, I would grab the corresponding signs using a relate from the sign buffer by ID. Then I would take the start and stop point of the road, or treat it as a vector your choice, and compare it to the lat longs of the street signs. Using algebra/math you should be able to identify if the coordinates are on the right side of the vector, and assign that sign to the stream segment, or if it is on the left side in which you would ignore it since it’s on the wrong side of the road. A quick search returned this https://community.esri.com/thread/45581

Alternatively I believe ArcMap has a buffer one side section that should get you most of the way there, but I believe it require an advanced license.

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.