I was looking for a way to extract points from 4 graphs i have plotted in Python in order to run the Ramer Douglas peucker algorithm on the points. Ideally the data would be presented in a series of x and y co-ordinates as the current data set is presented differently. Each graph is made up of around 2000 points but they are not formatted as X and Y co-ordinates in the data set. I have attached the code used to plot the graphs as well as the data set if anyone has any suggestions.
https://1drv.ms/f/s!AoxfZQIWTCMacLdktiBQeU1ZVTE (data set used to plot graphs)
""" File for importing route data from a json file """ import json import os import matplotlib.pyplot as plt from rdp import rdp import numpy as np def get_data(file_name): """ method to retrieve JSON data from "file" :param file_name: string representing file in which JSON data is stored :return data: Pyhonic data created from JSON file information """ with open(os.path.join(os.sys.path, file_name), "r") as data_file: data = json.load(data_file) # load data from JSON file return data if __name__== "__main__": file_name = 'json_data.json' routes = get_data(file_name) print("Total Time") print(routes["totalTime"]) print("Total Distance") print(routes["totalDistance"]) routesPos = 0 edgePos = 0 edgeDistance = 0 alts =  distances =  while routesPos < len(routes): while edgePos < len(routes[routesPos]["edges"]): edgeDistance = edgeDistance + routes[routesPos]["edges"][edgePos]["edgeDistance"] distances.append(edgeDistance) alts.append(routes[routesPos]["edges"][edgePos]["endLocation"]["alt"]) edgePos += 1 plt.plot(distances, alts, color='blue') edgeDistance = 0 routesPos += 1 edgePos = 0