3

I'm using QGIS 3.22.0 Bialowieza.

I have a point Layer which I generated from a street layer. I used these points to calculate the time accessibility with openrouteservices. The isochrones I get back are helpful and visualize what I need. However, the isochrones dont adopt the same attributes as the points. For my project, it is important that I have the original attributes, which I tried to accomplish with a vector spatial join. The isochrones openrouteservices processed overlap (which generally speaking in ok), but in Terms of allocating the points back to the their original isochrones quite complicated. The overlapping of the isochrones is leading QGIS to allocate the points to the false isochrones. How can I have each point be assigned to the appropriate and correct isochrone?

I'm using "Join attributes by location": I have by points as input layer and my isochrones as joining layer and "Take attributes of the feature with the largest overlap only". Unfortunately the results arent correct. enter image description here

2
  • 1
    Which spatial join are you using? What parameters are you using? Please provide a screen shot.
    – Walshe_d
    Commented Oct 20, 2023 at 18:30
  • I edited my questions with the information you asked for. I think its the correct approach, but the results arent pleasing. I think because the polygons in the isochrones are overlapping, its difficult to make a perfect spatial join. But I cant think of any alternatives...
    – rtaani
    Commented Oct 23, 2023 at 8:32

2 Answers 2

4
+50

You dont need a spatial join.

  • You have a point layer
  • The Open Route Service tool "Isochrones from Point-Layer" has a setting to transfer an ID (or any other field) from the point layer to the resulting isochrone polygons.

So you just have to :

  1. made sure your point layer has a suitable field for unique ID, if not you need to create one (any field will do as long as each point get a different value)
  2. Generate isochrone using the "Isochrones from Point-Layer" ORS tool (take care to select your point ID field in the "Input layer ID Field" dropdown)
  3. Open the isochrone layer properties, go to the Join tab and set a new join to the point layer using your point ID field

enter image description here

1
  • Wow! That was the trick! So simple and took me forever in workarounds! Thank you very very much!
    – rtaani
    Commented Oct 23, 2023 at 14:20
0

If I understand your problem correctly, your spatial join fails because the isochrones don't have holes in them? If that is the case you can fix it with a short python script. And there is probably also a QGIS plugin that can create the holes. I tried to download a geojson with isochrones from openrouteservices, and this python script worked for me

with open("~/geojson-downloaded-from-openrouteservices.json", "r") as f:
d = json.load(f)

polys = [x for x in d["features"] if x["geometry"]["type"] == "Polygon"]
polys.sort(key=lambda x: x["properties"]["value"])

for cur, prev in zip(polys[1:], polys[:-1]):
    cur["geometry"]["coordinates"].append(prev["geometry"]["coordinates"][0])

d["features"] = polys

with open("~/geojson-you-load-in-qgis.json", "w") as f:
    json.dump(d, f)
1
  • I think you misunderstood - but thanks anyway! The perfect answer came right after yours!
    – rtaani
    Commented Oct 23, 2023 at 14:19

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.