Geographic Information Systems Asked by yadigar3851 on March 10, 2021
I need to measure the direct distance between busstops in meters, not taking roads/networks into account.
I have the WGS 84 Coordinates + globalIDs for 28.000 pairs.
I already imported the Busstops from a csv (UTF-8) into a point layer.
My previous atempts:
Distance Matrix doesn´t work, because of the huge data size 28.000 x 28.000 is too much “waste” data and the operation fails…
“Point Connector” tool just creates “lines” without any measurments
The output should be 28.000 Lines with the distance in meters in a CSV, or just simply the measurment in m for every busstop relation.
Any ideas?
Not sure I understand you but if you have the table you show you could try using pyqgis to calculate distance:
layer = iface.activeLayer() #Click layer/table in tree. I have a excel table
#https://gis.stackexchange.com/questions/266360/pyqgis-when-we-search-based-on-the-distance-between-two-points-is-the-measurem
distance = QgsDistanceArea()
distance.setEllipsoid('WGS84')
fieldnames = [f.name() for f in layer.fields() if f.name().startswith(('fr','to'))] #List fields starting with fr and to
field_to_update = 'distance' #Change to match the field you want to store distances in
with edit(layer):
for f in layer.getFeatures():
p1 = QgsPointXY(f[fieldnames[0]]/100000,f[fieldnames[1]]/100000)
p2 = QgsPointXY(f[fieldnames[2]]/100000,f[fieldnames[3]]/100000)
m = distance.measureLine(p1, p2)
f.setAttribute(f.fieldNameIndex(field_to_update),m)
layer.updateFeature(f)
Answered by BERA on March 10, 2021
Thank you very much for your support.
I managed to do it.
Use the plugin "PointConnector" to create lines between the busstops. Then just use the "add Geometricattribute" tool.
Easy but very effetive.
Tipp 1: Only use WGS 84 Tipp 2: Be careful while creating the from-to-list for PointConnector. Excel rounds the zeros , therefor 10 is converted to 1. Tipp 3: PointConnector: Read the Python concole if errors accur. It helps alot to understand what went wrong. Sometimes just a new project with the same steps solves the problem. Or you can use the "repair geometrie" tool
Hope this helps.
Answered by yadigar3851 on March 10, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP