function importRouteStops()
{
    include_once "../public_html/apps/routecoorddistances.php";
    $url = "http://shuttles.rpi.edu/displays/netlink.js";
    $data = json_decode(getUrl($url));
    //print_ar($data);exit;
    foreach ($data as $type => $datum) {
        switch ($type) {
            case 'stops':
                foreach ($datum as $stop) {
                    /* update 'stops' table */
                    if ($stop->short_name) {
                        if (Stop::get($stop->short_name)) {
                            Stop::update($stop->short_name, $stop);
                        } else {
                            Stop::insert($stop);
                        }
                    }
                    foreach ($stop->routes as $stop_route) {
                        /* update 'stop_routes' table */
                        if (!StopRoute::get($stop->short_name, $stop_route->id)) {
                            StopRoute::insert($stop->short_name, $stop_route->id);
                        }
                    }
                }
                break;
            case 'routes':
                foreach ($datum as $route) {
                    /* update 'route' table */
                    if (Route::get($route->id)) {
                        Route::update($route->id, $route);
                    } else {
                        Route::insert($route->id, $route);
                    }
                    if ($route->coords) {
                        RouteCoords::delete($route->id);
                        /* delete all coords for route */
                        $seq = 0;
                        foreach ($route->coords as $route_coord) {
                            /* update 'route_coords' table */
                            RouteCoords::insert($route->id, $seq, $route_coord);
                            $seq++;
                        }
                    }
                }
                break;
        }
    }
    RouteCoordDistances::loadDistanceTable();
}
 /**
  * get list of stops based on location
  *
  * @param  int  $location_id
  * @return Response
  */
 public function getByLocation($location_id)
 {
     if ($location_id) {
         // get all stops based on the condition
         $stops = Stop::LocationId($location_id)->get();
     } else {
         // get all
         $stops = Stop::get();
     }
     if ($stops->count()) {
         echo json_encode($stops);
     } else {
         echo json_encode(array());
     }
 }