Browse Source

initial commit

Johann Woelper 7 years ago
commit
16043d9018
6 changed files with 125574 additions and 0 deletions
  1. 2 0
      .gitignore
  2. 14 0
      Cargo.lock
  3. 7 0
      Cargo.toml
  4. 3 0
      Readme.md
  5. 125497 0
      data/Day1-1.gpx
  6. 51 0
      src/main.rs

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+/target
+**/*.rs.bk

+ 14 - 0
Cargo.lock

@@ -0,0 +1,14 @@
+[[package]]
+name = "pothole"
+version = "0.1.0"
+dependencies = [
+ "xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "xml-rs"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[metadata]
+"checksum xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "541b12c998c5b56aa2b4e6f18f03664eef9a4fd0a246a55594efae6cc2d964b5"

+ 7 - 0
Cargo.toml

@@ -0,0 +1,7 @@
+[package]
+name = "pothole"
+version = "0.1.0"
+authors = ["Johann Woelper <johann.woelper@king.com>"]
+
+[dependencies]
+xml-rs = "0.8"

+ 3 - 0
Readme.md

@@ -0,0 +1,3 @@
+#pothole
+
+Analyze datapoints to gather road quality insights.

File diff suppressed because it is too large
+ 125497 - 0
data/Day1-1.gpx


+ 51 - 0
src/main.rs

@@ -0,0 +1,51 @@
+extern crate xml;
+
+use std::fs::File;
+use std::io::BufReader;
+
+use xml::reader::{EventReader, XmlEvent};
+
+
+
+
+struct Point {
+    lat: f64,
+    long: f64, 
+    ele: f64
+}
+
+struct Tour {
+    points: Vec<Point>
+}
+
+
+fn dist(p1: Point, p2: Point) -> f64{
+    let R = 6371;
+    let dLat: f64 = p1.lat - p2.lat;
+    return 1.0
+}
+
+fn main() {
+    let file = File::open("data/Day1-1.gpx").unwrap();
+    let file = BufReader::new(file);
+
+    let parser = EventReader::new(file);
+    let mut depth = 0;
+    for e in parser {
+        match e {
+            Ok(XmlEvent::StartElement { name, attributes, namespace }) => {
+                println!("{:?} {:?}", name, attributes);
+                depth += 1;
+            }
+            Ok(XmlEvent::Characters(text)) => {
+                    println!("{:?}", text);
+            }
+            Err(e) => {
+                println!("Error: {}", e);
+                break;
+            }
+            _ => {}
+        }
+
+    }
+}