I am trying to return routes from a batch of coordinates to a single location. This is a volunteer project for a local foodbank and I am quite inexperienced in writing code.
Here is what I wrote in Python:
import csv import openrouteservice from openrouteservice import convert client = openrouteservice.Client(key='5b3ce3597851110001cf624863085b996464465cbf0974fe690fc4ef') with open ('ClientCoordinates10test.csv' , 'r') as csv_coords: csv_reader = csv.reader(csv_coords) EXTRA_COORD = (2.23179, 53.464774) new_csv_coords =  routelist =  for line in csv_reader: new_csv_coords.append(((float(line), float(line)), EXTRA_COORD)) coords = (new_csv_coords) print(coords) routes = client.directions(coords) decoded = convert.decode_polyline(routes['routes']['geometry']) print(decoded) routelist.append(decoded) # create a file to write to f = open('route.geojson', 'w+') # write our path to the file f.write(str(routelist))
However when I try to load the GeoJSON into QGIS I get an “invalid GeoJSON” error. I’m wondering whether I need to write more properties to the GeoJSON? and if so how do I do this?
Any help is greatly appreciated.