My question is similar to Merging points (bus stops) in QGIS manually or programmatically?, but it's not answered sufficiently
I have OSM-transit data with bus stops. Some stops have two or more bays for different directions. In this example, the stop 'Steinerstraße' has two points:
I want to merge all points belonging to one stop to one point. I assume that they can be identified by an identical name in the 'name'-column of the attribute table.
Best case would be to create a new point in the middle of the points, however, I'd be satisfied with a simple deletion of the 2nd feature as well.
Can anyone give me a hint how to do it?
I've never used either python nor SQL in a GIS-environment and would prefer a GUI-based solution. However, I'm open for everything (some xp in python and SQL in other contexts).
Answer
Not an easy task, but this way it works for me:
- Load the point layer into QGIS (supposed to be in EPSG:900913, else reproject it to any projected CRS)
- make a copy of the layer
- Install the MMQGIS plugin
- From the Plugins menu, choose
Create Hublines
. Select your two layers, and thename
attribute for both as ID.
After executing, all busstops with the same name are connected with lines. Unfortunately, the points are also connected to themselves, leading to lines of zero length. So:
- Select the hub layer and use
Vector -> Geoprocessing -> Dissolve
with thename
field as Dissolve field, to a new file - Use
Vector -> Geoprocessing -> Buffer
to create a buffer of5
(meters) in a new layer - Use
Vector -> Geometry Tools -> Polygon centroids
to create single points from the buffer polygons
As you can see, it works for single and multiple bus stops:
- remove all previous layers
No comments:
Post a Comment